|
|
|
@ -161,10 +161,11 @@ Please note that when using Ninja, you will still need Visual C++ (part of Visua |
|
|
|
|
installed to be able to compile the C/C++ sources. |
|
|
|
|
``` |
|
|
|
|
> @rem Run from grpc directory after cloning the repo with --recursive or updating submodules. |
|
|
|
|
> md .build |
|
|
|
|
> cd .build |
|
|
|
|
> cd cmake |
|
|
|
|
> md build |
|
|
|
|
> cd build |
|
|
|
|
> call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64 |
|
|
|
|
> cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release |
|
|
|
|
> cmake ..\.. -GNinja -DCMAKE_BUILD_TYPE=Release |
|
|
|
|
> cmake --build . |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
@ -183,7 +184,7 @@ ie `gRPC_CARES_PROVIDER`. |
|
|
|
|
### Install after build |
|
|
|
|
|
|
|
|
|
Perform the following steps to install gRPC using CMake. |
|
|
|
|
* Set `gRPC_INSTALL` to `ON` |
|
|
|
|
* Set `-DgRPC_INSTALL=ON` |
|
|
|
|
* Build the `install` target |
|
|
|
|
|
|
|
|
|
The install destination is controlled by the |
|
|
|
@ -196,16 +197,21 @@ in "module" mode and install them alongside gRPC in a single step. |
|
|
|
|
If you are using an older version of gRPC, you will need to select "package" |
|
|
|
|
mode (rather than "module" mode) for the dependencies. |
|
|
|
|
This means you will need to have external copies of these libraries available |
|
|
|
|
on your system. |
|
|
|
|
on your system. This [example](test/distrib/cpp/run_distrib_test_cmake.sh) shows |
|
|
|
|
how to install dependencies with cmake before proceeding to installing gRPC itself. |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
$ cmake .. -DgRPC_CARES_PROVIDER=package \ |
|
|
|
|
-DgRPC_PROTOBUF_PROVIDER=package \ |
|
|
|
|
-DgRPC_SSL_PROVIDER=package \ |
|
|
|
|
-DgRPC_ZLIB_PROVIDER=package |
|
|
|
|
# NOTE: all of gRPC's dependencies need to be already installed |
|
|
|
|
$ cmake ../.. -DgRPC_INSTALL=ON \ |
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \ |
|
|
|
|
-DgRPC_ABSL_PROVIDER=package \ |
|
|
|
|
-DgRPC_CARES_PROVIDER=package \ |
|
|
|
|
-DgRPC_PROTOBUF_PROVIDER=package \ |
|
|
|
|
-DgRPC_SSL_PROVIDER=package \ |
|
|
|
|
-DgRPC_ZLIB_PROVIDER=package |
|
|
|
|
$ make |
|
|
|
|
$ make install |
|
|
|
|
``` |
|
|
|
|
[Example](test/distrib/cpp/run_distrib_test_cmake.sh) |
|
|
|
|
|
|
|
|
|
### Cross-compiling |
|
|
|
|
|
|
|
|
@ -222,7 +228,7 @@ that will be used for this build. |
|
|
|
|
This toolchain file is specified to CMake by setting the `CMAKE_TOOLCHAIN_FILE` |
|
|
|
|
variable. |
|
|
|
|
``` |
|
|
|
|
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=path/to/file |
|
|
|
|
$ cmake ../.. -DCMAKE_TOOLCHAIN_FILE=path/to/file |
|
|
|
|
$ make |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|