@@ -30,50 +30,43 @@ git clone git@github:<github-username>/google-cloud-cpp.git
3030cd google-cloud-cpp
3131```
3232
33- ## Install the dependencies in ` $HOME/local-cpp ` .
33+ ## Download and boostrap ` vcpkg `
3434
35- In this guide we will install the dependencies in ` $HOME/local-cpp ` , you can
36- pick any directory where you have write permissions. We will then compile the
37- project against these dependencies. The installation needs to be done every time
38- the version of the dependencies is changed. Once installed you can use them for
39- any build or from any other clone.
40-
41- Configure the super-build to install in ` $HOME/local-cpp ` . We recommend that
42- you use Ninja for this build because it is substantially faster than Make for
43- these use-cases. Note that if Ninja is not installed in your workstation you may
44- need to remove the ` -GNinja ` flag:
35+ [ vcpkg] is a package manager for C++ that builds from source and installs any
36+ binary artifacts in ` $HOME ` . We recommend using ` vcpkg ` for local development.
37+ In these instructions, we will install ` vcpkg ` descriptions in ` $HOME/vcpkg ` ,
38+ you can change the ` vcpkg ` location, just remember to adapt these instructions
39+ as you go along. Download the ` vcpkg ` package descriptions using ` git ` :
4540
4641``` shell
47- cmake -Hsuper -Bcmake-out/si \
48- -DGOOGLE_CLOUD_CPP_EXTERNAL_PREFIX=$HOME /local-cpp -GNinja
42+ git -C $HOME clone https://github.com/microsoft/vcpkg
4943```
5044
51- Install the dependencies:
52-
53- > ** Note:** Ninja will parallelize the build to use all the cores in your
54- > workstation, if you are not using Ninja, or want to limit the number of cores
55- > used by the build use the ` -j ` option.
45+ Then bootstrap the ` vcpkg ` tool:
5646
5747``` shell
58- cmake --build cmake-out/si --target project-dependencies
48+ $HOME /vcpkg/bootstrap-vcpkg.sh
5949```
6050
61- ## Building with the installed dependencies
51+ ## Building ` google-cloud-cpp ` with vcpkg
6252
63- Now you can use these dependencies from different builds. Configure your CMake
64- builds with ` -DCMAKE_PREFIX_PATH=$HOME/local-cpp ` to build ` google-cloud-cpp ` :
53+ Now you can use ` vcpkg ` to compile ` google-cloud-cpp ` . Just add one option
54+ to the ` cmake ` configure step :
6555
6656``` shell
6757cd $HOME /google-cloud-cpp
68- cmake -H. -Bcmake-out/home -DCMAKE_PREFIX_PATH =$HOME /local-cpp
58+ cmake -H. -Bcmake-out/home -DCMAKE_TOOLCHAIN_FILE =$HOME /vcpkg/scripts/buildsystems/vcpkg.cmake
6959cmake --build cmake-out/home
7060```
7161
72- You can use these dependencies from other locations too:
62+ The first time you run this command it can take a significant time to download
63+ and compile all the dependencies (Abseil, gRPC, Protobuf, etc). Note that vcpkg
64+ caches binary artifacts (in ` $HOME/.cache/vcpkg ` ) so a second build would be
65+ much faster:
7366
7467``` shell
7568cd $HOME /another-google-cloud-cpp-clone
76- cmake -H. -Bcmake-out/home -DCMAKE_PREFIX_PATH =$HOME /local-cpp
69+ cmake -H. -Bcmake-out/home -DCMAKE_TOOLCHAIN_FILE =$HOME /vcpkg/scripts/buildsystems/vcpkg.cmake
7770cmake --build cmake-out/home
7871```
7972
@@ -104,13 +97,18 @@ installed, you can change the compiler using:
10497
10598``` shell
10699CXX=clang++ CC=clang \
107- cmake -H. -Bcmake-out/clang -DCMAKE_PREFIX_PATH =$HOME /local-cpp
100+ cmake -H. -Bcmake-out/home -DCMAKE_TOOLCHAIN_FILE =$HOME /vcpkg/scripts/buildsystems/vcpkg.cmake
108101
109102# Then compile and test normally:
110103cmake --build cmake-out/clang
111104(cd cmake-out/clang && ctest --output-on-failure -LE integration-test)
112105```
113106
107+ ` vcpkg ` uses the compiler as part of its binary cache inputs, that is, changing
108+ the compiler will require rebuilding the dependencies from source. The good
109+ news is that ` vcpkg ` can hold multiple versions of a binary artifact in its
110+ cache.
111+
114112### Changing the build type
115113
116114By default, the system is compiled with optimizations on; if you want to compile
0 commit comments