diff options
author | 2016-07-27 15:24:05 +0100 | |
---|---|---|
committer | 2016-07-27 15:24:05 +0100 | |
commit | 2391156890ed08bbec4cdbea92bf951965d22e00 (patch) | |
tree | f31fcbc7bf777b3e2c9e09f37a737ce46c4f845f /CMakeLists.txt | |
parent | 7979424757ffa70692456fce6071cdc8b9ec6a0e (diff) |
Add cmake option to compile using protobuf-lite
After this change specifying -DGRPC_USE_PROTO_LITE=On at the cmake
command line will cause gRPC to use the protobuf-lite runtime what
can result in a major size improvement.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f647e0a98..8ecac868db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,13 @@ add_subdirectory(${ZLIB_ROOT_DIR} third_party/zlib) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +if (GRPC_USE_PROTO_LITE) + set(PROTOBUF_LIBRARY_NAME "libprotobuf-lite") + add_definitions("-DGRPC_USE_PROTO_LITE") +else() + set(PROTOBUF_LIBRARY_NAME "libprotobuf") +endif() + add_library(gpr src/core/lib/profiling/basic_timers.c @@ -742,7 +749,7 @@ target_include_directories(grpc++ target_link_libraries(grpc++ ssl - libprotobuf + ${PROTOBUF_LIBRARY_NAME} grpc ) @@ -809,7 +816,7 @@ target_include_directories(grpc++_unsecure ) target_link_libraries(grpc++_unsecure - libprotobuf + ${PROTOBUF_LIBRARY_NAME} gpr grpc_unsecure grpc |