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(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_COVFIE "Use a system-provided covfie installation" ${ACTS_USE_SYSTEM_LIBS})
0066 option(ACTS_SETUP_COVFIE "If we want to set up covfie" ON)
0067 option(ACTS_USE_SYSTEM_DETRAY "Use a system-provided detray installation" ${ACTS_USE_SYSTEM_LIBS})
0068 option(ACTS_SETUP_DETRAY "If we want to set up detray" ON)
0069 option(ACTS_USE_SYSTEM_VECMEM "Use a system-provided vecmem installation" ${ACTS_USE_SYSTEM_LIBS})
0070 option(ACTS_SETUP_VECMEM "If we want to set up vecmem" ON)
0071 option(ACTS_USE_SYSTEM_TRACCC "Use a system-provided traccc installation" ${ACTS_USE_SYSTEM_LIBS})
0072 option(ACTS_USE_SYSTEM_NLOHMANN_JSON "Use nlohmann::json provided by the system instead of the bundled version" ${ACTS_USE_SYSTEM_LIBS})
0073 option(ACTS_USE_SYSTEM_PYBIND11 "Use a system installation of pybind11" ${ACTS_USE_SYSTEM_LIBS} )
0074 option(ACTS_USE_SYSTEM_MODULEMAPGRAPH "Use a system installation of ModuleMapGraph" ${ACTS_USE_SYSTEM_LIBS})
0075 option(ACTS_USE_SYSTEM_EIGEN3 "Use a system-provided eigen3" ON)
0076 option(ACTS_USE_SYSTEM_MILLE "Use a system-provided Mille" 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_EDM4HEP "Build EDM4hep plugin" OFF)
0081 option(ACTS_BUILD_PLUGIN_FPEMON "Build FPE monitoring plugin" OFF)
0082 option(ACTS_BUILD_PLUGIN_GEOMODEL "Build GeoModel plugin" OFF)
0083 option(ACTS_BUILD_PLUGIN_TRACCC "Build Traccc plugin" OFF)
0084 option(ACTS_BUILD_PLUGIN_GEANT4 "Build Geant4 plugin" OFF)
0085 option(ACTS_BUILD_PLUGIN_GNN "Build the GNN plugin" OFF)
0086 option(ACTS_GNN_ENABLE_ONNX "Build the Onnx backend for the gnn plugin" OFF)
0087 option(ACTS_GNN_ENABLE_TORCH "Build the torchscript backend for the gnn plugin" ON)
0088 option(ACTS_GNN_ENABLE_CUDA "Enable CUDA for the gnn plugin" OFF)
0089 option(ACTS_GNN_ENABLE_MODULEMAP "Enable Module-Map-based graph construction" OFF)
0090 option(ACTS_GNN_ENABLE_TENSORRT "Enable the native TensorRT inference modules" OFF)
0091 option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF)
0092 option(ACTS_BUILD_PLUGIN_MILLE "Build Mille plugin" OFF)
0093 option(ACTS_BUILD_PLUGIN_ONNX "Build ONNX plugin" OFF)
0094 option(ACTS_BUILD_PLUGIN_ROOT "Build ROOT plugin" OFF)
0095 option(ACTS_SETUP_ANNOY "Explicitly set up Annoy for the project" OFF)
0096 # python related options
0097 option(ACTS_BUILD_PYTHON_WHEEL "Settings to build for python deployment with scikit-build-core" OFF)
0098 option(ACTS_BUILD_PYTHON_BINDINGS "Build python bindings for all enabled components" OFF)
0099 option(ACTS_GENERATE_PYTHON_STUBS "Generate Python stub files (.pyi) using pybind11-stubgen via uv" OFF)
0100 # fatras related options
0101 option(ACTS_BUILD_FATRAS "Build FAst TRAcking Simulation package" OFF)
0102 option(ACTS_BUILD_FATRAS_GEANT4 "Build Geant4 Fatras package" OFF)
0103 # alignment related options
0104 option(ACTS_BUILD_ALIGNMENT "Build Alignment package" OFF)
0105 # examples related options
0106 option(ACTS_BUILD_EXAMPLES "Build basic examples components" OFF)
0107 option(ACTS_BUILD_EXAMPLES_DD4HEP "Build DD4hep-based code in the examples" OFF)
0108 option(ACTS_BUILD_EXAMPLES_EDM4HEP "Build EDM4hep-based code in the examples" OFF)
0109 option(ACTS_BUILD_EXAMPLES_FASTJET "Build FastJet plugin" OFF)
0110 option(ACTS_BUILD_EXAMPLES_GEANT4 "Build Geant4-based code in the examples" OFF)
0111 option(ACTS_BUILD_EXAMPLES_GNN "Build the GNN example code" OFF)
0112 option(ACTS_BUILD_EXAMPLES_HASHING "Build Hashing-based code in the examples" OFF)
0113 option(ACTS_BUILD_EXAMPLES_PODIO "Build Podio-based code in the examples" OFF)
0114 option(ACTS_BUILD_EXAMPLES_PYTHIA8 "Build Pythia8-based code in the examples" OFF)
0115 option(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS "[Deprecated] Build python bindings and enables the examples" OFF)
0116 option(ACTS_BUILD_EXAMPLES_ROOT "Build modules based on ROOT I/O" OFF)
0117 option(ACTS_BUILD_ANALYSIS_APPS "Build Analysis applications in the examples" OFF)
0118 # test related options
0119 option(ACTS_BUILD_BENCHMARKS "Build benchmarks" OFF)
0120 option(ACTS_BUILD_INTEGRATIONTESTS "Build integration tests" OFF)
0121 option(ACTS_BUILD_UNITTESTS "Build unit tests" OFF)
0122 if(ACTS_BUILD_UNITTESTS AND ACTS_BUILD_EXAMPLES)
0123   set(_default_examples_unit_tests ON)
0124 else()
0125   set(_default_examples_unit_tests OFF)
0126 endif()
0127 option(ACTS_BUILD_EXAMPLES_UNITTESTS "Build unit tests" ${_default_examples_unit_tests}) # default: ACTS_BUILD_UNITTESTS AND ACTS_BUILD_EXAMPLES
0128 option(ACTS_RUN_CLANG_TIDY "Run clang-tidy static analysis" OFF)
0129 # other options
0130 option(ACTS_BUILD_DOCS "Build documentation" OFF)
0131 option(ACTS_SETUP_BOOST "Explicitly set up Boost for the project" ON)
0132 option(ACTS_SETUP_EIGEN3 "Explicitly set up Eigen3 for the project" ON)
0133 option(ACTS_BUILD_ODD "Build the OpenDataDetector" OFF)
0134 # profiling related options
0135 option(ACTS_ENABLE_CPU_PROFILING "Enable CPU profiling using gperftools" OFF)
0136 option(ACTS_ENABLE_MEMORY_PROFILING "Enable memory profiling using gperftools" OFF)
0137 set(ACTS_GPERF_INSTALL_DIR "" CACHE STRING "Hint to help find gperf if profiling is enabled")
0138 
0139 option(ACTS_ENABLE_LOG_FAILURE_THRESHOLD "Enable failing on log messages with level above certain threshold" OFF)
0140 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.")
0141 option(ACTS_COMPILE_HEADERS "Generate targets to compile header files" ON)
0142 # gersemi: on
0143 
0144 # handle option inter-dependencies and the everything flag
0145 # NOTE: ordering is important here. dependencies must come before dependees
0146 include(ActsOptionHelpers)
0147 
0148 # Preserve previous behaviour of ACTS_BUILD_PYTHON_BINDINGS but mark as deprecated
0149 if(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS)
0150     message(
0151         DEPRECATION
0152         "ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS is deprecated. Enable ACTS_BUILD_EXAMPLES and ACTS_BUILD_PYTHON_BINDINGS to achieve the same effect."
0153     )
0154     set(ACTS_BUILD_PYTHON_BINDINGS ON)
0155 endif()
0156 # any examples component activates the general examples option
0157 set_option_if(
0158     ACTS_BUILD_EXAMPLES
0159     ACTS_BUILD_EXAMPLES_DD4HEP
0160     OR
0161     ACTS_BUILD_EXAMPLES_EDM4HEP
0162     OR
0163     ACTS_BUILD_EXAMPLES_FASTJET
0164     OR
0165     ACTS_BUILD_EXAMPLES_GEANT4
0166     OR
0167     ACTS_BUILD_EXAMPLES_GNN
0168     OR
0169     ACTS_BUILD_EXAMPLES_HASHING
0170     OR
0171     ACTS_BUILD_EXAMPLES_PODIO
0172     OR
0173     ACTS_BUILD_EXAMPLES_PYTHIA8
0174     OR
0175     ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS
0176     OR
0177     ACTS_BUILD_EXAMPLES_ROOT
0178 )
0179 # core plugins might be required by examples or depend on each other
0180 set_option_if(
0181     ACTS_BUILD_PLUGIN_DD4HEP
0182     ACTS_BUILD_EXAMPLES_DD4HEP
0183     OR
0184     ACTS_BUILD_EXAMPLES_EDM4HEP
0185 )
0186 set_option_if(ACTS_BUILD_PLUGIN_EDM4HEP ACTS_BUILD_EXAMPLES_EDM4HEP)
0187 set_option_if(ACTS_BUILD_EXAMPLES_PODIO ACTS_BUILD_EXAMPLES_EDM4HEP)
0188 set_option_if(ACTS_BUILD_PLUGIN_GEANT4 ACTS_BUILD_EXAMPLES_GEANT4)
0189 set_option_if(
0190     ACTS_BUILD_PLUGIN_ROOT
0191     ACTS_BUILD_EXAMPLES_ROOT
0192     OR
0193     ACTS_BUILD_PLUGIN_DD4HEP
0194 )
0195 set_option_if(
0196     ACTS_BUILD_PLUGIN_IDENTIFICATION
0197     ACTS_BUILD_PLUGIN_ROOT
0198     OR
0199     ACTS_BUILD_PLUGIN_EDM4HEP
0200     OR
0201     ACTS_BUILD_EXAMPLES
0202 )
0203 set_option_if(ACTS_BUILD_PLUGIN_JSON ACTS_BUILD_EXAMPLES)
0204 set_option_if(ACTS_BUILD_FATRAS ACTS_BUILD_EXAMPLES)
0205 set_option_if(ACTS_BUILD_FATRAS ACTS_BUILD_EXAMPLES_FASTJET)
0206 set_option_if(ACTS_BUILD_PLUGIN_GNN ACTS_BUILD_EXAMPLES_GNN)
0207 set_option_if(ACTS_BUILD_PLUGIN_FPEMON ACTS_BUILD_EXAMPLES)
0208 set_option_if(ACTS_BUILD_PLUGIN_JSON ACTS_BUILD_PLUGIN_TRACCC)
0209 set_option_if(ACTS_BUILD_PLUGIN_ACTSVG ACTS_BUILD_PLUGIN_TRACCC)
0210 set_option_if(ACTS_GNN_ENABLE_CUDA ACTS_GNN_ENABLE_MODULEMAP)
0211 set_option_if(ACTS_BUILD_PYTHON_BINDINGS ACTS_BUILD_PYTHON_WHEEL)
0212 set_option_if(ACTS_BUILD_ALIGNMENT ACTS_BUILD_PLUGIN_MILLE)
0213 
0214 # feature tests
0215 include(CheckCXXSourceCompiles)
0216 
0217 # We need to set the ORIGIN token based on the system we are compiling for
0218 if(APPLE)
0219     set(_acts_rpath_origin "@loader_path")
0220 else()
0221     set(_acts_rpath_origin "\$ORIGIN")
0222 endif()
0223 
0224 # Set flags dependent whether we build ACTS in the default configuration or for deployment in pip with scikit-build-core
0225 if(ACTS_BUILD_PYTHON_WHEEL)
0226     # Check if skbuild is running
0227     if("${SKBUILD}" STREQUAL "2")
0228         message(
0229             STATUS
0230             "Build with skbuild as ${SKBUILD_PROJECT_NAME},${SKBUILD_PROJECT_VERSION_FULL} (${SKBUILD_STATE})"
0231         )
0232     else()
0233         message(WARNING "scikit-build-core not detected for building wheel")
0234     endif()
0235 
0236     # Set installation paths for proper python package creation
0237     # CMAKE_PREFIX_PATH should be site-packages (steered by scikit-build-core)
0238     set(CMAKE_INSTALL_BINDIR ${SKBUILD_NULL_DIR}) # Don't install binaries/scripts
0239     set(CMAKE_INSTALL_LIBDIR "acts")
0240     set(CMAKE_INSTALL_INCLUDEDIR ${SKBUILD_NULL_DIR}) # Don't install headers
0241     set(CMAKE_INSTALL_DATAROOTDIR "acts/share")
0242     set(CMAKE_INSTALL_DATADIR "acts/share")
0243     set(CMAKE_INSTALL_RPATH "${_acts_rpath_origin}")
0244     set(_acts_python_install_dir "acts")
0245     set(_acts_python_modules_rpath "${_acts_rpath_origin}")
0246 elseif(PROJECT_IS_TOP_LEVEL)
0247     include(GNUInstallDirs)
0248     set(CMAKE_INSTALL_RPATH "${_acts_rpath_origin}/../${CMAKE_INSTALL_LIBDIR}")
0249     set(_acts_python_install_dir "python/acts")
0250     set(_acts_python_modules_rpath
0251         "${_acts_rpath_origin}/../../${CMAKE_INSTALL_LIBDIR}"
0252     )
0253 endif()
0254 
0255 include(ActsCompilerOptions) # default compile options
0256 include(ActsComponentsHelpers) # handle components via add_..._if commands
0257 include(ActsStaticAnalysis)
0258 
0259 acts_disable_static_analysis() # disable static analysis for thirdparty dependencies, will be enabled later for the main code
0260 
0261 if(PROJECT_IS_TOP_LEVEL)
0262     # place build products in `<build>/bin` and `<build>/lib` for simple use
0263     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
0264         "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}"
0265     )
0266     set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
0267         "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}"
0268     )
0269 endif()
0270 
0271 # This needs to happen before we set up any targets
0272 if(ACTS_FORCE_ASSERTIONS)
0273     message(
0274         STATUS
0275         "Injecting headers to force assertions. This can have side-effects, USE WITH CAUTION!"
0276     )
0277     include_directories(
0278         BEFORE
0279         SYSTEM
0280         ${CMAKE_CURRENT_SOURCE_DIR}/cmake/assert_include
0281     )
0282 endif()
0283 
0284 # minimal dependency versions. they are defined here in a single place so
0285 # they can be easily upgraded, although they might not be used if the
0286 # dependency is included via `add_subdirectory(...)`.
0287 set(_acts_actsvg_version 0.4.56)
0288 set(_acts_boost_version 1.78.0)
0289 set(_acts_dd4hep_version 1.26)
0290 set(_acts_geant4_version 11.1.3)
0291 set(_acts_edm4hep_version 1.0)
0292 set(_acts_edm4hep_fallback_version 0.10.5)
0293 set(_acts_eigen3_version 3.4.0)
0294 set(_acts_podio_version 1.0.1) # will try this first
0295 set(_acts_podio_fallback_version 0.17.4) # if not found, will try this one
0296 set(_acts_doxygen_version 1.9.4)
0297 set(_acts_hepmc3_version 3.2.4)
0298 set(_acts_nlohmanjson_version 3.11.3)
0299 set(_acts_mille_version 01.00.00)
0300 set(_acts_onnxruntime_version 1.12.0)
0301 set(_acts_geomodel_version 6.8.0)
0302 set(_acts_root_version 6.28.04) # first version with C++20 support
0303 set(_acts_tbb_version 2020.1)
0304 set(_acts_pythia8_version 8.310)
0305 set(_acts_pybind11_version 3.0.1)
0306 set(_acts_detray_version 1.0.1)
0307 set(_acts_traccc_version 1.2.0)
0308 set(_acts_covfie_version 0.15.2)
0309 set(_acts_vecmem_version 1.24.0)
0310 set(_acts_annoy_version 1.17.3)
0311 set(_acts_fastjet_version 3.4.1)
0312 
0313 # Help with compiler flags discovery
0314 include(ActsFunctions)
0315 
0316 # Include the sources for the external dependencies.
0317 include(ActsExternSources)
0318 
0319 # required packages
0320 if(ACTS_SETUP_BOOST)
0321     # Enable both program_options and unit_test_framework to reduce complexity
0322     # Also Cuda tests seem to use program_options
0323     if(
0324         ACTS_BUILD_ANALYSIS_APPS
0325         OR ACTS_BUILD_UNITTESTS
0326         OR ACTS_BUILD_INTEGRATIONTESTS
0327         OR ACTS_BUILD_BENCHMARKS
0328     )
0329         find_package(
0330             Boost
0331             ${_acts_boost_version}
0332             REQUIRED
0333             COMPONENTS program_options unit_test_framework
0334         )
0335     else()
0336         find_package(Boost ${_acts_boost_version} REQUIRED COMPONENTS)
0337     endif()
0338 
0339     if(Boost_VERSION VERSION_EQUAL "1.85.0")
0340         set(_boost_version_severity WARNING)
0341         if(ACTS_BUILD_EXAMPLES)
0342             set(_boost_version_severity FATAL_ERROR)
0343         endif()
0344         message(
0345             ${_boost_version_severity}
0346             "Boost 1.85.0 is known to be broken (https://github.com/boostorg/container/issues/273). Please use a different version."
0347         )
0348     endif()
0349 endif()
0350 
0351 if(ACTS_SETUP_EIGEN3)
0352     if(ACTS_USE_SYSTEM_EIGEN3)
0353         find_package(Eigen3 REQUIRED CONFIG)
0354 
0355         if(DEFINED Eigen3_VERSION)
0356             if(Eigen3_VERSION VERSION_LESS _acts_eigen3_version)
0357                 message(
0358                     FATAL_ERROR
0359                     "Eigen3 ${Eigen3_VERSION} is too old (need >= 3.4.0)"
0360                 )
0361             endif()
0362             if(Eigen3_VERSION VERSION_GREATER_EQUAL 6.0.0)
0363                 message(
0364                     FATAL_ERROR
0365                     "Eigen3 ${Eigen3_VERSION} is not supported (need < 6.0.0)"
0366                 )
0367             endif()
0368         else()
0369             message(
0370                 WARNING
0371                 "Eigen3 version unknown - cannot verify version requirements"
0372             )
0373         endif()
0374     else()
0375         add_subdirectory(thirdparty/eigen3)
0376     endif()
0377     # get the first include path so we can nicely print where we get eigen from
0378     get_target_property(
0379         _eigen3_include_dirs
0380         Eigen3::Eigen
0381         INTERFACE_INCLUDE_DIRECTORIES
0382     )
0383     if(_eigen3_include_dirs)
0384         list(GET _eigen3_include_dirs 0 _eigen3_first_include_dir)
0385     endif()
0386 
0387     message(
0388         STATUS
0389         "Found Eigen3 at: ${_eigen3_first_include_dir} (${Eigen3_VERSION})"
0390     )
0391 endif()
0392 
0393 # CUDA settings are collected here in a macro, so that they can be reused by different plugins
0394 macro(enable_cuda)
0395     enable_language(CUDA)
0396     set(CMAKE_CUDA_STANDARD 20 CACHE STRING "CUDA C++ standard to use")
0397     set(CMAKE_CUDA_STANDARD_REQUIRED
0398         ON
0399         CACHE BOOL
0400         "Force the C++ standard requirement"
0401     )
0402     if(NOT CMAKE_CUDA_ARCHITECTURES)
0403         set(CMAKE_CUDA_ARCHITECTURES
0404             "75;80;86;90"
0405             CACHE STRING
0406             "CUDA architectures to generate code for"
0407         )
0408     endif()
0409     set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G")
0410     set(CMAKE_CUDA_FLAGS
0411         "${CMAKE_CUDA_FLAGS} --extended-lambda --dopt=on --generate-line-info --expt-relaxed-constexpr"
0412     )
0413 endmacro()
0414 
0415 # optional packages
0416 #
0417 # find packages explicitly for each component even if this means searching for
0418 # the same package twice. This avoids having complex if/else trees to sort out
0419 # when a particular package is actually needed.
0420 if(ACTS_BUILD_PYTHON_BINDINGS)
0421     find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development.Module)
0422     if(ACTS_USE_SYSTEM_PYBIND11)
0423         find_package(pybind11 CONFIG REQUIRED)
0424     else()
0425         add_subdirectory(thirdparty/pybind11)
0426     endif()
0427 endif()
0428 if(ACTS_BUILD_PLUGIN_ACTSVG)
0429     if(ACTS_USE_SYSTEM_ACTSVG)
0430         find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG)
0431     else()
0432         add_subdirectory(thirdparty/actsvg)
0433     endif()
0434 endif()
0435 if(ACTS_BUILD_PLUGIN_DD4HEP)
0436     # Explicitly find python so we can more easily override the version
0437     find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development.Module)
0438     find_package(
0439         DD4hep
0440         ${_acts_dd4hep_version}
0441         REQUIRED
0442         CONFIG
0443         COMPONENTS DDCore DDDetectors
0444     )
0445 endif()
0446 if(ACTS_BUILD_PLUGIN_JSON)
0447     if(ACTS_USE_SYSTEM_NLOHMANN_JSON)
0448         find_package(nlohmann_json ${_acts_nlohmanjson_version} REQUIRED CONFIG)
0449     else()
0450         add_subdirectory(thirdparty/nlohmann_json)
0451     endif()
0452 endif()
0453 if(ACTS_BUILD_PLUGIN_MILLE)
0454     if(ACTS_USE_SYSTEM_MILLE)
0455         find_package(Mille ${_acts_mille_version} REQUIRED CONFIG)
0456     else()
0457         add_subdirectory(thirdparty/Mille)
0458     endif()
0459 endif()
0460 if(ACTS_BUILD_PLUGIN_GEOMODEL)
0461     find_package(GeoModelCore CONFIG)
0462     if(NOT GeoModelCore_FOUND)
0463         message(
0464             FATAL_ERROR
0465             "GeoModel not found. Please install GeoModel or set ACTS_BUILD_PLUGIN_GEOMODEL to OFF."
0466         )
0467     endif()
0468 
0469     if(GeoModelCore_VERSION VERSION_LESS _acts_geomodel_version)
0470         message(
0471             FATAL_ERROR
0472             "GeoModel version ${GeoModelCore_VERSION} is insufficient. Please install GeoModel version ${_acts_geomodel_version} or newer."
0473         )
0474     endif()
0475     # find other GeoModel components of EXACT same version
0476     find_package(GeoModelIO ${GeoModelCore_VERSION} REQUIRED EXACT CONFIG)
0477 endif()
0478 if(ACTS_BUILD_PLUGIN_ROOT)
0479     # In the ATLAS build, the ROOT find_package call does not find VDT unless these variables are set.
0480     # This should not affect other environments.
0481     find_package(VDT)
0482     if(VDT_FOUND)
0483         set(VDT_INCLUDE_DIR "${VDT_INCLUDE_DIR}" CACHE PATH "")
0484         set(VDT_LIBRARY "${VDT_vdt_LIBRARY}" CACHE FILEPATH "")
0485     endif()
0486 
0487     find_package(
0488         ROOT
0489         ${_acts_root_version}
0490         REQUIRED
0491         CONFIG
0492         COMPONENTS Geom Graf Tree RIO Hist
0493     )
0494 endif()
0495 if(ACTS_BUILD_ANALYSIS_APPS)
0496     find_package(
0497         ROOT
0498         ${_acts_root_version}
0499         REQUIRED
0500         CONFIG
0501         COMPONENTS Geom Graf
0502     )
0503 endif()
0504 if(ACTS_BUILD_PLUGIN_GNN)
0505     if(ACTS_GNN_ENABLE_CUDA)
0506         find_package(CUDAToolkit REQUIRED)
0507         enable_cuda()
0508         message(STATUS "Build GNN plugin with CUDA")
0509     else()
0510         message(STATUS "Build GNN plugin for CPU only")
0511     endif()
0512     if(ACTS_GNN_ENABLE_TORCH)
0513         find_package(Torch REQUIRED)
0514         if(ACTS_GNN_ENABLE_CUDA)
0515             add_subdirectory(thirdparty/FRNN)
0516         endif()
0517     endif()
0518     if(ACTS_GNN_ENABLE_MODULEMAP)
0519         if(ACTS_USE_SYSTEM_MODULEMAPGRAPH)
0520             find_package(ModuleMapGraph REQUIRED COMPONENTS CPU GPU)
0521         else()
0522             add_subdirectory(thirdparty/ModuleMapGraph)
0523         endif()
0524     endif()
0525 endif()
0526 if(ACTS_BUILD_PLUGIN_ONNX OR ACTS_GNN_ENABLE_ONNX)
0527     find_package(onnxruntime ${_acts_onnxruntime_version} MODULE REQUIRED)
0528 endif()
0529 if(ACTS_BUILD_PLUGIN_EDM4HEP)
0530     find_package(EDM4HEP ${_acts_edm4hep_version} CONFIG)
0531     if(NOT EDM4HEP_FOUND)
0532         message(
0533             STATUS
0534             "EDM4hep not found, trying version ${_acts_edm4hep_fallback_version}"
0535         )
0536         find_package(EDM4HEP ${_acts_edm4hep_fallback_version} CONFIG REQUIRED)
0537     endif()
0538     find_package(podio ${_acts_podio_version} CONFIG)
0539     if(NOT podio_FOUND)
0540         message(
0541             STATUS
0542             "Podio not found, trying ${_acts_podio_fallback_version} version"
0543         )
0544         find_package(podio ${_acts_podio_fallback_version} CONFIG REQUIRED)
0545     endif()
0546     find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core)
0547 endif()
0548 if(ACTS_BUILD_PLUGIN_GEANT4)
0549     find_package(Geant4 ${_acts_geant4_version} REQUIRED CONFIG COMPONENTS gdml)
0550 endif()
0551 
0552 if(ACTS_BUILD_PLUGIN_TRACCC)
0553     if(ACTS_SETUP_VECMEM)
0554         if(ACTS_USE_SYSTEM_VECMEM)
0555             find_package(vecmem ${_acts_vecmem_version} REQUIRED)
0556         else()
0557             add_subdirectory(thirdparty/vecmem)
0558             # Make the "VecMem language code" available for the whole project.
0559             include("${VECMEM_LANGUAGE_DIR}/vecmem-check-language.cmake")
0560         endif()
0561     endif()
0562 
0563     if(ACTS_SETUP_DETRAY)
0564         if(ACTS_USE_SYSTEM_DETRAY)
0565             find_package(detray ${_acts_detray_version} REQUIRED CONFIG)
0566         else()
0567             add_subdirectory(thirdparty/detray)
0568         endif()
0569     endif()
0570 
0571     if(ACTS_SETUP_COVFIE)
0572         if(ACTS_USE_SYSTEM_COVFIE)
0573             find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG)
0574         else()
0575             add_subdirectory(thirdparty/covfie)
0576         endif()
0577     endif()
0578 
0579     # traccc also depends on vecmem and covfie, but those plugins should always
0580     # be enabled if traccc is.
0581     if(ACTS_USE_SYSTEM_TRACCC)
0582         find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG)
0583     else()
0584         add_subdirectory(thirdparty/traccc)
0585     endif()
0586 endif()
0587 
0588 # examples dependencies
0589 if(ACTS_BUILD_EXAMPLES)
0590     set(THREADS_PREFER_PTHREAD_FLAG ON)
0591     find_package(Threads REQUIRED)
0592 
0593     set(_acts_hepmc3_components "search")
0594     if(ACTS_BUILD_EXAMPLES_ROOT)
0595         list(APPEND _acts_hepmc3_components "rootIO")
0596     endif()
0597 
0598     find_package(
0599         HepMC3
0600         ${_acts_hepmc3_version}
0601         REQUIRED
0602         CONFIG
0603         COMPONENTS ${_acts_hepmc3_components}
0604     )
0605 
0606     # HepMC3 only introduced a proper HepMC3::HepMC3 target in 3.2.6
0607     if(${HEPMC3_VERSION} VERSION_LESS 3.2.6)
0608         add_library(HepMC3::HepMC3 SHARED IMPORTED)
0609         set_property(
0610             TARGET HepMC3::HepMC3
0611             PROPERTY IMPORTED_LOCATION "${HEPMC3_LIB}"
0612         )
0613         target_include_directories(
0614             HepMC3::HepMC3
0615             INTERFACE "${HEPMC3_INCLUDE_DIR}"
0616         )
0617     endif()
0618     if(ACTS_BUILD_EXAMPLES_ROOT)
0619         # for simplicity always request all potentially required components.
0620         find_package(
0621             ROOT
0622             ${_acts_root_version}
0623             REQUIRED
0624             CONFIG
0625             COMPONENTS Core Geom Graf GenVector Hist Tree TreePlayer
0626         )
0627     endif()
0628     if(ACTS_BUILD_EXAMPLES_FASTJET)
0629         find_package(FastJet ${_acts_fastjet_version} REQUIRED)
0630     endif()
0631     if(ACTS_BUILD_EXAMPLES_DD4HEP AND ACTS_BUILD_EXAMPLES_GEANT4)
0632         find_package(
0633             DD4hep
0634             ${_acts_dd4hep_version}
0635             REQUIRED
0636             CONFIG
0637             COMPONENTS DDCore DDG4 DDDetectors
0638         )
0639     elseif(ACTS_BUILD_EXAMPLES_DD4HEP)
0640         find_package(
0641             DD4hep
0642             ${_acts_dd4hep_version}
0643             REQUIRED
0644             CONFIG
0645             COMPONENTS DDCore DDDetectors
0646         )
0647     endif()
0648     if(ACTS_BUILD_EXAMPLES_PYTHIA8)
0649         find_package(Pythia8 ${_acts_pythia8_version} REQUIRED)
0650     endif()
0651     if(ACTS_SETUP_ANNOY OR ACTS_BUILD_EXAMPLES_HASHING)
0652         add_subdirectory(thirdparty/Annoy)
0653     endif()
0654 endif()
0655 # other dependencies
0656 if(ACTS_BUILD_DOCS)
0657     find_package(Doxygen ${_acts_doxygen_version} REQUIRED)
0658 endif()
0659 
0660 acts_enable_static_analysis() # enable static analysis for the main code, after dependencies are set up
0661 
0662 # core library, core plugins, and other components
0663 add_component(Core Core)
0664 add_component_if(Fatras Fatras ACTS_BUILD_FATRAS)
0665 add_component_if(Alignment Alignment ACTS_BUILD_ALIGNMENT)
0666 add_subdirectory(Plugins)
0667 
0668 add_subdirectory_if(thirdparty/OpenDataDetector ACTS_BUILD_ODD)
0669 
0670 # Examples
0671 add_subdirectory_if(Examples ACTS_BUILD_EXAMPLES)
0672 
0673 # Python bindings
0674 add_subdirectory_if(Python ACTS_BUILD_PYTHON_BINDINGS)
0675 
0676 # automated tests and benchmarks
0677 if(ACTS_BUILD_BENCHMARKS OR ACTS_BUILD_INTEGRATIONTESTS OR ACTS_BUILD_UNITTESTS)
0678     enable_testing() # must be set in the main CMakeLists.txt
0679     add_subdirectory(Tests)
0680 endif()
0681 
0682 # documentation, adding unconditionally but will only set up docs build if configured
0683 add_subdirectory(docs)
0684 
0685 # create cmake configuration files and environment setup script
0686 include(ActsCreatePackageConfig)
0687 include(ActsCreateSetup)