-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
90 lines (66 loc) · 2.8 KB
/
CMakeLists.txt
File metadata and controls
90 lines (66 loc) · 2.8 KB
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
cmake_minimum_required(VERSION 3.10)
project(detector-network-processor LANGUAGES CXX C)
string(TIMESTAMP PROJECT_DATE_STRING "%b %d, %Y")
execute_process(COMMAND bash "-c" "git rev-parse --short HEAD | tr -d '\n'"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE PROJECT_VERSION_HASH)
option(PROCESSOR_BUILD_SANITIZERS "build the code with sanitizers"
OFF)
option(PROCESSOR_DISABLE_SSL "build the code so the rest service doesn't use SSL"
OFF)
option(PROCESSOR_BUILD_AGGREGATION "along with the default application, also build the aggregation executable."
OFF)
set(PROJECT_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(PROJECT_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(PROJECT_CONFIG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/config")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/bin")
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/files.cmake")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-Wall -Wextra -Wshadow -Wpedantic -Werror -O3)
if(PROCESSOR_BUILD_SANITIZERS)
add_compile_options(-fsanitize=address,undefined)
add_link_options(-fsanitize=address,undefined)
endif()
find_library(MOSQUITTO mosquitto REQUIRED)
find_library(DL dl REQUIRED)
find_library(MUONPICORE muonpi-core REQUIRED)
find_library(MUONPIMQTT muonpi-http REQUIRED)
find_library(MUONPIMQTT muonpi-link REQUIRED)
find_package(
Boost 1.71
COMPONENTS system program_options
REQUIRED)
set(PROJECT_INCLUDE_LIBS
mosquitto
pthread
${Boost_LIBRARIES}
ssl
crypto
dl
muonpi-core
muonpi-http
muonpi-link
)
# +++ necessary for compatability with older compilers
find_library(STD_CPP_FS stdc++fs /usr/lib/gcc/x86_64-linux-gnu/8/)
if(STD_CPP_FS)
set(PROJECT_INCLUDE_LIBS ${PROJECT_INCLUDE_LIBS} stdc++fs)
endif()
# --- necessary for compatability with older compilers
configure_file("${PROJECT_CONFIG_DIR}/detector-network-processor.1"
"${CMAKE_CURRENT_BINARY_DIR}/detector-network-processor.1")
configure_file("${PROJECT_CONFIG_DIR}/config.h"
"${CMAKE_CURRENT_BINARY_DIR}/defaults.h")
if (PROCESSOR_BUILD_AGGREGATION)
add_executable(aggregation "${PROJECT_SRC_DIR}/aggregation.cpp")
target_link_libraries(aggregation ${Boost_LIBRARIES})
endif()
add_executable(
detector-network-processor ${PROJECT_SOURCE_FILES} ${PROJECT_HEADER_FILES})
target_include_directories(
detector-network-processor PUBLIC ${PROJECT_HEADER_DIR} ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(detector-network-processor ${PROJECT_INCLUDE_LIBS})
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/packaging.cmake")
add_custom_target(clangformat COMMAND clang-format -style=WebKit -i ${PROJECT_SOURCE_FILES} ${PROJECT_HEADER_FILES} "${PROJECT_SRC_DIR}/aggregation.cpp")