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 # policy settings
0017
0018 # Steers how project() handles the VERSION option
0019 cmake_policy(SET CMP0048 NEW)
0020
0021 # the `<project_name>_VERSION` variables set by `setup(... VERSION ...)` have
0022 # only local scope, i.e. they are not accessible her for dependencies added
0023 # via `add_subdirectory`. this overrides the `project(...)` function for
0024 # sub-projects such that the resulting `<project_name>_VERSION` has
0025 # global scope and is accessible within the main project later on.
0026 macro(project)
0027 _project(${ARGN})
0028 set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "")
0029 endmacro()
0030
0031 # Controls the way python is located
0032 if(POLICY CMP0094)
0033 cmake_policy(SET CMP0094 NEW)
0034 endif()
0035
0036 # Controls behavior of DOWNLOAD_EXTRACT_TIMESTAMP
0037 if(POLICY CMP0135)
0038 cmake_policy(SET CMP0135 NEW)
0039 endif()
0040
0041 # Use boost's cmake config files
0042 if(POLICY CMP0167)
0043 cmake_policy(SET CMP0167 NEW)
0044 endif()
0045
0046 # build options
0047
0048 # all options and compile-time parameters must be defined here for clear
0049 # visibility and to make them available everywhere
0050 #
0051 # NOTE if you are adding a new option make sure that is defined in such a way
0052 # that it is off/empty by default. if you think that is not possible, then
0053 # it probably is not an optional component.
0054 # core related options
0055 # Formatting needs to be preserved here for parsing
0056 # gersemi: off
0057 set(ACTS_PARAMETER_DEFINITIONS_HEADER "" CACHE FILEPATH "Use a different (track) parameter definitions header")
0058 set(ACTS_SOURCELINK_SBO_SIZE "" CACHE STRING "Customize the SBO size used by SourceLink")
0059 option(ACTS_FORCE_ASSERTIONS "Force assertions regardless of build type" OFF)
0060 # external library options
0061 option(ACTS_USE_SYSTEM_LIBS "Use system libraries by default" OFF)
0062 # plugins related options
0063 option(ACTS_USE_SYSTEM_ACTSVG "Use the ActSVG system library" ${ACTS_USE_SYSTEM_LIBS})
0064 option(ACTS_USE_SYSTEM_ALGEBRAPLUGINS "Use a system-provided algebra-plugins installation" ${ACTS_USE_SYSTEM_LIBS})
0065 option(ACTS_SETUP_ALGEBRAPLUGINS "If we want to setup algebra-plugins" ON)
0066 option(ACTS_USE_SYSTEM_COVFIE "Use a system-provided covfie installation" ${ACTS_USE_SYSTEM_LIBS})
0067 option(ACTS_SETUP_COVFIE "If we want to setup covfie" ON)
0068 option(ACTS_USE_SYSTEM_DETRAY "Use a system-provided detray installation" ${ACTS_USE_SYSTEM_LIBS})
0069 option(ACTS_SETUP_DETRAY "If we want to setup detray" ON)
0070 option(ACTS_USE_SYSTEM_VECMEM "Use a system-provided vecmem installation" ${ACTS_USE_SYSTEM_LIBS})
0071 option(ACTS_SETUP_VECMEM "If we want to setup vecmem" ON)
0072 option(ACTS_USE_SYSTEM_TRACCC "Use a system-provided traccc installation" ${ACTS_USE_SYSTEM_LIBS})
0073 option(ACTS_USE_SYSTEM_NLOHMANN_JSON "Use nlohmann::json provided by the system instead of the bundled version" ${ACTS_USE_SYSTEM_LIBS})
0074 option(ACTS_USE_SYSTEM_PYBIND11 "Use a system installation of pybind11" ${ACTS_USE_SYSTEM_LIBS} )
0075 option(ACTS_USE_SYSTEM_MODULEMAPGRAPH "Use a system installation of ModuleMapGraph" ${ACTS_USE_SYSTEM_LIBS})
0076 option(ACTS_USE_SYSTEM_EIGEN3 "Use a system-provided eigen3" ON)
0077
0078 option(ACTS_BUILD_PLUGIN_ACTSVG "Build SVG display plugin" OFF)
0079 option(ACTS_BUILD_PLUGIN_DD4HEP "Build DD4hep plugin" OFF)
0080 option(ACTS_BUILD_PLUGIN_PODIO "Build Podio plugin" OFF)
0081 option(ACTS_BUILD_PLUGIN_EDM4HEP "Build EDM4hep plugin" OFF)
0082 option(ACTS_BUILD_PLUGIN_FPEMON "Build FPE monitoring plugin" OFF)
0083 option(ACTS_BUILD_PLUGIN_FASTJET "Build FastJet plugin" OFF)
0084 option(ACTS_BUILD_PLUGIN_GEOMODEL "Build GeoModel plugin" OFF)
0085 option(ACTS_BUILD_PLUGIN_TRACCC "Build Traccc plugin" OFF)
0086 option(ACTS_BUILD_PLUGIN_GEANT4 "Build Geant4 plugin" OFF)
0087 option(ACTS_BUILD_PLUGIN_EXATRKX "Build the Exa.TrkX plugin" OFF)
0088 option(ACTS_EXATRKX_ENABLE_ONNX "Build the Onnx backend for the exatrkx plugin" OFF)
0089 option(ACTS_EXATRKX_ENABLE_TORCH "Build the torchscript backend for the exatrkx plugin" ON)
0090 option(ACTS_EXATRKX_ENABLE_CUDA "Enable CUDA for the exatrkx plugin" OFF)
0091 option(ACTS_EXATRKX_ENABLE_MODULEMAP "Enable Module-Map-based graph construction" OFF)
0092 option(ACTS_EXATRKX_ENABLE_TENSORRT "Enable the native TensorRT inference modules" OFF)
0093 option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF)
0094 option(ACTS_BUILD_PLUGIN_ONNX "Build ONNX plugin" OFF)
0095 option(ACTS_BUILD_PLUGIN_ROOT "Build ROOT plugin" OFF)
0096 option(ACTS_SETUP_ANNOY "Explicitly set up Annoy for the project" OFF)
0097 option(ACTS_BUILD_PLUGIN_HASHING "Build Hashing plugin" OFF)
0098 # fatras related options
0099 option(ACTS_BUILD_FATRAS "Build FAst TRAcking Simulation package" OFF)
0100 option(ACTS_BUILD_FATRAS_GEANT4 "Build Geant4 Fatras package" OFF)
0101 # alignment related options
0102 option(ACTS_BUILD_ALIGNMENT "Build Alignment package" OFF)
0103 # examples related options
0104 option(ACTS_BUILD_EXAMPLES_DD4HEP "Build DD4hep-based code in the examples" OFF)
0105 option(ACTS_BUILD_EXAMPLES_EDM4HEP "Build EDM4hep-based code in the examples" OFF)
0106 option(ACTS_BUILD_EXAMPLES_PODIO "Build Podio-based code in the examples" OFF)
0107 option(ACTS_BUILD_EXAMPLES_EXATRKX "Build the Exa.TrkX example code" OFF)
0108 option(ACTS_BUILD_EXAMPLES_GEANT4 "Build Geant4-based code in the examples" OFF)
0109 option(ACTS_BUILD_EXAMPLES_HASHING "Build Hashing-based code in the examples" OFF)
0110 option(ACTS_BUILD_EXAMPLES_PYTHIA8 "Build Pythia8-based code in the examples" OFF)
0111 option(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS "Build python bindings for the examples" OFF)
0112 option(ACTS_BUILD_EXAMPLES_ROOT "Build modules based on ROOT I/O" ON)
0113 option(ACTS_BUILD_ANALYSIS_APPS "Build Analysis applications in the examples" OFF)
0114 # test related options
0115 option(ACTS_BUILD_BENCHMARKS "Build benchmarks" OFF)
0116 option(ACTS_BUILD_INTEGRATIONTESTS "Build integration tests" OFF)
0117 option(ACTS_BUILD_UNITTESTS "Build unit tests" OFF)
0118 if(ACTS_BUILD_UNITTESTS AND ACTS_BUILD_EXAMPLES)
0119 set(_default_examples_unit_tests ON)
0120 else()
0121 set(_default_examples_unit_tests OFF)
0122 endif()
0123 option(ACTS_BUILD_EXAMPLES_UNITTESTS "Build unit tests" ${_default_examples_unit_tests}) # default: ACTS_BUILD_UNITTESTS AND ACTS_BUILD_EXAMPLES
0124 option(ACTS_RUN_CLANG_TIDY "Run clang-tidy static analysis" OFF)
0125 # other options
0126 option(ACTS_BUILD_DOCS "Build documentation" OFF)
0127 option(ACTS_SETUP_BOOST "Explicitly set up Boost for the project" ON)
0128 option(ACTS_SETUP_EIGEN3 "Explicitly set up Eigen3 for the project" ON)
0129 option(ACTS_BUILD_ODD "Build the OpenDataDetector" OFF)
0130 # profiling related options
0131 option(ACTS_ENABLE_CPU_PROFILING "Enable CPU profiling using gperftools" OFF)
0132 option(ACTS_ENABLE_MEMORY_PROFILING "Enable memory profiling using gperftools" OFF)
0133 set(ACTS_GPERF_INSTALL_DIR "" CACHE STRING "Hint to help find gperf if profiling is enabled")
0134
0135 option(ACTS_ENABLE_LOG_FAILURE_THRESHOLD "Enable failing on log messages with level above certain threshold" OFF)
0136 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.")
0137 option(ACTS_COMPILE_HEADERS "Generate targets to compile header files" ON)
0138 # gersemi: on
0139
0140 # handle option inter-dependencies and the everything flag
0141 # NOTE: ordering is important here. dependencies must come before dependees
0142 include(ActsOptionHelpers)
0143
0144 # any examples component activates the general examples option
0145 set_option_if(
0146 ACTS_BUILD_EXAMPLES
0147 ACTS_BUILD_EXAMPLES_DD4HEP
0148 OR ACTS_BUILD_EXAMPLES_EDM4HEP
0149 OR ACTS_BUILD_EXAMPLES_GEANT4
0150 OR ACTS_BUILD_EXAMPLES_HASHING
0151 OR ACTS_BUILD_EXAMPLES_PYTHIA8
0152 OR ACTS_BUILD_EXAMPLES_EXATRKX
0153 OR ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS
0154 )
0155 # core plugins might be required by examples or depend on each other
0156
0157 set_option_if(
0158 ACTS_BUILD_PLUGIN_DD4HEP
0159 ACTS_BUILD_EXAMPLES_DD4HEP OR
0160 ACTS_BUILD_EXAMPLES_EDM4HEP
0161 )
0162 set_option_if(
0163 ACTS_BUILD_PLUGIN_EDM4HEP
0164 ACTS_BUILD_EXAMPLES_EDM4HEP
0165 )
0166 set_option_if(
0167 ACTS_BUILD_EXAMPLES_PODIO
0168 ACTS_BUILD_EXAMPLES_EDM4HEP
0169 )
0170 set_option_if(
0171 ACTS_BUILD_PLUGIN_PODIO
0172 ACTS_BUILD_EXAMPLES_PODIO
0173 )
0174 set_option_if(
0175 ACTS_BUILD_PLUGIN_GEANT4
0176 ACTS_BUILD_EXAMPLES_GEANT4
0177 )
0178 set_option_if(
0179 ACTS_BUILD_PLUGIN_ROOT
0180 ACTS_BUILD_PLUGIN_DD4HEP OR
0181 ACTS_BUILD_EXAMPLES
0182 )
0183 set_option_if(
0184 ACTS_BUILD_PLUGIN_IDENTIFICATION
0185 ACTS_BUILD_PLUGIN_ROOT OR
0186 ACTS_BUILD_PLUGIN_PODIO OR
0187 ACTS_BUILD_EXAMPLES
0188 )
0189 set_option_if(
0190 ACTS_BUILD_PLUGIN_JSON
0191 ACTS_BUILD_EXAMPLES
0192 )
0193 set_option_if(
0194 ACTS_BUILD_FATRAS
0195 ACTS_BUILD_EXAMPLES
0196 )
0197 set_option_if(
0198 ACTS_BUILD_PLUGIN_EXATRKX
0199 ACTS_BUILD_EXAMPLES_EXATRKX
0200 )
0201 set_option_if(
0202 ACTS_BUILD_PLUGIN_FPEMON
0203 ACTS_BUILD_EXAMPLES
0204 )
0205 set_option_if(
0206 ACTS_BUILD_PLUGIN_JSON
0207 ACTS_BUILD_PLUGIN_TRACCC
0208 )
0209 set_option_if(
0210 ACTS_BUILD_PLUGIN_ACTSVG
0211 ACTS_BUILD_PLUGIN_TRACCC
0212 )
0213 set_option_if(
0214 ACTS_BUILD_PLUGIN_HASHING
0215 ACTS_BUILD_EXAMPLES_HASHING
0216 )
0217 set_option_if(
0218 ACTS_EXATRKX_ENABLE_CUDA
0219 ACTS_EXATRKX_ENABLE_MODULEMAP
0220 )
0221
0222 # feature tests
0223 include(CheckCXXSourceCompiles)
0224
0225 # function that tests if the root installation is compatible
0226 function(check_root_compatibility)
0227 get_target_property(
0228 ROOT_INCLUDE_DIR
0229 ROOT::Core
0230 INTERFACE_INCLUDE_DIRECTORIES
0231 )
0232 set(CMAKE_REQUIRED_INCLUDES ${ROOT_INCLUDE_DIR})
0233 #yolo
0234 #check_cxx_source_compiles(" #include <string>\n #include <TString.h>\nint main(){}" ROOT_COMPATIBILITY_CHECK)
0235 #if(NOT ROOT_COMPATIBILITY_CHECK)
0236 # message(FATAL_ERROR "Root installation is misconfigured. Ensure that your Root installation was compiled.")
0237 #endif()
0238 endfunction()
0239
0240 # additional configuration and tools
0241 include(GNUInstallDirs) # GNU-like installation paths, e.g. lib/, include/, ...
0242 include(ActsCompilerOptions) # default compile options
0243 include(ActsComponentsHelpers) # handle components via add_..._if commands
0244 include(ActsStaticAnalysis)
0245
0246 # place build products in `<build>/bin` and `<build>/lib` for simple use
0247 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
0248 "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}"
0249 )
0250 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
0251 "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}"
0252 )
0253
0254 # This needs to happen before we set up any targets
0255 if(ACTS_FORCE_ASSERTIONS)
0256 message(
0257 STATUS
0258 "Injecting headers to force assertions. This can have side-effects, USE WITH CAUTION!"
0259 )
0260 include_directories(
0261 BEFORE
0262 SYSTEM
0263 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/assert_include
0264 )
0265 endif()
0266
0267 # minimal dependency versions. they are defined here in a single place so
0268 # they can be easily upgraded, although they might not be used if the
0269 # dependency is included via `add_subdirectory(...)`.
0270 set(_acts_actsvg_version 0.4.56)
0271 set(_acts_boost_version 1.77.0) # first version with C++20 support
0272 set(_acts_dd4hep_version 1.26)
0273 set(_acts_geant4_version 11.1.3)
0274 set(_acts_edm4hep_version 0.10.5)
0275 set(_acts_eigen3_version 3.4.0)
0276 set(_acts_podio_version 1.0.1) # will try this first
0277 set(_acts_podio_fallback_version 0.17.4) # if not found, will try this one
0278 set(_acts_doxygen_version 1.9.4)
0279 set(_acts_hepmc3_version 3.2.4)
0280 set(_acts_nlohmanjson_version 3.10.5)
0281 set(_acts_onnxruntime_version 1.12.0)
0282 set(_acts_geomodel_version 6.3.0)
0283 set(_acts_root_version 6.28.04) # first version with C++20 support
0284 set(_acts_tbb_version 2020.1)
0285 set(_acts_pythia8_version 8.310)
0286 set(_acts_pybind11_version 2.13.1)
0287 set(_acts_detray_version 0.98.0)
0288 set(_acts_traccc_version 0.22.0)
0289 set(_acts_covfie_version 0.13.0)
0290 set(_acts_vecmem_version 1.17.0)
0291 set(_acts_algebraplugins_version 0.27.0)
0292 set(_acts_annoy_version 1.17.3)
0293 set(_acts_fastjet_version 3.4.1)
0294
0295 # recommended dependency version. if there is an opportunity to reach
0296 # this version we will try so.
0297 set(_acts_boost_recommended_version 1.78.0)
0298
0299 # Help with compiler flags discovery
0300 include(ActsFunctions)
0301
0302 # Include the sources for the external dependencies.
0303 include(ActsExternSources)
0304
0305 # required packages
0306 if(ACTS_SETUP_BOOST)
0307 # Enable both program_options and unit_test_framework to reduce complexity
0308 # Also Cuda tests seem to use program_options
0309 if(
0310 ACTS_BUILD_ANALYSIS_APPS
0311 OR ACTS_BUILD_UNITTESTS
0312 OR ACTS_BUILD_INTEGRATIONTESTS
0313 OR ACTS_BUILD_BENCHMARKS
0314 )
0315 find_package(
0316 Boost
0317 ${_acts_boost_version}
0318 REQUIRED
0319 COMPONENTS program_options unit_test_framework
0320 )
0321 else()
0322 find_package(Boost ${_acts_boost_version} REQUIRED COMPONENTS)
0323 endif()
0324
0325 if(Boost_VERSION VERSION_LESS _acts_boost_recommended_version)
0326 message(
0327 WARNING
0328 "Found Boost ${Boost_VERSION} - recommended is at least ${_acts_boost_recommended_version}"
0329 )
0330 endif()
0331
0332 if(Boost_VERSION VERSION_EQUAL "1.85.0")
0333 set(_boost_version_severity WARNING)
0334 if(ACTS_BUILD_EXAMPLES)
0335 set(_boost_version_severity FATAL_ERROR)
0336 endif()
0337 message(
0338 ${_boost_version_severity}
0339 "Boost 1.85.0 is known to be broken (https://github.com/boostorg/container/issues/273). Please use a different version."
0340 )
0341 endif()
0342 endif()
0343
0344 if(ACTS_SETUP_EIGEN3)
0345 if(ACTS_USE_SYSTEM_EIGEN3)
0346 find_package(Eigen3 ${_acts_eigen3_version} REQUIRED CONFIG)
0347 else()
0348 add_subdirectory(thirdparty/eigen3)
0349 endif()
0350 endif()
0351
0352 find_package(Filesystem REQUIRED)
0353
0354 # CUDA settings are collected here in a macro, so that they can be reused by different plugins
0355 macro(enable_cuda)
0356 enable_language(CUDA)
0357 set(CMAKE_CUDA_STANDARD 14 CACHE STRING "CUDA C++ standard to use")
0358 set(CMAKE_CUDA_STANDARD_REQUIRED
0359 ON
0360 CACHE BOOL
0361 "Force the C++ standard requirement"
0362 )
0363 if(NOT CMAKE_CUDA_ARCHITECTURES)
0364 set(CMAKE_CUDA_ARCHITECTURES
0365 "35;52;75"
0366 CACHE STRING
0367 "CUDA architectures to generate code for"
0368 )
0369 endif()
0370 set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G")
0371 set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda")
0372 endmacro()
0373
0374 # optional packages
0375 #
0376 # find packages explicitly for each component even if this means searching for
0377 # the same package twice. This avoids having complex if/else trees to sort out
0378 # when a particular package is actually needed.
0379 if(ACTS_BUILD_PLUGIN_ACTSVG)
0380 if(ACTS_USE_SYSTEM_ACTSVG)
0381 find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG)
0382 else()
0383 add_subdirectory(thirdparty/actsvg)
0384 endif()
0385 endif()
0386 if(ACTS_BUILD_PLUGIN_DD4HEP)
0387 # Explicitly find python so we can more easily override the version
0388 find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development)
0389 find_package(
0390 DD4hep
0391 ${_acts_dd4hep_version}
0392 REQUIRED
0393 CONFIG
0394 COMPONENTS DDCore DDDetectors
0395 )
0396 endif()
0397 if(ACTS_BUILD_PLUGIN_JSON)
0398 if(ACTS_USE_SYSTEM_NLOHMANN_JSON)
0399 find_package(nlohmann_json ${_acts_nlohmanjson_version} REQUIRED CONFIG)
0400 else()
0401 add_subdirectory(thirdparty/nlohmann_json)
0402 endif()
0403 endif()
0404 if(ACTS_BUILD_PLUGIN_FASTJET)
0405 find_package(FastJet ${_acts_fastjet_version} REQUIRED)
0406 endif()
0407 if(ACTS_BUILD_PLUGIN_GEOMODEL)
0408 find_package(GeoModelCore CONFIG)
0409 if(NOT GeoModelCore_FOUND)
0410 message(
0411 FATAL_ERROR
0412 "GeoModel not found. Please install GeoModel or set ACTS_BUILD_PLUGIN_GEOMODEL to OFF."
0413 )
0414 endif()
0415
0416 if(GeoModelCore_VERSION VERSION_LESS _acts_geomodel_version)
0417 message(
0418 FATAL_ERROR
0419 "GeoModel version ${GeoModelCore_VERSION} is insufficient. Please install GeoModel version ${_acts_geomodel_version} or newer."
0420 )
0421 endif()
0422 # find other GeoModel components of EXACT same version
0423 find_package(GeoModelIO ${GeoModelCore_VERSION} REQUIRED EXACT CONFIG)
0424 endif()
0425 if(ACTS_BUILD_PLUGIN_ROOT)
0426 find_package(
0427 ROOT
0428 ${_acts_root_version}
0429 REQUIRED
0430 CONFIG
0431 COMPONENTS Geom Graf
0432 )
0433 check_root_compatibility()
0434 endif()
0435 if(ACTS_BUILD_ANALYSIS_APPS)
0436 find_package(
0437 ROOT
0438 ${_acts_root_version}
0439 REQUIRED
0440 CONFIG
0441 COMPONENTS Geom Graf
0442 )
0443 check_root_compatibility()
0444 endif()
0445 if(ACTS_BUILD_PLUGIN_EXATRKX)
0446 if(ACTS_EXATRKX_ENABLE_CUDA)
0447 find_package(CUDAToolkit REQUIRED)
0448 enable_cuda()
0449 message(STATUS "Build Exa.TrkX plugin with CUDA")
0450 else()
0451 message(STATUS "Build Exa.TrkX plugin for CPU only")
0452 endif()
0453 if(ACTS_EXATRKX_ENABLE_TORCH)
0454 find_package(Torch REQUIRED)
0455 add_subdirectory(thirdparty/FRNN)
0456 endif()
0457 if(ACTS_EXATRKX_ENABLE_MODULEMAP)
0458 if(ACTS_USE_SYSTEM_MODULEMAPGRAPH)
0459 find_package(ModuleMapGraph REQUIRED COMPONENTS CPU GPU)
0460 else()
0461 add_subdirectory(thirdparty/ModuleMapGraph)
0462 endif()
0463 endif()
0464 endif()
0465 if(ACTS_BUILD_PLUGIN_ONNX OR ACTS_EXATRKX_ENABLE_ONNX)
0466 find_package(onnxruntime ${_acts_onnxruntime_version} MODULE REQUIRED)
0467 endif()
0468 if(ACTS_BUILD_PLUGIN_EDM4HEP OR ACTS_BUILD_PLUGIN_PODIO)
0469 find_package(podio ${_acts_podio_version} CONFIG)
0470 if(NOT podio_FOUND)
0471 message(
0472 STATUS
0473 "Podio not found, trying ${_acts_podio_fallback_version} version"
0474 )
0475 find_package(podio ${_acts_podio_fallback_version} CONFIG REQUIRED)
0476 endif()
0477 find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core)
0478 endif()
0479 if(ACTS_BUILD_PLUGIN_EDM4HEP)
0480 find_package(EDM4HEP ${_acts_edm4hep_version} REQUIRED CONFIG)
0481 endif()
0482 if(ACTS_BUILD_PLUGIN_GEANT4)
0483 find_package(Geant4 ${_acts_geant4_version} REQUIRED CONFIG COMPONENTS gdml)
0484 endif()
0485
0486 if(ACTS_BUILD_PLUGIN_TRACCC)
0487 if(ACTS_SETUP_ALGEBRAPLUGINS)
0488 if(ACTS_USE_SYSTEM_ALGEBRAPLUGINS)
0489 find_package(
0490 algebra-plugins
0491 ${_acts_algebraplugins_version}
0492 REQUIRED
0493 )
0494 else()
0495 add_subdirectory(thirdparty/algebra-plugins)
0496 endif()
0497 endif()
0498
0499 if(ACTS_SETUP_DETRAY)
0500 if(ACTS_USE_SYSTEM_DETRAY)
0501 find_package(detray ${_acts_detray_version} REQUIRED CONFIG)
0502 else()
0503 add_subdirectory(thirdparty/detray)
0504 endif()
0505 endif()
0506
0507 if(ACTS_SETUP_VECMEM)
0508 if(ACTS_USE_SYSTEM_VECMEM)
0509 find_package(vecmem ${_acts_vecmem_version} REQUIRED)
0510 else()
0511 add_subdirectory(thirdparty/vecmem)
0512 # Make the "VecMem language code" available for the whole project.
0513 include("${VECMEM_LANGUAGE_DIR}/vecmem-check-language.cmake")
0514 endif()
0515 endif()
0516
0517 if(ACTS_SETUP_COVFIE)
0518 if(ACTS_USE_SYSTEM_COVFIE)
0519 find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG)
0520 else()
0521 add_subdirectory(thirdparty/covfie)
0522 endif()
0523 endif()
0524
0525 # traccc also depends on vecmem and covfie, but those plugins should always
0526 # be enabled if traccc is.
0527 if(ACTS_USE_SYSTEM_TRACCC)
0528 find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG)
0529 else()
0530 add_subdirectory(thirdparty/traccc)
0531 endif()
0532 endif()
0533 if(ACTS_SETUP_ANNOY OR ACTS_BUILD_PLUGIN_HASHING)
0534 add_subdirectory(thirdparty/Annoy)
0535 endif()
0536
0537 # examples dependencies
0538 if(ACTS_BUILD_EXAMPLES)
0539 set(THREADS_PREFER_PTHREAD_FLAG ON)
0540 find_package(Threads REQUIRED)
0541
0542 find_package(HepMC3 ${_acts_hepmc3_version} REQUIRED CONFIG)
0543
0544 # HepMC3 only introduced a proper HepMC3::HepMC3 target in 3.2.6
0545 if(${HEPMC3_VERSION} VERSION_LESS 3.2.6)
0546 add_library(HepMC3::HepMC3 SHARED IMPORTED)
0547 set_property(
0548 TARGET HepMC3::HepMC3
0549 PROPERTY IMPORTED_LOCATION "${HEPMC3_LIB}"
0550 )
0551 target_include_directories(
0552 HepMC3::HepMC3
0553 INTERFACE "${HEPMC3_INCLUDE_DIR}"
0554 )
0555 endif()
0556 if(ACTS_BUILD_EXAMPLES_ROOT)
0557 # for simplicity always request all potentially required components.
0558 find_package(
0559 ROOT
0560 ${_acts_root_version}
0561 REQUIRED
0562 CONFIG
0563 COMPONENTS Core Geom Graf GenVector Hist Tree TreePlayer
0564 )
0565 check_root_compatibility()
0566 endif()
0567 if(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS)
0568 find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development)
0569 if(ACTS_USE_SYSTEM_PYBIND11)
0570 find_package(pybind11 CONFIG REQUIRED)
0571 else()
0572 add_subdirectory(thirdparty/pybind11)
0573 endif()
0574 endif()
0575 if(ACTS_BUILD_EXAMPLES_DD4HEP AND ACTS_BUILD_EXAMPLES_GEANT4)
0576 find_package(
0577 DD4hep
0578 ${_acts_dd4hep_version}
0579 REQUIRED
0580 CONFIG
0581 COMPONENTS DDCore DDG4 DDDetectors
0582 )
0583 elseif(ACTS_BUILD_EXAMPLES_DD4HEP)
0584 find_package(
0585 DD4hep
0586 ${_acts_dd4hep_version}
0587 REQUIRED
0588 CONFIG
0589 COMPONENTS DDCore DDDetectors
0590 )
0591 endif()
0592 if(ACTS_BUILD_EXAMPLES_PYTHIA8)
0593 find_package(Pythia8 ${_acts_pythia8_version} REQUIRED)
0594 endif()
0595 endif()
0596 # other dependencies
0597 if(ACTS_BUILD_DOCS)
0598 find_package(Doxygen ${_acts_doxygen_version} REQUIRED)
0599 find_package(Sphinx REQUIRED)
0600 endif()
0601
0602 # core library, core plugins, and other components
0603 add_component(Core Core)
0604 add_subdirectory(Plugins)
0605 add_component_if(Fatras Fatras ACTS_BUILD_FATRAS)
0606 add_component_if(Alignment Alignment ACTS_BUILD_ALIGNMENT)
0607
0608 if(ACTS_BUILD_ODD)
0609 if(
0610 EXISTS
0611 "${CMAKE_CURRENT_LIST_DIR}/thirdparty/OpenDataDetector/CMakeLists.txt"
0612 )
0613 add_subdirectory_if(thirdparty/OpenDataDetector ACTS_BUILD_ODD)
0614 else()
0615 message(
0616 FATAL_ERROR
0617 "ODD build was requested, but the ODD directory seems not to be present. "
0618 "Did you init and update the submodule?"
0619 )
0620 endif()
0621 endif()
0622
0623 # examples
0624 add_subdirectory_if(Examples ACTS_BUILD_EXAMPLES)
0625
0626 # automated tests and benchmarks
0627 if(ACTS_BUILD_BENCHMARKS OR ACTS_BUILD_INTEGRATIONTESTS OR ACTS_BUILD_UNITTESTS)
0628 enable_testing() # must be set in the main CMakeLists.txt
0629 add_subdirectory(Tests)
0630 endif()
0631
0632 # documentation
0633 add_subdirectory_if(docs ACTS_BUILD_DOCS)
0634
0635 # create cmake configuration files and environment setup script
0636 include(ActsCreatePackageConfig)
0637 include(ActsCreateSetup)