-
Notifications
You must be signed in to change notification settings - Fork 14
Need easy instructions for running "samples" commands #1133
Comments
/cc @mmmarklu |
Thanks for filing the issue. Can you confirm one thing for me? Running through the steps in INSTALL.md does not build an executable file based on samples.cc. I want to confirm because when I ran sudo cmake --build folder --target install, the console said "Built target samples", which I assume was doing something with the various build files in the samples folder (BUILD, CMakeList, etc) but it looks like those are just building/running tests. Is that correct? |
Yes, I think. If you look in the directory where all your cmake output files went -- it's probably called Overall, though, I don't think the full set of "install" instructions are the right thing for the quick start web page. It's too involved and complex for a getting-started thing. FTR, iff a user has bazel installed, they can compile and run the samples binary with a single command like this one (that works with my sample project/instance): $ bazel run google/cloud/spanner/samples:spanner_client_samples -- create-database jgm-cloud-cxx jgm-spanner-instance samples I'd like to get us closer to something like that. However, I suspect that few people have bazel installed, but maybe that's OK? We basically need to decide what is the easiest/best way to get users up and running quickly. |
The executable is created in
If you only have CMake installed, then this will download all the dependencies (except OpenSSL), compile them and compile our code: cmake -Hsuper -Bcmake-out
cmake --build cmake-out The binary is then located in We can make that path less horrible with some changes to the |
How about install the samples to something like cmake -Hsuper -Bcmake-out/si -DCMAKE_BUILD_TYPE=Release \
-DGOOGLE_CLOUD_CPP_EXTERNAL_PREFIX=$PWD/local-spanner -GNinja
cmake --build cmake-out/si
# Samples are in $PWD/local-spanner/share/samples |
@remyabel I like the idea of installing the samples, though I think |
Yes now I realized that it's common to distribute examples source code not precompiled binaries to
Then add a separate flag to compile examples (like g-c-cpp) to kill two birds with one stone. Or if that's too complicated just copy all the sample binaries to something like |
Tagging @antfitch who may be interested in following this issue. |
After a discussion offline, we're going to look into using bazel for this samples command. The reason being that it may be easier to get a command like Next steps:
|
I think
We should change the |
In order to have a nice "getting started" page for C++ similar to this one for Java, we need some reasonably simple instructions for users can run the individual sample commands.
Some possible options:
Direct users to the INSTALL.md file and have them install the deps and compile all the spanner code. This is likely a lot of work for a "getting started" doc.
Use bazel. Bazel is pretty simple since it builds all the deps automatically. The downside is that most users do not use bazel, so they'd first need to go install bazel.
Use a Dockerfile where we can automate this. The downside is that users need to install docker if they don't already have it.
Use vcpkg. Users would need to install vcpkg if they don't already have it.
We host/provide a few statically linked, precompiled "samples" binaries. We'd need one for Windows, Mac, and Linux (at least). Users could then directly run these pre-compiled binaries when going through the "samples" exercises and they'd have nothing to compile themselves.
Some other script of some form??
.... ???
The text was updated successfully, but these errors were encountered: