-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
100 lines (80 loc) · 2.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cmake_minimum_required(VERSION 3.17)
project(
feminos-daq
LANGUAGES CXX
VERSION 2.0.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# We converted C files into C++ files with minimal changes. We need to suppress
# some warnings. TODO: fix them
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
find_package(Threads REQUIRED)
find_package(ROOT REQUIRED COMPONENTS RIO Tree)
include(FetchContent)
option(ENABLE_TESTING "Enable testing of the Prometheus library" OFF)
FetchContent_Declare(
Prometheus
GIT_REPOSITORY https://github.com/jupp0r/prometheus-cpp.git
GIT_TAG v1.2.4)
FetchContent_MakeAvailable(Prometheus)
FetchContent_Declare(
CLI11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v2.4.2)
FetchContent_MakeAvailable(CLI11)
add_executable(${PROJECT_NAME} src/main.cpp)
target_compile_definitions(
${PROJECT_NAME}
PRIVATE FEMINOS_DAQ_VERSION_MAJOR=${feminos-daq_VERSION_MAJOR}
FEMINOS_DAQ_VERSION_MINOR=${feminos-daq_VERSION_MINOR}
FEMINOS_DAQ_VERSION_PATCH=${feminos-daq_VERSION_PATCH}
LINUX
JUMBO_POOL)
target_compile_definitions(${PROJECT_NAME}
PRIVATE FEMINOS_DAQ_VERSION="${feminos-daq_VERSION}")
target_include_directories(
${PROJECT_NAME}
PRIVATE ${ROOT_INCLUDE_DIRS}
src/bufmgr
src/feminos
src/mclient
src/platforms
src/platforms/linux
src/util
src/util/linux
src/prometheus
src/root)
file(
GLOB_RECURSE
SOURCE_FILES
src/mclient/femproxy.cpp
src/mclient/evbuilder.cpp
src/mclient/femarray.cpp
src/mclient/cmdfetcher.cpp
src/bufmgr/bufpool.cpp
src/feminos/frame.cpp
src/platforms/linux/os_al.cpp
src/prometheus/prometheus.cpp
src/root/storage.cpp)
target_link_libraries(
${PROJECT_NAME}
PRIVATE CLI11::CLI11 prometheus-cpp::core prometheus-cpp::pull
prometheus-cpp::push ${ROOT_LIBRARIES})
target_sources(${PROJECT_NAME} PRIVATE ${SOURCE_FILES})
# Install the binary and the viewer script
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
install(
FILES viewer/feminos-viewer.py
DESTINATION bin
RENAME feminos-viewer)
# make sure it has execute permissions (installing with sudo may remove them)
install(
CODE "execute_process(COMMAND chmod +x ${CMAKE_INSTALL_PREFIX}/bin/feminos-viewer)"
)
install(FILES scripts/feminos-daq-sync.sh DESTINATION bin)
install(
CODE "execute_process(COMMAND chmod +x ${CMAKE_INSTALL_PREFIX}/bin/feminos-daq-sync.sh)"
)
# Uninstall
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P
${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake)