-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2744173
commit 30b6525
Showing
7 changed files
with
374 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
cmake_minimum_required(VERSION 3.7.0) | ||
|
||
project(dcos-mesos-modules) | ||
|
||
set(MESOS_ROOT "../mesos" CACHE PATH "Mesos root directory.") | ||
get_filename_component(MESOS_ROOT ${MESOS_ROOT} ABSOLUTE) | ||
set(BOOST_ROOT_DIR "" CACHE PATH "Boost libs root directory.") | ||
|
||
message("MESOS_ROOT is ${MESOS_ROOT}") | ||
|
||
# CMAKE MODULE SETUP. | ||
##################### | ||
# Paths that are searched when `include(...)` is called. | ||
list(APPEND CMAKE_MODULE_PATH ${MESOS_ROOT}/cmake) | ||
list(APPEND CMAKE_MODULE_PATH ${MESOS_ROOT}/3rdparty/cmake) | ||
list(APPEND CMAKE_MODULE_PATH ${MESOS_ROOT}/src/cmake) | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | ||
|
||
# Macros. | ||
include(CTest) | ||
include(Dependencies) | ||
|
||
# Set the default standard to C++11 for all targets. | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
# Do not use, for example, `-std=gnu++11`. | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
list(APPEND DEPENDENCIES_INC | ||
"${BOOST_INCL}" | ||
"${CURL_INCL}" | ||
"${GLOG_INCL}" | ||
"${MESOS_ROOT}/build/include" | ||
"${MESOS_ROOT}/include" | ||
"${PICOJSON_INCL}" | ||
"${PROCESS_INCL}" | ||
"${PROTOBUF_INCL}" | ||
"${RAPIDJSON_INCL}" | ||
"${STOUT_INCL}" | ||
"${ZOOKEEPER_INCL}" | ||
) | ||
|
||
list(APPEND DEPENDENCIES_LIB | ||
glog | ||
mesos | ||
mesos_protobufs | ||
process | ||
protobuf | ||
|
||
$<$<PLATFORM_ID:Linux>:pthread> | ||
) | ||
|
||
# TODO(akornatskyy): Agreed to have CMakeLists.txt in each directory (per | ||
# module), however, right now that is not possible because corresponding | ||
# changes require some changes to source code (that would break | ||
# autotools build). | ||
add_subdirectory(dockercfg) | ||
add_subdirectory(logsink) | ||
add_subdirectory(journald) | ||
|
||
# overlay | ||
add_library(overlay SHARED | ||
overlay/messages.pb.cc | ||
overlay/overlay.pb.cc | ||
overlay/agent_metrics.cpp | ||
overlay/agent.cpp | ||
overlay/supervisor_metrics.cpp | ||
overlay/master_metrics.cpp | ||
overlay/master.cpp | ||
) | ||
install(TARGETS overlay LIBRARY DESTINATION lib/mesos) | ||
add_custom_command( | ||
OUTPUT overlay/messages.pb.cc overlay/overlay.pb.cc | ||
COMMAND protoc | ||
-I${CMAKE_CURRENT_SOURCE_DIR} | ||
--cpp_out=${CMAKE_CURRENT_BINARY_DIR} | ||
overlay/messages.proto overlay/overlay.proto | ||
DEPENDS overlay/messages.proto overlay/overlay.proto | ||
) | ||
target_include_directories(overlay PRIVATE | ||
"${CMAKE_CURRENT_SOURCE_DIR}" | ||
"${CMAKE_CURRENT_BINARY_DIR}" | ||
${DEPENDENCIES_INC} | ||
) | ||
|
||
# metrics | ||
add_library(metrics SHARED | ||
metrics/messages.pb.cc | ||
metrics/isolator.cpp | ||
) | ||
install(TARGETS metrics | ||
ARCHIVE DESTINATION lib/mesos | ||
LIBRARY DESTINATION lib/mesos | ||
) | ||
add_custom_command( | ||
OUTPUT metrics/messages.pb.cc | ||
COMMAND protoc | ||
-I${CMAKE_CURRENT_SOURCE_DIR} | ||
--cpp_out=${CMAKE_CURRENT_BINARY_DIR} | ||
metrics/messages.proto | ||
DEPENDS metrics/messages.proto | ||
) | ||
target_include_directories(metrics PRIVATE | ||
"${CMAKE_CURRENT_SOURCE_DIR}" | ||
"${CMAKE_CURRENT_BINARY_DIR}" | ||
${DEPENDENCIES_INC} | ||
) | ||
|
||
if (BUILD_TESTING) | ||
list(APPEND TEST_DEPENDENCIES_INC | ||
${DEPENDENCIES_INC} | ||
"${GMOCK_INCL}" | ||
"${GTEST_INCL}" | ||
"${MESOS_ROOT}/build/src" | ||
"${MESOS_ROOT}/src" | ||
"${NVML_INCL}" | ||
) | ||
|
||
list(APPEND TEST_DEPENDENCIES_LIB | ||
${DEPENDENCIES_LIB} | ||
gmock | ||
) | ||
|
||
add_subdirectory(tests) | ||
|
||
# Test binary for metrics | ||
add_executable(test-metrics | ||
metrics/messages.pb.cc | ||
tests/metrics_tests.cpp | ||
) | ||
# TODO(akornatskyy): Paths defined as "nowhere" are needed to build Mesos | ||
# test utils (https://github.com/apache/mesos/blob/master/src/tests/utils.cpp). | ||
# These definitions can be dropped if the test utilities we need here are | ||
# split from the path-dependent utilities into a separate file. | ||
add_definitions( | ||
-DMODULES_BUILD_DIR="${PROJECT_BINARY_DIR}" | ||
-DSOURCE_DIR="${MESOS_ROOT}" | ||
-DBUILD_DIR="${MESOS_ROOT}/build" | ||
-DPKGMODULEDIR="nowhere" | ||
-DLIBDIR="nowhere" | ||
-DPKGLIBEXECDIR="nowhere" | ||
-DTESTLIBEXECDIR="nowhere" | ||
-DSBINDIR="nowhere" | ||
-DPKGDATADIR="nowhere" | ||
-DVERSION="1.10.0" | ||
) | ||
target_include_directories(test-metrics PRIVATE | ||
"${CMAKE_CURRENT_SOURCE_DIR}" | ||
"${CMAKE_CURRENT_BINARY_DIR}" | ||
${TEST_DEPENDENCIES_INC} | ||
) | ||
target_link_libraries(test-metrics PRIVATE | ||
metrics | ||
mesos-tests | ||
${TEST_DEPENDENCIES_LIB} | ||
) | ||
add_test(NAME Metrics_Tests COMMAND test-metrics) | ||
|
||
# Test binary for overlay | ||
add_executable(test-overlay tests/overlay_tests.cpp) | ||
target_include_directories(test-overlay PRIVATE | ||
"${CMAKE_CURRENT_SOURCE_DIR}" | ||
"${CMAKE_CURRENT_BINARY_DIR}" | ||
${TEST_DEPENDENCIES_INC} | ||
) | ||
target_link_libraries(test-overlay PRIVATE | ||
overlay | ||
mesos-tests | ||
${TEST_DEPENDENCIES_LIB} | ||
) | ||
add_test(NAME Overlay_Tests COMMAND test-overlay) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
set(LIBRARY_LINKAGE SHARED) | ||
|
||
set (BOOST_INCL ${BOOST_ROOT_DIR}/include) | ||
|
||
set (PICOJSON_INCL ${MESOS_ROOT}/include) | ||
set (RAPIDJSON_INCL ${MESOS_ROOT}/include) | ||
set (STOUT_INCL ${MESOS_ROOT}/include) | ||
set (ZOOKEEPER_INCL ${MESOS_ROOT}/include/zookeeper) | ||
|
||
set (GLOG_INCL ${MESOS_ROOT}/include) | ||
find_library( | ||
GLOG_LIB | ||
NAMES glog | ||
PATHS ${MESOS_ROOT}/lib | ||
NO_DEFAULT_PATH) | ||
add_library(glog ${LIBRARY_LINKAGE} IMPORTED) | ||
set_target_properties(glog PROPERTIES IMPORTED_LOCATION ${GLOG_LIB}) | ||
|
||
set (PROCESS_INCL ${MESOS_ROOT}/include) | ||
find_library( | ||
PROCESS_LIB | ||
NAMES process | ||
PATHS ${MESOS_ROOT}/lib | ||
NO_DEFAULT_PATH) | ||
add_library(process ${LIBRARY_LINKAGE} IMPORTED) | ||
set_target_properties(process PROPERTIES IMPORTED_LOCATION ${PROCESS_LIB}) | ||
|
||
set (PROTOBUF_INCL ${MESOS_ROOT}/include) | ||
find_library( | ||
PROTOBUF_LIB | ||
NAMES protobuf | ||
PATHS ${MESOS_ROOT}/lib | ||
NO_DEFAULT_PATH) | ||
add_library(protobuf ${LIBRARY_LINKAGE} IMPORTED) | ||
set_target_properties(protobuf PROPERTIES IMPORTED_LOCATION ${PROTOBUF_LIB}) | ||
|
||
find_library( | ||
MESOS_PROTOBUFS_LIB | ||
NAMES mesos-protobufs | ||
PATHS ${MESOS_ROOT}/lib | ||
NO_DEFAULT_PATH) | ||
add_library(mesos_protobufs ${LIBRARY_LINKAGE} IMPORTED) | ||
set_target_properties(mesos_protobufs PROPERTIES IMPORTED_LOCATION ${MESOS_PROTOBUFS_LIB}) | ||
|
||
find_library( | ||
MESOS_LIB | ||
NAMES mesos | ||
PATHS ${MESOS_ROOT}/lib | ||
NO_DEFAULT_PATH) | ||
add_library(mesos ${LIBRARY_LINKAGE} IMPORTED) | ||
set_target_properties(mesos PROPERTIES IMPORTED_LOCATION ${MESOS_LIB}) | ||
|
||
find_program( | ||
PROTOC | ||
name protoc | ||
PATHS ${MESOS_ROOT}/bin | ||
NO_DEFAULT_PATH) | ||
add_executable(protoc IMPORTED GLOBAL) | ||
set_target_properties(protoc PROPERTIES IMPORTED_LOCATION ${PROTOC}) | ||
|
||
if (BUILD_TESTING) | ||
# TODO(akornatskyy): rewrite to use one from mesos install | ||
set (GMOCK_INCL "${MESOS_ROOT}/build/3rdparty/googletest-${GOOGLETEST_VERSION}/src/googletest-${GOOGLETEST_VERSION}/googlemock/include") | ||
set (GTEST_INCL "${MESOS_ROOT}/build/3rdparty/googletest-${GOOGLETEST_VERSION}/src/googletest-${GOOGLETEST_VERSION}/googletest/include") | ||
find_library( | ||
GMOCK_LIB | ||
NAMES gmock | ||
PATHS ${MESOS_ROOT}/build/3rdparty/googletest-${GOOGLETEST_VERSION}/src/googletest-${GOOGLETEST_VERSION}-build/googlemock) | ||
add_library(gmock ${LIBRARY_LINKAGE} IMPORTED) | ||
set_target_properties(gmock PROPERTIES IMPORTED_LOCATION "${GMOCK_LIB}") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
add_library(removedockercfg SHARED remover.cpp) | ||
install(TARGETS removedockercfg LIBRARY DESTINATION "lib/mesos") | ||
|
||
target_include_directories(removedockercfg PRIVATE | ||
${DEPENDENCIES_INC} | ||
) | ||
|
||
target_link_libraries(removedockercfg PUBLIC | ||
${DEPENDENCIES_LIB} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
add_library(journaldlogger SHARED lib_journald.cpp) | ||
install(TARGETS journaldlogger | ||
ARCHIVE DESTINATION lib/mesos | ||
LIBRARY DESTINATION lib/mesos | ||
) | ||
|
||
target_include_directories(journaldlogger PUBLIC | ||
${DEPENDENCIES_INC} | ||
) | ||
|
||
target_link_libraries(journaldlogger PUBLIC | ||
${DEPENDENCIES_LIB} | ||
|
||
$<$<PLATFORM_ID:Linux>:systemd> | ||
) | ||
|
||
add_executable(mesos-journald-logger journald.cpp) | ||
install(TARGETS mesos-journald-logger RUNTIME DESTINATION bin) | ||
|
||
target_link_libraries(mesos-journald-logger PRIVATE | ||
journaldlogger | ||
) | ||
|
||
configure_file(modules.json.cmake-in modules.json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
add_library(logsink SHARED logsink.cpp) | ||
install(TARGETS logsink LIBRARY DESTINATION lib/mesos) | ||
|
||
target_include_directories(logsink PRIVATE | ||
${DEPENDENCIES_INC} | ||
) | ||
|
||
target_link_libraries(logsink PUBLIC | ||
${DEPENDENCIES_LIB} | ||
) |
Oops, something went wrong.