Skip to content

Commit

Permalink
Added cmake build option to install build-time module dependencies.
Browse files Browse the repository at this point in the history
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 apache#363
  • Loading branch information
akornatskyy authored and asekretenko committed May 29, 2020
1 parent ccfbc91 commit e1b8877
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
42 changes: 42 additions & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1369,6 +1385,10 @@ else ()
protobuf PROPERTIES
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)
Expand All @@ -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/
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions cmake/CompilationConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
9 changes: 8 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e1b8877

Please sign in to comment.