-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
106 lines (80 loc) · 3.13 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
cmake_minimum_required(VERSION 3.11)
project(roco2)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
# Set a default build type if none was specified
include(cmake/DefaultBuildType.cmake)
# Try to guess which modules should be dis/enabled based on CPU arch
include(cmake/GuessArchitectureCompatability.cmake)
include(CTest)
# Intialize git submodules if not done already
include(cmake/GitSubmoduleUpdate.cmake)
git_submodule_update()
add_library(roco2 INTERFACE)
target_compile_features(roco2 INTERFACE cxx_std_14)
target_compile_options(roco2 INTERFACE $<$<CONFIG:Debug>:-O0> -Wall -Wextra)
#enable C99
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
# einfach den code mit magic macros vollscheissen, bis es geht :o)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_POSIX_C_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE")
# use null sink otherwise
option(ENABLE_LOGGING "whether logging should be enabled" ON)
if (ENABLE_LOGGING)
target_compile_definitions(roco2 INTERFACE ENABLE_LOGGING)
else()
message(STATUS "silencing all logging")
endif()
find_package(OpenMP REQUIRED)
target_link_libraries(roco2 INTERFACE OpenMP::OpenMP_CXX)
# this should also find MKL
find_package(BLAS REQUIRED)
target_link_libraries(roco2 INTERFACE ${BLAS_LIBRARIES})
option(USE_SCOREP "Enable built-in Score-P user instrumentation during build." OFF)
if (USE_SCOREP)
message(STATUS "Building WITH Score-P user instrumentation. Make sure you have set up the Score-P compiler wrapper as Compiler!")
find_package(Scorep REQUIRED)
target_link_libraries(roco2 INTERFACE Scorep::Plugin)
target_compile_definitions(roco2 INTERFACE HAS_SCOREP)
else()
message(STATUS "Building WITHOUT Score-P user instrumentation.")
endif()
find_package(NUMA REQUIRED)
target_link_libraries(roco2 INTERFACE NUMA::NUMA)
find_package(CpuFreq)
if (CpuFreq_FOUND)
target_link_libraries(roco2 INTERFACE Cpufreq::Cpufreq)
target_compile_definitions(roco2 INTERFACE "HAS_CPUFREQ")
else()
message(STATUS "CpuFreq wasn't found")
endif()
find_package(X86Adapt)
if (X86Adapt_FOUND)
target_compile_definitions(roco2 INTERFACE HAS_X86ADAPT)
target_link_libraries(roco2 INTERFACE X86Adapt::X86Adapt)
else()
message(STATUS "X86Adapt wasn't found, DDCM not available.")
endif()
if (USE_FIRESTARTER)
include(cmake/BuildFirestarter.cmake)
message(STATUS "Building WITH firestarter.")
else()
message(STATUS "Building WITHOUT firestarter.")
endif()
target_include_directories(roco2 INTERFACE include)
option(ROCO2_ASSERTIONS "enable additional checks with runtime overhead." OFF)
if(ROCO2_ASSERTIONS)
message(STATUS "Additional runtime checks enabled. This may influence the measurement")
target_compile_definitions(roco2 INTERFACE ROCO2_ASSERTIONS)
endif()
target_compile_definitions(roco2 INTERFACE REGONLY)
add_subdirectory(lib/nitro)
target_link_libraries(roco2 INTERFACE Nitro::log)
macro(Roco2Configuration CONF )
add_executable(roco2_${CONF} experiment.cpp)
target_link_libraries(
roco2_${CONF}
roco2_main
roco2_core
)
install(TARGETS roco2_${CONF} RUNTIME DESTINATION bin)
endmacro()
add_subdirectory(src)