Back to home page

EIC code displayed by LXR

 
 

    


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