-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
123 lines (101 loc) · 4.15 KB
/
CMakeLists.txt
File metadata and controls
123 lines (101 loc) · 4.15 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
cmake_minimum_required(VERSION 3.12)
# make sure the source and binary directories are different
# this is here to prevent so-called "in-source" builds where the root directory of the source
# is also the root directory of the build
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
if ("${srcdir}" STREQUAL "${bindir}")
message(FATAL_ERROR "ldmx-sw does not support in-source builds.
Call 'denv cmake ..' from within a 'build/' subdirectory or
Tell cmake to use a different build directory with 'denv cmake -B build -S .'
'just configure' and 'just build' will do the necessary directory movement for you as well.")
endif()
# Set the project name and version
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/VERSION LDMXSW_VERSION)
string(STRIP "${LDMXSW_VERSION}" LDMXSW_VERSION)
string(REGEX REPLACE "^v" "" LDMXSW_VERSION_NUM "${LDMXSW_VERSION}")
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/COMMIT_SHA COMMIT_SHA)
string(STRIP "${COMMIT_SHA}" COMMIT_SHA)
project(LDMX_SW VERSION ${LDMXSW_VERSION_NUM}
DESCRIPTION "The Light Dark Matter eXperiment simulation and reconstruction framework."
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_INSTALL_MESSAGE LAZY)
# Use ccache if available to speed up rebuilds
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
endif()
# Load additional macros used by this project.
list(APPEND CMAKE_MODULE_PATH ${LDMX_SW_SOURCE_DIR}/cmake/)
# Load the BuildMacros module. If loaded correctly, the variable
# 'build_macros_found' will be set to the path of the module. Otherwise, it
# is set to NOTFOUND.
include(BuildMacros RESULT_VARIABLE build_macros_found)
# Search and configure ROOT
find_package(ROOT 6.16 CONFIG REQUIRED)
# Generate the ROOT dictionary. The following allows the use of the macro used
# to generate the dictionary.
include("${ROOT_DIR}/RootMacros.cmake")
# Adding ROOT as "SYSTEM"
# which will silence compiler warnings from these 3rd party softwares
include_directories(SYSTEM /usr/local/include/root)
# Search for the Python3 library
find_package(Python3 COMPONENTS Interpreter Development)
# CMake target wrapper around Geant4 CMake configuration
find_package(Geant4Interface)
find_package(GENIE)
find_package(
Boost REQUIRED
COMPONENTS system
log
filesystem
thread
chrono
atomic
regex)
# FunctionalCoreTest.cxx doesnt comply with clang-tidy but that's ok
set_source_files_properties(Framework/test/FunctionalCoreTest.cxx PROPERTIES COMPILE_OPTIONS "-Wno-null-dereference")
# If an install location hasn't been set via CMAKE_INSTALL_PREFIX, set it to
# a reasonable default ($PWD/install).
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/install CACHE PATH "" FORCE)
message(STATUS "Install directory set to ${CMAKE_INSTALL_PREFIX}")
endif()
# Set the default release type to "Release". If a release type is specified
# at the command line, it's respected.
set(default_build_type "Release")
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
endif()
# Clear any variables cached during previous configuration cycles.
clear_cache_variables()
add_subdirectory(Framework)
add_subdirectory(DetDescr)
add_subdirectory(Packing)
add_subdirectory(Conditions)
add_subdirectory(Tools)
add_subdirectory(Ecal)
add_subdirectory(Recon)
add_subdirectory(DQM)
add_subdirectory(Hcal)
add_subdirectory(TrigScint)
add_subdirectory(Tracking)
add_subdirectory(Trigger/Algo)
add_subdirectory(SimCore)
add_subdirectory(Biasing)
add_subdirectory(Detectors)
add_subdirectory(MagFieldMap)
build_test()
add_test(
NAME PythonConfigParameterSet
COMMAND python3 -m unittest Framework/test/test_parameter_set.py
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
add_test(
NAME StandaloneProcessor
COMMAND ./run
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Framework/test/standalone
)