-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
64 lines (47 loc) · 2.32 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
cmake_minimum_required(VERSION 3.8)
project(examon_plugin)
option(ENABLE_MPI "Build with MPI support." OFF)
execute_process(
COMMAND
"git" "submodule" "update" "--init" "--recursive"
WORKING_DIRECTORY
"${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE result
ERROR_VARIABLE error
)
add_subdirectory(extern/scorep_plugin_cxx_wrapper)
add_subdirectory(extern/mosquitto-1.5)
include(common/FindScorep.cmake)
if(SCOREP_FOUND)
include_directories(${SCOREP_INCLUDE_DIRS})
link_directories(${SCOREP_LIBRARY_DIRS})
SET(CMAKE_INSTALL_PREFIX ${SCOREP_ROOT_PATH} CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
else()
message(SEND_ERROR "Scorep was not found but is required")
endif()
if (MPI_FOUND AND ENABLE_MPI)
add_definitions(-DHAVE_MPI)
message(STATUS "Build with MPI support")
target_compile_definitions(x86_energy_sync_plugin PRIVATE MPI_VERSION)
target_link_libraries(x86_energy_sync_plugin PRIVATE MPI::MPI_C)
target_link_libraries(x86_energy_sync_plugin PRIVATE MPI::MPI_CXX)
elseif (ENABLE_MPI)
message(FATAL_ERROR "Can't find MPI. Please provide MPI or unset \"ENABLE_MPI\"")
endif()
# library stuff
add_library(examon_sync_plugin SHARED examon_sync_plugin.cpp examon_metric.cpp examon_mqtt_path.cpp)
# taken from the corresponding wiki
target_link_libraries(examon_sync_plugin PRIVATE Scorep::scorep-plugin-cxx libmosquitto mosquittopp)
target_include_directories(examon_sync_plugin PUBLIC extern/mosquitto-1.5/lib extern/mosquitto-1.5/lib/cpp extern/mosquitto-1.5/client)
add_library(examon_async_plugin SHARED examon_async_plugin.cpp examon_metric.cpp examon_mqtt_path.cpp)
target_link_libraries(examon_async_plugin PRIVATE Scorep::scorep-plugin-cxx libmosquitto mosquittopp)
target_include_directories(examon_async_plugin PUBLIC extern/mosquitto-1.5/lib extern/mosquitto-1.5/lib/cpp extern/mosquitto-1.5/client)
#target_include_directories(examon_async_plugin PUBLIC extern/scorep_plugin_cxx_wrapper/include)
# would only be required if using c-style malloc without casting
#SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive" )
#target_include_directories(examon_sync_plugin PUBLIC include)
#set(CMAKE_CXX_COMPILER /usr/bin/gcc -std=c++14)
install(TARGETS examon_sync_plugin
LIBRARY DESTINATION lib)
install(TARGETS examon_async_plugin
LIBRARY DESTINATION lib)