grpc-proto/cci.20220627¶
grpc-proto/cci.20220627 dependencies¶
Using the grpc-proto Conan Package¶
Conan integrates with different build systems. You can declare which build system you want your project to use setting in the [generators] section of the conanfile.txt or using the generators attribute in the conanfile.py. Here, there is some basic information you can use to integrate grpc-proto in your own project. For more detailed information, please check the Conan documentation.
Using grpc-proto with CMake¶
Conan CMake generators¶
-
CMakeDeps: generates information about where the grpc-proto library and its dependencies ( protobuf, googleapis, zlib) are installed together with other information like version, flags, and directory data or configuration. CMake will use this files when you invoke
find_package()in your CMakeLists.txt. -
CMakeToolchain: generates a CMake toolchain file that you can later invoke with CMake in the command line using
-DCMAKE_TOOLCHAIN_FILE=conantoolchain.cmake.
Declare these generators in your conanfile.txt along with your grpc-proto dependency like:
[requires]
grpc-proto/cci.20220627
[generators]
CMakeDeps
CMakeToolchain
To use grpc-proto in a simple CMake project with this structure:
.
|-- CMakeLists.txt
|-- conanfile.txt
`-- src
`-- main..cpp
Your CMakeLists.txt could look similar to this, using the global grpc-proto::grpc-proto CMake's target:
cmake_minimum_required(VERSION 3.15)
project(grpc-proto_project CXX)
find_package(grpc-proto)
add_executable(${PROJECT_NAME} src/main.cpp)
# Use the global target
target_link_libraries(${PROJECT_NAME} grpc-proto::grpc-proto)
To install grpc-proto/cci.20220627, its dependencies and build your project, you just have to do:
# for Linux/macOS
$ conan install . --install-folder cmake-build-release --build=missing
$ cmake . -DCMAKE_TOOLCHAIN_FILE=cmake-build-release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
$ cmake --build .
# for Windows and Visual Studio 2017
$ conan install . --output-folder cmake-build --build=missing
$ cmake . -G "Visual Studio 15 2017" -DCMAKE_TOOLCHAIN_FILE=cmake-build/conan_toolchain.cmake
$ cmake --build . --config Release
Using grpc-proto with Visual Studio¶
Visual Studio Conan generators¶
-
MSBuildDeps: generates the conandeps.props properties file with information about where the grpc-proto library and its dependencies ( protobuf, googleapis, zlib) are installed together with other information like version, flags, and directory data or configuration.
-
MSBuildToolchain: Generates the conantoolchain.props properties file with the current package configuration, settings, and options.
Declare these generators in your conanfile.txt along with your grpc-proto dependency like:
[requires]
grpc-proto/cci.20220627
[generators]
MSBuildDeps
MSBuildToolchain
Please, check the Conan documentation for more detailed information on how to add these properties files to your Visual Studio projects.
Using grpc-proto with Autotools and pkg-config¶
Autotools Conan generators¶
-
AutotoolsToolchain: generates the conanautotoolstoolchain.sh/bat script translating information from the current package configuration, settings, and options setting some enviroment variables for Autotools like:
CPPFLAGS,CXXFLAGS,CFLAGSandLDFLAGS. It will also generate adeactivate_conanautotoolstoolchain.sh/batso you can restore your environment. -
AutotoolsDeps: generates the conanautotoolsdeps.sh/bat script with information about where the grpc-proto library and its dependencies ( protobuf, googleapis, zlib) are installed together with other information like version, flags, and directory data or configuration. This is done setting some enviroment variables for Autotools like:
LIBS,CPPFLAGS,CXXFLAGS,CFLAGSandLDFLAGS. It will also generate adeactivate_conanautotoolsdeps.sh/batso you can restore your environment.
Declare these generators in your conanfile.txt along with your grpc-proto dependency like:
[requires]
grpc-proto/cci.20220627
[generators]
AutotoolsToolchain
AutotoolsDeps
Then, building your project is as easy as:
$ conan install .
# set the environment variables for Autotools
$ source conanautotoolstoolchain.sh
$ source conanautotoolsdeps.sh
$ ./configure
$ make
# restore the environment after the build is completed
$ source deactivate_conanautotoolstoolchain.sh
$ source deactivate_conanautotoolsdeps.sh
pkg-config Conan generator¶
- PkgConfigDeps: generates the grpc-proto.pc file (and the ones corresponding to grpc-proto dependencies) with information about the dependencies that can be later used by the pkg-config tool pkg-config to collect data about the libraries Conan installed.
You can use this generator instead of the AutotoolsDeps one:
[requires]
grpc-proto/cci.20220627
[generators]
AutotoolsToolchain
PkgConfigDeps
And then using pkg-config to set the environment variables you want, like:
$ conan install .
# set the environment variables for Autotools
$ source conanautotoolstoolchain.sh
$ export CPPFLAGS="$CPPFLAGS $(pkg-config --cflags grpc-proto)"
$ export LIBS="$LIBS $(pkg-config --libs-only-l grpc-proto)"
$ export LDFLAGS="$LDFLAGS $(pkg-config --libs-only-L --libs-only-other grpc-proto)"
$ ./configure
$ make
# restore the environment after the build is completed
$ source deactivate_conanautotoolstoolchain.sh
Other build systems¶
Please, check the Conan documentation for other integrations besides the ones listed in this document.
Exposed header files for grpc-proto¶
#include <grpc/channelz/v1/channelz.pb.h>
#include <grpc/gcp/handshaker.pb.h>
#include <grpc/gcp/transport_security_common.pb.h>
#include <grpc/gcp/altscontext.pb.h>
#include <grpc/core/stats.pb.h>
#include <grpc/health/v1/health.pb.h>
#include <grpc/reflection/v1alpha/reflection.pb.h>
#include <grpc/reflection/v1/reflection.pb.h>
#include <grpc/service_config/service_config.pb.h>
#include <grpc/testing/stats.pb.h>
#include <grpc/testing/benchmark_service.pb.h>
#include <grpc/testing/control.pb.h>
#include <grpc/testing/worker_service.pb.h>
#include <grpc/testing/payloads.pb.h>
#include <grpc/testing/messages.pb.h>
#include <grpc/testing/report_qps_scenario_service.pb.h>
#include <grpc/lookup/v1/rls_config.pb.h>
#include <grpc/lookup/v1/rls.pb.h>
#include <grpc/binlog/v1/binarylog.pb.h>
#include <grpc/lb/v1/load_balancer.pb.h>
#include <grpc/lb/v1/load_reporter.pb.h>
---¶
Conan 1.58.0. JFrog LTD. https://conan.io. Autogenerated 2023-02-05 17:37:10.