-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
56 lines (39 loc) · 1.65 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
cmake_minimum_required(VERSION 3.8)
project(x86_energy_plugin)
option(ENABLE_MPI "Build with MPI support." ON)
add_subdirectory(extern)
set(CMAKE_CXX_EXTENSIONS OFF)
set(THREADS_PREFER_PTHREAD_FLAG true)
find_package(Threads REQUIRED)
# x86_energy_sync_plugin
set(X86_ENERGY_PLUGIN_SYNC_SRC
src/x86_energy_sync_plugin.cpp
)
add_library(x86_energy_sync_plugin SHARED ${X86_ENERGY_PLUGIN_SYNC_SRC})
target_compile_features(x86_energy_sync_plugin PUBLIC cxx_std_14)
target_link_libraries(x86_energy_sync_plugin PUBLIC scorep-plugin-cxx x86_energy::x86_energy_cxx)
target_include_directories(x86_energy_sync_plugin PUBLIC include)
# x86_energy_plugin
set(X86_ENERGY_PLUGIN_SRC
src/x86_energy_measurement_thread.cpp
src/x86_energy_plugin.cpp
)
add_library(x86_energy_plugin SHARED ${X86_ENERGY_PLUGIN_SRC})
target_compile_features(x86_energy_plugin PUBLIC cxx_std_14)
target_link_libraries(x86_energy_plugin PUBLIC scorep-plugin-cxx x86_energy::x86_energy_cxx Threads::Threads)
target_include_directories(x86_energy_plugin PUBLIC include)
find_package(MPI)
include_directories(include)
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()
install(TARGETS x86_energy_sync_plugin
LIBRARY DESTINATION lib)
install(TARGETS x86_energy_plugin
LIBRARY DESTINATION lib)