forked from osmhpi/pinpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
76 lines (58 loc) · 1.72 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
cmake_minimum_required(VERSION 3.5)
project(pinpoint LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
option(ENABLE_NVML "Build with NVML support (if available)" ON)
option(ENABLE_APPLE_SILICON_MODEL "If building on Apple Silicon, always use 'Energy Model' channel" OFF)
include_directories(.)
include_directories(src)
find_package(Threads)
if(APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
set(APPLE_SILICON TRUE)
else()
set(APPLE_SILICON FALSE)
endif()
set(APPLE_IOREPORT_LIBRARIES "-lIOReport -framework CoreFoundation")
if(ENABLE_NVML)
find_package(NVML)
endif(ENABLE_NVML)
if(ENABLE_APPLE_SILICON_MODEL)
add_definitions(-DENABLE_APPLE_SILICON_MODEL=1)
endif(ENABLE_APPLE_SILICON_MODEL)
if(NVML_FOUND)
include_directories(${NVML_INCLUDE_DIRS})
add_definitions(-DUSE_NVML=1)
endif(NVML_FOUND)
#####
set(SOURCE_FILES
src/EnergyDataSource.cpp
src/Experiment.cpp
src/PowerDataSource.cpp
src/Registry.cpp
src/Sampler.cpp
src/Settings.cpp
src/data_sources/A64FX.cpp
src/data_sources/INA226.cpp
src/data_sources/JetsonCounter.cpp
src/data_sources/MCP_EasyPower.cpp
src/data_sources/NVML.cpp
src/data_sources/RAPL.cpp
src/data_sources/mcp_com.c
src/main.cpp
)
if(APPLE_SILICON)
list(APPEND SOURCE_FILES
src/data_sources/AppleM.cpp
)
endif(APPLE_SILICON)
add_executable(pinpoint ${SOURCE_FILES})
#####
target_link_libraries(pinpoint ${CMAKE_THREAD_LIBS_INIT})
if(NVML_FOUND)
target_link_libraries(pinpoint ${NVML_LIBRARIES})
endif(NVML_FOUND)
if(APPLE_SILICON)
message(STATUS "Detected Apple Silicon. Link IOReport")
target_link_libraries(pinpoint ${APPLE_IOREPORT_LIBRARIES})
endif(APPLE_SILICON)