forked from stepanvanecek/sys-sage
-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
85 lines (70 loc) · 3.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
cmake_policy(SET CMP0048 NEW)
cmake_minimum_required(VERSION 3.22)
set (CMAKE_CXX_STANDARD 20)
set (CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_FLAGS " -Wall")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0")
message(FATAL_ERROR "Insufficient gcc version (at least 8.0.0) set for example with CXX=/path/to/compiler cmake ....")
endif()
endif()
project(sys-sage VERSION 0.4.3 LANGUAGES C CXX )
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
#### dependencies
find_package(LibXml2 REQUIRED) # Use pkg-config via the LibXml2 find-module
execute_process(COMMAND xml2-config --cflags OUTPUT_VARIABLE LIBXML_F OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND xml2-config --libs OUTPUT_VARIABLE LIBXML_L OUTPUT_STRIP_TRAILING_WHITESPACE)
include_directories(${LIBXML_F})
link_libraries(${LIBXML_L})
include_directories(${LIBXML2_INCLUDE_DIR})
include_directories(${LIBXML2_INCLUDE_DIRS})
link_libraries(${LIBXML2_LIBRARY})
link_libraries(${LIBXML2_LIBRARIES})
if(NVIDIA_MIG)
find_package(CUDAToolkit 10.0 REQUIRED)
include_directories(CUDA::nvml)
link_libraries(CUDA::nvml)
endif()
if(DATA_SOURCES OR DS_HWLOC)
find_package(HWLOC REQUIRED)
endif()
# Create and install package configuration and version files.
include(CMakePackageConfigHelpers)
configure_package_config_file(${sys-sage_SOURCE_DIR}/pkg/sys-sage-config.cmake.in
${sys-sage_BINARY_DIR}/pkg/sys-sage-config.cmake
INSTALL_DESTINATION lib/cmake/sys-sage)
#configure_package_config_file(${sys-sage_SOURCE_DIR}/pkg/sys-sage-config-version.cmake.in
# ${sys-sage_BINARY_DIR}/pkg/sys-sage-config-version.cmake
# INSTALL_DESTINATION lib/cmake/sys-sage)
install(FILES ${sys-sage_BINARY_DIR}/pkg/sys-sage-config.cmake
#${sys-sage_BINARY_DIR}/pkg/sys-sage-config-version.cmake
DESTINATION lib/cmake/sys-sage)
configure_file(${sys-sage_SOURCE_DIR}/pkg/sys-sage.pc.in
${sys-sage_BINARY_DIR}/pkg/sys-sage.pc @ONLY)
install(FILES ${sys-sage_BINARY_DIR}/pkg/sys-sage.pc
DESTINATION lib)
###Options:
option(INTEL_PQOS "Build and install functionality regarding Intel L3 CAT" OFF)
option(NVIDIA_MIG "Build and install functionality regarding NVidia MIG(multi-instance GPU, ampere or newer)" OFF)
option(PROC_CPUINFO "Build and install functionality regarding Linux cpuinfo" OFF)
option(DATA_SOURCES "Build and install all data sources" OFF)
option(DS_HWLOC "Build and install data source hwloc (Retrieves hwloc topology information)" OFF)
option(DS_MT4G "Build and install data source mt4g (Compute and memory topology of NVidia GPUs)" OFF)
option(DS_NUMA "Build and install data source caps-numa-benchmark" OFF)
option(TEST "Build tests" OFF)
option(TEST_ASAN "Build tests with enabled address sanitizers" OFF)
option(TEST_TSAN "Build tests with enabled thread sanitizers" OFF)
option(TEST_UBSAN "Build tests with enabled undefined behaviour sanitizers" OFF)
option(TEST_COVERAGE "Build tests with enabled coverage" OFF)
if(DATA_SOURCES)
set(DS_HWLOC ON)
set(DS_MT4G ON)
set(DS_NUMA ON)
endif()
# Top-level build just includes subdirectories.
add_subdirectory(src)
add_subdirectory(examples)
add_subdirectory(data-sources)
if(${TEST})
add_subdirectory(test)
endif()