-
Notifications
You must be signed in to change notification settings - Fork 21
/
CMakeLists.txt
166 lines (125 loc) · 6.15 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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Set the minimum version of CMake that's required
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
project(LDMX_SW VERSION 3.1.1
DESCRIPTION "The Light Dark Matter eXperiment simulation and reconstruction framework."
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 20)
# 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)
# Adding ROOT, ACTS, HLS arb prec as "SYSTEM"
# which will silence compiler warnings from these 3rd party softwares
include_directories(SYSTEM /usr/local/include/root)
include_directories(SYSTEM Tracking/acts/Core/include)
# 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()
# If a user is building outside of a Docker or Singularity environment,
# warn them.
if (NOT EXISTS /.dockerenv AND NOT EXISTS /singularity)
message(WARNING "You are not inside a container; you may be working in an untested environment.")
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()
# The following types of builds are allowed
#
# * Recon - In addition to building the framework, build the modules needed
# by the reconstruction.
# * Sim - Only build the modules necessary to run the simulation.
# * Eve - Build the event display only.
#
# By default, all modules are built.
option(BUILD_RECON_ONLY "Build the modules necessary to run the reconstruction." OFF)
option(BUILD_SIM_ONLY "Build the modules necessary to run the simulation." OFF)
if(NOT BUILD_RECON_ONLY AND NOT BUILD_SIM_ONLY)
set(BUILD_ALL ON)
message(STATUS "Building all modules.")
endif()
# Start by building all of the classes needed for building the event bus and
# ROOT dictionary. This is on by forcing the global "BUILD_EVENT_ONLY" option
# here.
set(BUILD_EVENT_ONLY ON CACHE BOOL "Build the SimCore library." FORCE)
add_subdirectory(Recon ${CMAKE_BINARY_DIR}/ReconEvent)
add_subdirectory(SimCore ${CMAKE_BINARY_DIR}/SimCoreEvent)
add_subdirectory(Ecal ${CMAKE_BINARY_DIR}/EcalEvent)
add_subdirectory(Hcal ${CMAKE_BINARY_DIR}/HcalEvent)
add_subdirectory(TrigScint ${CMAKE_BINARY_DIR}/TrigScintEvent)
add_subdirectory(Tracking ${CMAKE_BINARY_DIR}/TrackingEvent)
add_subdirectory(Trigger/Algo ${CMAKE_BINARY_DIR}/TriggerEvent)
# Once the event libraries have been built, turn off the global option.
set(BUILD_EVENT_ONLY OFF CACHE BOOL "Build the SimCore library." FORCE)
# The framework has all the backend code needed to run all processors.
add_subdirectory(Framework)
# This module contains all detector service related code. Needed by recon.
add_subdirectory(DetDescr)
if(BUILD_ALL OR BUILD_RECON_ONLY)
message(STATUS "Building the modules necessary for the reconstruction.")
# Interface with raw data
add_subdirectory(Packing)
# Conditions services
add_subdirectory(Conditions)
# The tools module contains tools generic enough to be used by other modules.
add_subdirectory(Tools)
# This module contains ECal reconstruction code.
add_subdirectory(Ecal)
# Currently, this module contains processors from several subsystems.
add_subdirectory(Recon)
# Data quality management plots.
add_subdirectory(DQM)
# This module contains HCal reconstruction code.
add_subdirectory(Hcal)
# This module contains all things trigger scintillator
add_subdirectory(TrigScint)
# This module is focused on track reconstruction
add_subdirectory(Tracking)
# This module contains trigger algorithms.
add_subdirectory(Trigger/Algo)
endif()
if(BUILD_ALL OR BUILD_SIM_ONLY)
message(STATUS "Building the modules necessary for the simulation.")
# SimCore allows the simulation to be run without biasing
add_subdirectory(SimCore)
# Adding the Biasing module, allows the use of biasing in the simulation
add_subdirectory(Biasing)
# Add the Detectors submodule. This has no dependecies.
add_subdirectory(Detectors)
# Add the magnetic field map directory. This simply installs the B-field maps.
add_subdirectory(MagFieldMap)
endif()
# Build all test. The test are assumed to reside inside of the directory
# "test" within each module. The main
build_test()
# The EventDisplay is stand-a-lone and _needs_ to be after everything else
# so that it can clear the cache variables and construct its own dictionary.
option(BUILD_EVE "Build the event display as well as other parts." OFF)
if(BUILD_EVE)
add_subdirectory(EventDisplay)
endif()