aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2016-07-27 11:28:41 -0700
committerGravatar GitHub <noreply@github.com>2016-07-27 11:28:41 -0700
commit63d2b28d45fae8b2f971c26e88ed91766248721a (patch)
treecb52729c940779b861da741aa6a0b6a50b69a404
parent818564cc2b9453b4b093f417f3c5c6cb4d07ad7e (diff)
parent2391156890ed08bbec4cdbea92bf951965d22e00 (diff)
Merge pull request #7546 from tberghammer/proto-lite
Add cmake option to compile using protobuf-lite
-rw-r--r--CMakeLists.txt11
-rw-r--r--templates/CMakeLists.txt.template9
2 files changed, 17 insertions, 3 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
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template
index 52e8b866be..8624dc4b25 100644
--- a/templates/CMakeLists.txt.template
+++ b/templates/CMakeLists.txt.template
@@ -47,7 +47,7 @@
if target_dict.get('secure', False):
deps = ["ssl"]
if target_dict['name'] in ['grpc++', 'grpc++_unsecure', 'grpc++_codegen_lib']:
- deps.append("libprotobuf")
+ deps.append("${PROTOBUF_LIBRARY_NAME}")
elif target_dict['name'] in ['grpc']:
deps.append("zlibstatic")
for d in target_dict.get('deps', []):
@@ -88,6 +88,13 @@
set(CMAKE_C_FLAGS "<%text>${CMAKE_C_FLAGS}</%text> -std=c11")
set(CMAKE_CXX_FLAGS "<%text>${CMAKE_CXX_FLAGS}</%text> -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()
+
% for lib in libs:
% if lib.build in ["all", "protoc", "tool"]:
${cc_library(lib)}