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