You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2018/04/21 02:17:12 UTC
[5/7] mesos git commit: Building gRPC support in libprocess with
CMake.
Building gRPC support in libprocess with CMake.
This patch enables CMake to build code for gRPC support in libprocess
along with tests.
Review: https://reviews.apache.org/r/61118/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8021e293
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8021e293
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8021e293
Branch: refs/heads/master
Commit: 8021e29381dedf4dd8082f6f889e2f4e67505d2a
Parents: a2ee950
Author: Chun-Hung Hsiao <ch...@apache.org>
Authored: Fri Apr 20 18:17:50 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri Apr 20 18:17:50 2018 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/CMakeLists.txt | 6 ++++++
3rdparty/libprocess/src/tests/CMakeLists.txt | 25 +++++++++++++++++++++++
2 files changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/8021e293/3rdparty/libprocess/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/CMakeLists.txt b/3rdparty/libprocess/src/CMakeLists.txt
index 1eca50a..cf443df 100644
--- a/3rdparty/libprocess/src/CMakeLists.txt
+++ b/3rdparty/libprocess/src/CMakeLists.txt
@@ -71,6 +71,11 @@ else ()
subprocess_posix.cpp)
endif ()
+if (ENABLE_GRPC)
+ list(APPEND PROCESS_SRC
+ grpc.cpp)
+endif ()
+
if (ENABLE_LIBEVENT)
list(APPEND PROCESS_SRC
libevent.hpp
@@ -102,6 +107,7 @@ target_link_libraries(
process PUBLIC
stout
http_parser
+ $<$<BOOL:${ENABLE_GRPC}>:grpc>
$<$<BOOL:${ENABLE_SSL}>:OpenSSL::SSL>
$<$<BOOL:${ENABLE_SSL}>:OpenSSL::Crypto>)
http://git-wip-us.apache.org/repos/asf/mesos/blob/8021e293/3rdparty/libprocess/src/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/CMakeLists.txt b/3rdparty/libprocess/src/tests/CMakeLists.txt
index d624402..1b2d75d 100644
--- a/3rdparty/libprocess/src/tests/CMakeLists.txt
+++ b/3rdparty/libprocess/src/tests/CMakeLists.txt
@@ -49,6 +49,28 @@ if (NOT WIN32)
reap_tests.cpp)
endif ()
+if (ENABLE_GRPC)
+ set(GRPC_TESTS_PROTOS
+ grpc_tests.grpc.pb.cc
+ grpc_tests.grpc.pb.h
+ grpc_tests.pb.cc
+ grpc_tests.pb.h)
+
+ list(APPEND PROCESS_TESTS_SRC
+ grpc_tests.cpp
+ ${GRPC_TESTS_PROTOS})
+
+ add_custom_command(
+ OUTPUT ${GRPC_TESTS_PROTOS}
+ COMMAND protoc
+ -I${CMAKE_CURRENT_SOURCE_DIR}
+ --cpp_out=${CMAKE_CURRENT_BINARY_DIR}
+ --grpc_out=${CMAKE_CURRENT_BINARY_DIR}
+ --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin>
+ ${CMAKE_CURRENT_SOURCE_DIR}/grpc_tests.proto
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/grpc_tests.proto)
+endif ()
+
if (ENABLE_SSL)
list(APPEND PROCESS_TESTS_SRC
jwt_tests.cpp
@@ -62,6 +84,9 @@ target_include_directories(process-interface INTERFACE ..)
add_executable(libprocess-tests EXCLUDE_FROM_ALL ${PROCESS_TESTS_SRC})
target_link_libraries(libprocess-tests PRIVATE process-interface)
+# NOTE: This is for the generated gRPC headers.
+target_include_directories(libprocess-tests PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+
target_compile_definitions(
libprocess-tests PRIVATE
BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}")