I\'m trying to integrate grpc into C++ projects. but I found the only way is download all source code and compile it by my self.
Is there any way to get a precompile .s
Is there any way to get a precompile .so/.a file which I can link against and a grpc_cpp_plugin for Linux?
To answer this question, the gRPC C++ plugin currently requires manual build and install as stated here: https://grpc.io/blog/installation/
That means that there are currently no precompiled gRPC C++ plugins.
If you are looking for precompiled gRPC libraries you should go with vcpkg. I was also trying to cross compile gRPC, without building the library itself. With vcpkg I achieved this quite well. There are just a few steps to set this up:
Here is my CMakeLists.txt:
cmake_minimum_required(VERSION 3.1)
if(DEFINED ENV{VCPKG_ROOT})
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
else()
set(CMAKE_TOOLCHAIN_FILE "/path_to_vcpkg/scripts/buildsystems/vcpkg.cmake")
endif()
project(Foo)
find_package(gRPC CONFIG REQUIRED)
...
add_executable(${PROJECT_NAME} ${Bar})
target_link_libraries(${PROJECT_NAME} PRIVATE gRPC::gpr gRPC::grpc gRPC::grpc++ gRPC::grpc_cronet)
In the Folder path_to_vcpkg/packages/grpc_x64-PLATFORM/tools/grpc you will find all the precompiled grpc-plugins for your platform (also grpc_cpp_plugin).
Pros:
Cons: