Warning, /acts/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 cmake_minimum_required(VERSION 3.14)
0002
0003 # LCG sets CPATH, which gets treated like -I by the compiler. We want to ignore
0004 # warnings from libraries, by unsetting it here, it gets processed by the usual
0005 # target_include_directories call, resulting in the desired -isystem flag.
0006 unset(ENV{CPATH})
0007
0008 # must be set before project(...) call; version module is needed before
0009 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
0010
0011 # determine project version; sets _acts_version and _acts_commit_hash
0012 include(ActsRetrieveVersion)
0013
0014 project(Acts VERSION ${_acts_version} LANGUAGES CXX)
0015
0016 # build options
0017
0018 # all options and compile-time parameters must be defined here for clear
0019 # visibility and to make them available everywhere
0020 #
0021 # NOTE if you are adding a new option make sure that is defined in such a way
0022 # that it is off/empty by default. if you think that is not possible, then
0023 # it probably is not an optional component.
0024 option(ACTS_BUILD_EVERYTHING "Build with most options enabled (except HepMC3 and documentation)" OFF)
0025 # core related options
0026 set(ACTS_PARAMETER_DEFINITIONS_HEADER "" CACHE FILEPATH "Use a different (track) parameter definitions header")
0027 set(ACTS_SOURCELINK_SBO_SIZE "" CACHE STRING "Customize the SBO size used by SourceLink")
0028 option(ACTS_FORCE_ASSERTIONS "Force assertions regardless of build type" OFF)
0029 # external library options
0030 option(ACTS_USE_SYSTEM_LIBS "Use system libraries by default" OFF)
0031 # plugins related options
0032 option(ACTS_USE_SYSTEM_ACTSVG "Use the ActSVG system library" ${ACTS_USE_SYSTEM_LIBS})
0033 option(ACTS_BUILD_PLUGIN_ACTSVG "Build SVG display plugin" OFF)
0034 option(ACTS_BUILD_PLUGIN_CUDA "Build CUDA plugin" OFF)
0035 option(ACTS_BUILD_PLUGIN_DD4HEP "Build DD4hep plugin" OFF)
0036 option(ACTS_BUILD_PLUGIN_PODIO "Build Podio plugin" OFF)
0037 option(ACTS_BUILD_PLUGIN_EDM4HEP "Build EDM4hep plugin" OFF)
0038 option(ACTS_BUILD_PLUGIN_FPEMON "Build FPE monitoring plugin" OFF)
0039 option(ACTS_BUILD_PLUGIN_GEOMODEL "Build GeoModel plugin" OFF)
0040 option(ACTS_USE_SYSTEM_GEOMODEL "Use a system-provided GeoModel installation" ${ACTS_USE_SYSTEM_LIBS})
0041 option(ACTS_BUILD_PLUGIN_GEANT4 "Build Geant4 plugin" OFF)
0042 option(ACTS_BUILD_PLUGIN_EXATRKX "Build the Exa.TrkX plugin" OFF)
0043 option(ACTS_EXATRKX_ENABLE_ONNX "Build the Onnx backend for the exatrkx plugin" OFF)
0044 option(ACTS_EXATRKX_ENABLE_TORCH "Build the torchscript backend for the exatrkx plugin" ON)
0045 option(ACTS_BUILD_PLUGIN_IDENTIFICATION "Build Identification plugin" OFF)
0046 option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF)
0047 option(ACTS_USE_SYSTEM_NLOHMANN_JSON "Use nlohmann::json provided by the system instead of the bundled version" ${ACTS_USE_SYSTEM_LIBS})
0048 option(ACTS_BUILD_PLUGIN_LEGACY "Build legacy plugin" OFF)
0049 option(ACTS_BUILD_PLUGIN_ONNX "Build ONNX plugin" OFF)
0050 option(ACTS_SETUP_VECMEM "Explicitly set up vecmem for the project" OFF)
0051 option(ACTS_USE_SYSTEM_VECMEM "Use a system-provided vecmem installation" ${ACTS_USE_SYSTEM_LIBS})
0052 option(ACTS_BUILD_PLUGIN_SYCL "Build SYCL plugin" OFF)
0053 option(ACTS_BUILD_PLUGIN_TGEO "Build TGeo plugin" OFF)
0054 # fatras related options
0055 option(ACTS_BUILD_FATRAS "Build FAst TRAcking Simulation package" OFF)
0056 option(ACTS_BUILD_FATRAS_GEANT4 "Build Geant4 Fatras package" OFF)
0057 # alignment related options
0058 option(ACTS_BUILD_ALIGNMENT "Build Alignment package" OFF)
0059 # examples related options
0060 option(ACTS_BUILD_EXAMPLES "Build standalone examples" OFF)
0061 option(ACTS_BUILD_EXAMPLES_DD4HEP "Build DD4hep-based code in the examples" OFF)
0062 option(ACTS_BUILD_EXAMPLES_EDM4HEP "Build EDM4hep-based code in the examples" OFF)
0063 option(ACTS_BUILD_EXAMPLES_EXATRKX "Build the Exa.TrkX example code" OFF)
0064 option(ACTS_BUILD_EXAMPLES_GEANT4 "Build Geant4-based code in the examples" OFF)
0065 option(ACTS_BUILD_EXAMPLES_HEPMC3 "Build HepMC3-based code in the examples" OFF)
0066 option(ACTS_BUILD_EXAMPLES_PYTHIA8 "Build Pythia8-based code in the examples" OFF)
0067 option(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS "Build python bindings for the examples" OFF)
0068 option(ACTS_USE_SYSTEM_PYBIND11 "Use a system installation of pybind11" ${ACTS_USE_SYSTEM_LIBS} )
0069 option(ACTS_USE_EXAMPLES_TBB "Use Threading Building Blocks library in the examples" ON)
0070 option(ACTS_BUILD_ANALYSIS_APPS "Build Analysis applications in the examples" OFF)
0071 # test related options
0072 option(ACTS_BUILD_BENCHMARKS "Build benchmarks" OFF)
0073 option(ACTS_BUILD_INTEGRATIONTESTS "Build integration tests" OFF)
0074 option(ACTS_BUILD_UNITTESTS "Build unit tests" OFF)
0075 option(ACTS_BUILD_NONCOMPILE_TESTS "Build tests that check build failure invariants" OFF)
0076 option(ACTS_RUN_CLANG_TIDY "Run clang-tidy static analysis" OFF)
0077 # other options
0078 option(ACTS_BUILD_DOCS "Build documentation" OFF)
0079 option(ACTS_SETUP_BOOST "Explicitly set up Boost for the project" ON)
0080 option(ACTS_USE_SYSTEM_BOOST "Use a system-provided boost" ON)
0081 option(ACTS_SETUP_EIGEN3 "Explicitly set up Eigen3 for the project" ON)
0082 option(ACTS_USE_SYSTEM_EIGEN3 "Use a system-provided eigen3" ON)
0083 option(ACTS_BUILD_ODD "Build the OpenDataDetector" OFF)
0084 # profiling related optios
0085 option(ACTS_ENABLE_CPU_PROFILING "Enable CPU profiling using gperftools" OFF)
0086 option(ACTS_ENABLE_MEMORY_PROFILING "Enable memory profiling using gperftools" OFF)
0087 set(ACTS_GPERF_INSTALL_DIR "" CACHE STRING "Hint to help find gperf if profiling is enabled")
0088
0089 option(ACTS_ENABLE_LOG_FAILURE_THRESHOLD "Enable failing on log messages with level above certain threshold" OFF)
0090 set(ACTS_LOG_FAILURE_THRESHOLD "" CACHE STRING "Log level above which an exception should be automatically thrown. If ACTS_ENABLE_LOG_FAILURE_THRESHOLD is set and this is unset, this will enable a runtime check of the log level.")
0091
0092 # handle option inter-dependencies and the everything flag
0093 # NOTE: ordering is important here. dependencies must come before dependees
0094 include(ActsOptionHelpers)
0095 # options without inter-dependencies
0096 set_option_if(ACTS_BUILD_BENCHMARKS ACTS_BUILD_EVERYTHING)
0097 set_option_if(ACTS_BUILD_UNITTESTS ACTS_BUILD_EVERYTHING)
0098 set_option_if(ACTS_BUILD_NONCOMPILE_TESTS ACTS_BUILD_EVERYTHING)
0099 set_option_if(ACTS_BUILD_INTEGRATIONTESTS ACTS_BUILD_EVERYTHING)
0100 set_option_if(ACTS_BUILD_EXAMPLES_DD4HEP ACTS_BUILD_EVERYTHING)
0101 set_option_if(ACTS_BUILD_EXAMPLES_GEANT4 ACTS_BUILD_EVERYTHING)
0102 set_option_if(ACTS_BUILD_EXAMPLES_HEPMC3 ACTS_BUILD_EVERYTHING)
0103 set_option_if(ACTS_BUILD_EXAMPLES_PYTHIA8 ACTS_BUILD_EVERYTHING)
0104 set_option_if(ACTS_BUILD_FATRAS_GEANT4 ACTS_BUILD_EVERYTHING)
0105 set_option_if(ACTS_BUILD_FATRAS ACTS_BUILD_FATRAS_GEANT4)
0106 set_option_if(ACTS_BUILD_ALIGNMENT ACTS_BUILD_EVERYTHING)
0107 set_option_if(ACTS_BUILD_EXAMPLES_EDM4HEP ACTS_BUILD_EVERYTHING)
0108 set_option_if(ACTS_BUILD_ANALYSIS_APPS ACTS_BUILD_EVERYTHING)
0109
0110 # any examples component activates the general examples option
0111 set_option_if(
0112 ACTS_BUILD_EXAMPLES
0113 ACTS_BUILD_EXAMPLES_DD4HEP
0114 OR ACTS_BUILD_EXAMPLES_EDM4HEP
0115 OR ACTS_BUILD_EXAMPLES_GEANT4
0116 OR ACTS_BUILD_EXAMPLES_HEPMC3
0117 OR ACTS_BUILD_EXAMPLES_PYTHIA8
0118 OR ACTS_BUILD_EXAMPLES_EXATRKX
0119 OR ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS
0120 OR ACTS_BUILD_EXAMPLES_BINARIES
0121 OR ACTS_BUILD_EVERYTHING)
0122 # core plugins might be required by examples or depend on each other
0123 set_option_if(
0124 ACTS_BUILD_PLUGIN_DD4HEP
0125 ACTS_BUILD_EXAMPLES_DD4HEP OR ACTS_BUILD_EVERYTHING OR
0126 ACTS_BUILD_EXAMPLES_EDM4HEP)
0127 set_option_if(
0128 ACTS_BUILD_PLUGIN_EDM4HEP
0129 ACTS_BUILD_EXAMPLES_EDM4HEP OR ACTS_BUILD_EVERYTHING)
0130 set_option_if(
0131 ACTS_BUILD_PLUGIN_PODIO
0132 ACTS_BUILD_EVERYTHING)
0133 set_option_if(
0134 ACTS_BUILD_PLUGIN_GEANT4
0135 ACTS_BUILD_EXAMPLES_GEANT4 OR ACTS_BUILD_EVERYTHING)
0136 set_option_if(
0137 ACTS_BUILD_PLUGIN_TGEO
0138 ACTS_BUILD_PLUGIN_DD4HEP OR ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING)
0139 set_option_if(
0140 ACTS_BUILD_PLUGIN_IDENTIFICATION
0141 ACTS_BUILD_PLUGIN_TGEO OR ACTS_BUILD_PLUGIN_PODIO OR ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING)
0142 set_option_if(
0143 ACTS_BUILD_PLUGIN_JSON
0144 ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING)
0145 set_option_if(
0146 ACTS_BUILD_FATRAS
0147 ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING)
0148 set_option_if(ACTS_BUILD_PLUGIN_LEGACY ACTS_BUILD_EVERYTHING)
0149 set_option_if(ACTS_BUILD_PLUGIN_EXATRKX ACTS_BUILD_EXAMPLES_EXATRKX)
0150 set_option_if(ACTS_BUILD_PLUGIN_FPEMON
0151 ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING)
0152
0153 # feature tests
0154 include(CheckCXXSourceCompiles)
0155
0156 # function that tests if the root installation is compatible
0157 function(check_root_compatibility)
0158 get_target_property(ROOT_INCLUDE_DIR ROOT::Core INTERFACE_INCLUDE_DIRECTORIES)
0159 set(CMAKE_REQUIRED_INCLUDES ${ROOT_INCLUDE_DIR})
0160 #yolo
0161 #check_cxx_source_compiles("#include <string>\n#include <TString.h>\nint main(){}" ROOT_COMPATIBILITY_CHECK)
0162 #if(NOT ROOT_COMPATIBILITY_CHECK)
0163 # message(FATAL_ERROR "Root installation is misconfigured. Ensure that your Root installation was compiled.")
0164 #endif()
0165 endfunction()
0166
0167 # additional configuration and tools
0168 include(GNUInstallDirs) # GNU-like installation paths, e.g. lib/, include/, ...
0169 include(ActsCompilerOptions) # default compile options
0170 include(ActsComponentsHelpers) # handle components via add_..._if commands
0171 include(ActsStaticAnalysis)
0172
0173 # place build products in `<build>/bin` and `<build>/lib` for simple use
0174 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
0175 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
0176
0177 # This needs to happen before we set up any targets
0178 if(ACTS_FORCE_ASSERTIONS)
0179 message(STATUS "Injecting headers to force assertions. This can have side-effects, USE WITH CAUTION!")
0180 include_directories(BEFORE SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/cmake/assert_include)
0181 endif()
0182
0183 # minimal dependency versions. they are defined here in a single place so
0184 # they can be easily upgraded, although they might not be used if the
0185 # dependency is included via `add_subdirectory(...)`.
0186 set(_acts_actsvg_version 0.4.40)
0187 set(_acts_autodiff_version 0.6)
0188 set(_acts_boost_version 1.71.0)
0189 set(_acts_dd4hep_version 1.21)
0190 set(_acts_edm4hep_version 0.7)
0191 set(_acts_geomodel_version 4.6.0)
0192 set(_acts_podio_version 0.16)
0193 set(_acts_doxygen_version 1.9.4)
0194 set(_acts_eigen3_version 3.3.7)
0195 set(_acts_hepmc3_version 3.2.1)
0196 set(_acts_nlohmanjson_version 3.2.0)
0197 set(_acts_onnxruntime_version 1.12.0)
0198 set(_acts_root_version 6.20)
0199 set(_acts_tbb_version 2020.1)
0200
0201 # recommended dependency version. if there is an opportunity to reach
0202 # this version we will try so.
0203 set(_acts_boost_recommended_version 1.78.0)
0204
0205 # required packages
0206 if (ACTS_SETUP_BOOST)
0207 if (ACTS_USE_SYSTEM_BOOST)
0208 # NOTE FindBoost.cmake looks for BoostConfig.cmake first, before running it's own logic.
0209
0210 # Enable both program_options and unit_test_framework to reduce complexity
0211 # Also Cuda tests seem to use program_options
0212 if( ACTS_BUILD_EXAMPLES_BINARIES OR ACTS_BUILD_ANALYSIS_APPS OR
0213 ACTS_BUILD_UNITTESTS OR ACTS_BUILD_INTEGRATIONTESTS OR ACTS_BUILD_BENCHMARKS )
0214 find_package(Boost ${_acts_boost_version} REQUIRED COMPONENTS program_options unit_test_framework)
0215 else()
0216 find_package(Boost ${_acts_boost_version} REQUIRED COMPONENTS)
0217 endif()
0218
0219 if(Boost_VERSION VERSION_LESS _acts_boost_recommended_version)
0220 message(WARNING "Found Boost ${Boost_VERSION} - recommended is at least ${_acts_boost_recommended_version}")
0221 endif()
0222 else()
0223 add_subdirectory(thirdparty/boost)
0224 endif()
0225 endif()
0226
0227 if (ACTS_SETUP_EIGEN3)
0228 if (ACTS_USE_SYSTEM_EIGEN3)
0229 find_package(Eigen3 ${_acts_eigen3_version} REQUIRED CONFIG)
0230 else()
0231 add_subdirectory(thirdparty/eigen3)
0232 endif()
0233 endif()
0234
0235 if (ACTS_SETUP_VECMEM)
0236 if (ACTS_USE_SYSTEM_VECMEM)
0237 find_package(vecmem REQUIRED)
0238 else()
0239 add_subdirectory(thirdparty/vecmem)
0240 endif()
0241 endif()
0242
0243 find_package(Filesystem REQUIRED)
0244
0245 # the `<project_name>_VERSION` variables set by `setup(... VERSION ...)` have
0246 # only local scope, i.e. they are not accessible her for dependencies added
0247 # via `add_subdirectory`. this overrides the `project(...)` funcion for
0248 # sub-projects such that the resulting `<project_name>_VERSION` has
0249 # global scope and is accessible within the main project later on.
0250 cmake_policy(SET CMP0048 NEW)
0251 macro(project)
0252 _project(${ARGN})
0253 set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "")
0254 endmacro()
0255
0256 # CUDA settings are collected here in a macro, so that they can be reused by different plugins
0257 macro(enable_cuda)
0258 enable_language(CUDA)
0259 set(CMAKE_CUDA_STANDARD 14 CACHE STRING "CUDA C++ standard to use")
0260 set(CMAKE_CUDA_STANDARD_REQUIRED ON CACHE BOOL
0261 "Force the C++ standard requirement")
0262 if(NOT CMAKE_CUDA_ARCHITECTURES)
0263 set(CMAKE_CUDA_ARCHITECTURES "35;52;75" CACHE STRING
0264 "CUDA architectures to generate code for")
0265 endif()
0266 set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G")
0267 set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda")
0268 endmacro()
0269
0270 # optional packages
0271 #
0272 # find packages explicitly for each component even if this means searching for
0273 # the same package twice. This avoids having complex if/else trees to sort out
0274 # when a particular package is actually needed.
0275
0276 # plugin dependencies
0277 if(ACTS_BUILD_PLUGIN_ACTSVG)
0278 if(ACTS_USE_SYSTEM_ACTSVG)
0279 message(STATUS "Using system installation of actsvg")
0280 find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG)
0281 else()
0282 add_subdirectory(thirdparty/actsvg)
0283 endif()
0284 endif()
0285 if(ACTS_BUILD_PLUGIN_CUDA)
0286 enable_cuda()
0287 endif()
0288 if(ACTS_BUILD_PLUGIN_DD4HEP)
0289 # Explicitly find python so we can more easily override the version
0290 find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development)
0291 find_package(DD4hep ${_acts_dd4hep_version} REQUIRED CONFIG COMPONENTS DDCore DDDetectors)
0292 endif()
0293 if(ACTS_BUILD_PLUGIN_JSON)
0294 if(ACTS_USE_SYSTEM_NLOHMANN_JSON)
0295 message(STATUS "Using system installation of nlohmann::json")
0296 find_package(nlohmann_json ${_acts_nlohmanjson_version} REQUIRED CONFIG)
0297 else()
0298 add_subdirectory(thirdparty/nlohmann_json)
0299 endif()
0300 endif()
0301 if(ACTS_BUILD_PLUGIN_GEOMODEL)
0302 if(ACTS_USE_SYSTEM_GEOMODEL)
0303 message(STATUS "Using system installation of GeoModel")
0304 find_package(GeoModel ${_acts_geomodel_version} REQUIRED CONFIG)
0305 else()
0306 add_subdirectory(thirdparty/GeoModel)
0307 endif()
0308 endif()
0309
0310 if(ACTS_BUILD_PLUGIN_SYCL)
0311 find_package(SYCL REQUIRED)
0312 endif()
0313 if(ACTS_BUILD_PLUGIN_TGEO)
0314 find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Geom Graf)
0315 check_root_compatibility()
0316 endif()
0317 if(ACTS_BUILD_ANALYSIS_APPS)
0318 find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Geom Graf)
0319 check_root_compatibility()
0320 endif()
0321 if(ACTS_BUILD_PLUGIN_EXATRKX)
0322 find_package(Torch REQUIRED)
0323 find_package(CUDAToolkit)
0324 if(CUDAToolkit_FOUND)
0325 enable_cuda()
0326 add_subdirectory(thirdparty/FRNN)
0327 else()
0328 message(WARNING "CUDA not found, build Exa.TrkX plugin only for CPU")
0329 endif()
0330 if(NOT (ACTS_EXATRKX_ENABLE_ONNX OR ACTS_EXATRKX_ENABLE_TORCH))
0331 message(FATAL_ERROR
0332 "When building the Exa.TrkX plugin, at least one of ACTS_EXATRKX_ENABLE_ONNX \
0333 and ACTS_EXATRKX_ENABLE_TORCHSCRIPT must be enabled."
0334 )
0335 endif()
0336 if(ACTS_EXATRKX_ENABLE_ONNX)
0337 find_package(cugraph REQUIRED)
0338 endif()
0339 if(ACTS_EXATRKX_ENABLE_TORCH)
0340 find_package(TorchScatter REQUIRED)
0341 endif()
0342 endif()
0343 if(ACTS_BUILD_PLUGIN_ONNX OR ACTS_EXATRKX_ENABLE_ONNX)
0344 find_package(OnnxRuntime ${_acts_onnxruntime_version} REQUIRED)
0345 endif()
0346 if(ACTS_BUILD_PLUGIN_EDM4HEP OR ACTS_BUILD_PLUGIN_PODIO)
0347 find_package(podio ${_acts_podio_version} REQUIRED CONFIG)
0348 find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core)
0349 endif()
0350 if(ACTS_BUILD_PLUGIN_EDM4HEP)
0351 find_package(EDM4HEP ${_acts_edm4hep_version} REQUIRED CONFIG)
0352 endif()
0353 if(ACTS_BUILD_PLUGIN_GEANT4)
0354 find_package(Geant4 REQUIRED CONFIG COMPONENTS gdml)
0355 endif()
0356
0357 # examples dependencies
0358 if(ACTS_BUILD_EXAMPLES)
0359 set(THREADS_PREFER_PTHREAD_FLAG ON)
0360 find_package(Threads REQUIRED)
0361 # for simplicity always request all potentially required components.
0362 find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core Geom Graf GenVector Hist Tree TreePlayer)
0363 check_root_compatibility()
0364 add_subdirectory(thirdparty/dfelibs)
0365 endif()
0366 if(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS)
0367 find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development)
0368 if(ACTS_USE_SYSTEM_PYBIND11)
0369 find_package(pybind11 CONFIG REQUIRED)
0370 else()
0371 add_subdirectory(thirdparty/pybind11)
0372 endif()
0373 endif()
0374 if(ACTS_BUILD_EXAMPLES_DD4HEP AND ACTS_BUILD_EXAMPLES_GEANT4)
0375 find_package(DD4hep ${_acts_dd4hep_version} REQUIRED CONFIG COMPONENTS DDCore DDG4 DDDetectors)
0376 elseif(ACTS_BUILD_EXAMPLES_DD4HEP)
0377 find_package(DD4hep ${_acts_dd4hep_version} REQUIRED CONFIG COMPONENTS DDCore DDDetectors)
0378 endif()
0379 if(ACTS_BUILD_EXAMPLES_HEPMC3)
0380 find_package(HepMC3 ${_acts_hepmc3_version} REQUIRED CONFIG)
0381 endif()
0382 if(ACTS_BUILD_EXAMPLES_PYTHIA8)
0383 find_package(Pythia8 REQUIRED)
0384
0385 if(DEFINED CMAKE_CXX_STANDARD)
0386 if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20)
0387 message(WARNING "ACTS is configured to build with C++20."
0388 "As of version 309, Pythia8 does not compile under C++20."
0389 "You can find a patch file at: https://gist.github.com/paulgessinger/7a823b4015d4511cf829472291c8ddcf")
0390 endif()
0391 endif()
0392 endif()
0393 # other dependencies
0394 if(ACTS_BUILD_DOCS)
0395 find_package(Doxygen ${_acts_doxygen_version} REQUIRED)
0396 find_package(Sphinx REQUIRED)
0397 endif()
0398
0399 if(ACTS_CUSTOM_SCALARTYPE)
0400 message(STATUS "Building Acts with custom scalar type: ${ACTS_CUSTOM_SCALARTYPE}")
0401 endif()
0402
0403 # core library, core plugins, and other components
0404 add_component(Core Core)
0405 add_subdirectory(Plugins)
0406 add_component_if(Fatras Fatras ACTS_BUILD_FATRAS)
0407 add_component_if(Alignment Alignment ACTS_BUILD_ALIGNMENT)
0408
0409 if(ACTS_BUILD_ODD)
0410 if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/thirdparty/OpenDataDetector/CMakeLists.txt")
0411 add_subdirectory_if(thirdparty/OpenDataDetector ACTS_BUILD_ODD)
0412 else()
0413 message(FATAL_ERROR "ODD build was requested, but the ODD directory seems not to be present. "
0414 "Did you init and update the submodule?")
0415 endif()
0416 endif()
0417
0418
0419 # examples
0420 add_subdirectory_if(Examples ACTS_BUILD_EXAMPLES)
0421
0422 # automated tests and benchmarks
0423 if(ACTS_BUILD_BENCHMARKS OR ACTS_BUILD_INTEGRATIONTESTS OR ACTS_BUILD_UNITTESTS)
0424 enable_testing() # must be set in the main CMakeLists.txt
0425 add_subdirectory(Tests)
0426 endif()
0427
0428 # documentation
0429 add_subdirectory_if(docs ACTS_BUILD_DOCS)
0430
0431
0432 # create cmake configuration files and environment setup script
0433 include(ActsCreatePackageConfig)
0434 include(ActsCreateSetup)