git clone --recurse-submodules https://github.com/grpc/grpc
安装
mkdir -p /opt/grpc
cd grpc
mkdir -p cmake/build
pushd cmake/build
cmake -DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DCMAKE_INSTALL_PREFIX=/opt/grpc \
-DBUILD_SHARED_LIBS=ON \
../..
make -j
make install
popd
DCMAKE_INSTALL_PREFIX=/opt/grpc: 安装路径
DBUILD_SHARED_LIBS=ON: 生产动态库
cd examples/cpp/helloworld
mkdir -p cmake/build
pushd cmake/build
cmake -DCMAKE_PREFIX_PATH=./ ../..
make -j
测试
cd examples/cpp/helloworld/cmake/build
./greeter_server
cd examples/cpp/helloworld/cmake/build
./greeter_client
输出:
Greeter received: Hello world
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)