This is an automated email from the ASF dual-hosted git repository.

asekretenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit e1b8877e2c89871bc76823bf3ca89e9ce98cf3c0
Author: Andriy Kornatskyy <andriy.kornats...@live.com>
AuthorDate: Fri May 29 11:37:36 2020 +0300

    Added cmake build option to install build-time module dependencies.
    
    This patch introduces `ENABLE_INSTALL_MODULE_DEPENDENCIES` option
    that adds cmake install targets for libraries (including bundled
    3rd-party ones) and headers needed to build Mesos modules, similarly
    to the option `--enable-install-module-dependencies` in the automake
    build.
    Note that the layout of installed files is different from the one
    produced by automake.
    
    Install targets for stout and libprocess headers are added separately
    in the next commits.
    
    This closes #363
---
 3rdparty/CMakeLists.txt          | 42 ++++++++++++++++++++++++++++++++++++++++
 cmake/CompilationConfigure.cmake |  4 ++++
 src/CMakeLists.txt               |  9 ++++++++-
 3 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index a2e6549..445c45f 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -465,6 +465,11 @@ install(
   DIRECTORY ${GLOG_INSTALL_DIR}/lib/
   DESTINATION ${MESOS_INSTALL_LIBRARIES})
 
+if (ENABLE_INSTALL_MODULE_DEPENDENCIES)
+  install(
+    DIRECTORY ${GLOG_INSTALL_DIR}/include/glog
+    DESTINATION ${MESOS_INSTALL_HEADERS})
+endif ()
 
 # PicoJSON: JSON parser / serializer.
 # https://github.com/kazuho/picojson
@@ -494,6 +499,11 @@ ExternalProject_Add(
   URL               ${PICOJSON_URL}
   URL_HASH          ${PICOJSON_HASH})
 
+if (ENABLE_INSTALL_MODULE_DEPENDENCIES)
+  install(
+    FILES ${PICOJSON_CMAKE_ROOT}/src/picojson-${PICOJSON_VERSION}/picojson.h
+    DESTINATION ${MESOS_INSTALL_HEADERS})
+endif ()
 
 # RapidJSON: JSON parser / serializer.
 # https://github.com/Tencent/rapidjson
@@ -518,6 +528,11 @@ ExternalProject_Add(
   URL               ${RAPIDJSON_URL}
   URL_HASH          ${RAPIDJSON_HASH})
 
+if (ENABLE_INSTALL_MODULE_DEPENDENCIES)
+  install(
+    DIRECTORY 
${RAPIDJSON_CMAKE_ROOT}/src/rapidjson-${RAPIDJSON_VERSION}/include/rapidjson
+    DESTINATION ${MESOS_INSTALL_HEADERS})
+endif ()
 
 if (ENABLE_NVML)
   # NVML: NVIDIA Management Library.
@@ -1316,6 +1331,7 @@ EXTERNAL(protobuf ${PROTOBUF_VERSION} 
${CMAKE_CURRENT_BINARY_DIR})
 
 # TODO(andschwa): Move protobufs so these don't have to be GLOBAL.
 add_library(protobuf ${LIBRARY_LINKAGE} IMPORTED GLOBAL)
+add_library(libprotoc ${LIBRARY_LINKAGE} IMPORTED GLOBAL)
 
 add_dependencies(protobuf ${PROTOBUF_TARGET})
 add_executable(protoc IMPORTED GLOBAL)
@@ -1370,6 +1386,10 @@ else ()
     IMPORTED_LOCATION 
${PROTOBUF_ROOT}-build/libprotobuf${PROTOBUF_SUFFIX}${LIBRARY_SUFFIX})
 
   set_target_properties(
+    libprotoc PROPERTIES
+    IMPORTED_LOCATION 
${PROTOBUF_ROOT}-build/libprotoc${PROTOBUF_SUFFIX}${LIBRARY_SUFFIX})
+
+  set_target_properties(
     protoc PROPERTIES
     IMPORTED_LOCATION ${PROTOBUF_ROOT}-build/protoc)
 endif ()
@@ -1389,6 +1409,15 @@ ExternalProject_Add(
   URL_HASH          ${PROTOBUF_HASH})
 
 install(FILES $<TARGET_FILE:protobuf> DESTINATION ${3RDPARTY_LIBS_INSTALL_DIR})
+install(FILES $<TARGET_FILE:libprotoc> DESTINATION 
${3RDPARTY_LIBS_INSTALL_DIR})
+install(PROGRAMS $<TARGET_FILE:protoc> DESTINATION ${MESOS_INSTALL_RUNTIME})
+
+if (ENABLE_INSTALL_MODULE_DEPENDENCIES)
+  install(
+    DIRECTORY ${PROTOBUF_ROOT}/src/google
+    DESTINATION ${MESOS_INSTALL_HEADERS}
+    FILES_MATCHING PATTERN "*.h")
+endif ()
 
 # gRPC: Google's high performance, open-source universal RPC framework.
 # https://grpc.io/
@@ -1622,6 +1651,19 @@ ExternalProject_Add(
   URL               ${ZOOKEEPER_URL}
   URL_HASH          ${ZOOKEEPER_HASH})
 
+if (ENABLE_INSTALL_MODULE_DEPENDENCIES)
+  install(
+    FILES
+      
${ZOOKEEPER_CMAKE_ROOT}/src/zookeeper-${ZOOKEEPER_VERSION}/src/c/generated/zookeeper.jute.h
+      
${ZOOKEEPER_CMAKE_ROOT}/src/zookeeper-${ZOOKEEPER_VERSION}/src/c/include/config.h
+      
${ZOOKEEPER_CMAKE_ROOT}/src/zookeeper-${ZOOKEEPER_VERSION}/src/c/include/proto.h
+      
${ZOOKEEPER_CMAKE_ROOT}/src/zookeeper-${ZOOKEEPER_VERSION}/src/c/include/recordio.h
+      
${ZOOKEEPER_CMAKE_ROOT}/src/zookeeper-${ZOOKEEPER_VERSION}/src/c/include/winconfig.h
+      
${ZOOKEEPER_CMAKE_ROOT}/src/zookeeper-${ZOOKEEPER_VERSION}/src/c/include/zookeeper_log.h
+      
${ZOOKEEPER_CMAKE_ROOT}/src/zookeeper-${ZOOKEEPER_VERSION}/src/c/include/zookeeper_version.h
+      
${ZOOKEEPER_CMAKE_ROOT}/src/zookeeper-${ZOOKEEPER_VERSION}/src/c/include/zookeeper.h
+    DESTINATION ${MESOS_INSTALL_HEADERS}/zookeeper)
+endif ()
 
 # LevelDB: A fast key-value storage library.
 # https://github.com/google/leveldb
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index f0e712e..ce99cf1 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -33,6 +33,10 @@ option(BUILD_SHARED_LIBS
   "Build shared libraries."
   ${DEFAULT_BUILD_SHARED_LIBS})
 
+option(ENABLE_INSTALL_MODULE_DEPENDENCIES
+  "Install third-party bundled dependencies required for module development"
+  FALSE)
+
 option(ENABLE_PRECOMPILED_HEADERS
   "Enable auto-generated precompiled headers using cotire"
   ${WIN32})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e3a702c..bcb5128 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -676,11 +676,18 @@ install(
   ARCHIVE DESTINATION ${MESOS_INSTALL_LIBRARIES}
   LIBRARY DESTINATION ${MESOS_INSTALL_LIBRARIES})
 
-
 install(
   DIRECTORY webui
   DESTINATION ${MESOS_INSTALL_DATA})
 
+if (ENABLE_INSTALL_MODULE_DEPENDENCIES)
+  install(
+    DIRECTORY
+      ${MESOS_PUBLIC_INCLUDE_DIR}
+      ${MESOS_BIN_INCLUDE_DIR}
+    DESTINATION .)
+endif ()
+
 # BUILD THE MESOS TESTS.
 ########################
 add_subdirectory(tests)

Reply via email to