-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
139 lines (117 loc) · 4.5 KB
/
CMakeLists.txt
File metadata and controls
139 lines (117 loc) · 4.5 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# ======================================================================
# artdaq main build file
#
# cd .../path/to/build/directory
# source .../path/to/artdaq/ups/setup_for_development
# cmake [-DCMAKE_INSTALL_PREFIX=/install/path]
# -Dqualifier:STRING=$CETPKG_QUAL
# -DCMAKE_BUILD_TYPE=$CETPKG_TYPE
# $CETPKG_SOURCE
# make
# make test
# make install
# make package
# ======================================================================
# use cmake 3.17 or later
cmake_minimum_required (VERSION 3.19 FATAL_ERROR)
find_package(cetmodules 3.16.00 REQUIRED)
project(artdaq VERSION 4.06.00)
include(CetCMakeEnv)
include(SetCompilerFlags)
include(InstallHeaders)
include(InstallSource)
include(InstallFhicl)
cet_cmake_env()
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Find our own CMake modules, and tell everyone else where to find them.
cet_cmake_module_directories(Modules BINARY)
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0.0)
# Clang 14 has a bug in which it complains about destructors of template classes
# e.g. ArtdaqInput<T>::~ArtdaqInput(), when it is expecting the destructor name to
# match what is on the left-hand side of the ::. This is a violation, however, of
# the C++20 standard. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1787r6.html
set(DT_FLAG -Wno-dtor-name)
else()
set(DT_FLAG)
endif()
cet_set_compiler_flags(DIAGS VIGILANT
WERROR
NO_UNDEFINED
EXTRA_FLAGS -pedantic -DRTI_UNIX -DRTI_LINUX -DRTI_64BIT -m64 ${DT_FLAG}
)
string(TOUPPER ${CMAKE_BUILD_TYPE} BTYPE_UC)
if(BTYPE_UC STREQUAL DEBUG)
add_definitions(-DDEBUGME)
if(DEFINED ENV{USE_ASAN})
if($ENV{USE_ASAN} GREATER 0)
message("!!! Address Sanitizer Activated!!!")
message("!!! Note: To run, add 'export ASAN_OPTIONS=verify_asan_link_order=0' to setup !!!")
add_compile_options(-fsanitize=address -Wno-unused-command-line-argument)
add_link_options(-lasan)
endif()
endif()
if(DEFINED ENV{USE_TSAN})
if($ENV{USE_TSAN} GREATER 0)
message("!!! Thread Sanitizer Activated!!!")
add_compile_options(-fsanitize=thread -Wno-unused-command-line-argument -Wno-tsan)
add_link_options(-ltsan)
endif()
endif()
if(DEFINED ENV{USE_UBSAN})
if($ENV{USE_UBSAN} GREATER 0)
message("!!! \"Undefined Behavior\" Sanitizer Activated!!!")
add_compile_options(-fsanitize=undefined -Wno-unused-command-line-argument)
add_link_options(-lubsan)
endif()
endif()
if(DEFINED ENV{USE_GCOV})
add_compile_options(-fprofile-arcs -ftest-coverage --coverage)
add_link_options(--coverage)
endif()
endif()
#exeption stack trace
if(DEFINED ENV{USE_EXCEPTIONSTACKTRACE})
if($ENV{USE_EXCEPTIONSTACKTRACE} GREATER 0)
message("!!! Exception StackTrace Activated!!!")
add_definitions(-D EXCEPTIONSTACKTRACE)
set( EXCEPTIONSTACKTRACE_LIB artdaq-core_Utilities_ExceptionStackTrace )
add_compile_options( -rdynamic -Wno-unused-command-line-argument )
add_link_options( -rdynamic )
endif()
endif()
#cet_report_compiler_flags()
find_package(TRACE 3.17.04 REQUIRED EXPORT)
find_package(artdaq-core 3.08.04 REQUIRED EXPORT)
find_package(artdaq-utilities 1.07.02 REQUIRED EXPORT)
find_package(art_root_io 1.08.03 REQUIRED EXPORT QUIET)
find_package(art 3.09.03 REQUIRED EXPORT QUIET)
find_package(canvas_root_io REQUIRED EXPORT QUIET)
find_package(canvas REQUIRED EXPORT QUIET)
find_package(messagefacility REQUIRED EXPORT QUIET)
find_package(fhiclcpp REQUIRED EXPORT QUIET)
find_package(cetlib REQUIRED EXPORT QUIET)
find_package(cetlib_except REQUIRED EXPORT QUIET)
find_package(Boost QUIET COMPONENTS date_time program_options thread REQUIRED EXPORT)
find_package(XMLRPC COMPONENTS c++2 client abyss-server REQUIRED EXPORT)
include(BuildPlugins)
string(REGEX MATCHALL "[0-9][0-9]?[0-9]?" ART_VERSION_LIST "${art_VERSION}")
list(GET ART_VERSION_LIST 0 ART_MAJOR_VERSION)
list(GET ART_VERSION_LIST 1 ART_MINOR_VERSION)
list(GET ART_VERSION_LIST 2 ART_PATCH_VERSION)
message("-DART_HEX_VERSION=0x${ART_MAJOR_VERSION}${ART_MINOR_VERSION}${ART_PATCH_VERSION}")
set(ART_HEX_VERSION 0x${ART_MAJOR_VERSION}${ART_MINOR_VERSION}${ART_PATCH_VERSION})
add_definitions(-DART_HEX_VERSION=0x${ART_MAJOR_VERSION}${ART_MINOR_VERSION}${ART_PATCH_VERSION})
# source
add_subdirectory(artdaq)
cet_register_export_set(SET_NAME artdaqUsers SET_DEFAULT)
# testing
add_subdirectory(test)
# Prototype stuff (kept around for tests)
add_subdirectory(proto)
# Useful tools and scripts.
add_subdirectory(tools)
if (NOT DEFINED ENV{DISABLE_DOXYGEN})
add_subdirectory(doc)
endif()
cet_cmake_config()