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_ALGEBRAPLUGINS "Use a system-provided algebra-plugins installation" ${ACTS_USE_SYSTEM_LIBS})
0066 option(ACTS_SETUP_ALGEBRAPLUGINS "If we want to set up 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 set up 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 set up 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 set up 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 option(ACTS_USE_SYSTEM_MILLE "Use a system-provided Mille" ON)
0079 
0080 option(ACTS_BUILD_PLUGIN_ACTSVG "Build SVG display plugin" OFF)
0081 option(ACTS_BUILD_PLUGIN_DD4HEP "Build DD4hep 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_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_GNN "Build the GNN plugin" OFF)
0088 option(ACTS_GNN_ENABLE_ONNX "Build the Onnx backend for the gnn plugin" OFF)
0089 option(ACTS_GNN_ENABLE_TORCH "Build the torchscript backend for the gnn plugin" ON)
0090 option(ACTS_GNN_ENABLE_CUDA "Enable CUDA for the gnn plugin" OFF)
0091 option(ACTS_GNN_ENABLE_MODULEMAP "Enable Module-Map-based graph construction" OFF)
0092 option(ACTS_GNN_ENABLE_TENSORRT "Enable the native TensorRT inference modules" OFF)
0093 option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF)
0094 option(ACTS_BUILD_PLUGIN_MILLE "Build Mille 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 # python related options
0099 option(ACTS_BUILD_PYTHON_WHEEL "Settings to build for python deployment with scikit-build-core" OFF)
0100 option(ACTS_BUILD_PYTHON_BINDINGS "Build python bindings for all enabled components" OFF)
0101 # fatras related options
0102 option(ACTS_BUILD_FATRAS "Build FAst TRAcking Simulation package" OFF)
0103 option(ACTS_BUILD_FATRAS_GEANT4 "Build Geant4 Fatras package" OFF)
0104 # alignment related options
0105 option(ACTS_BUILD_ALIGNMENT "Build Alignment package" OFF)
0106 # examples related options
0107 option(ACTS_BUILD_EXAMPLES "Build basic examples components" OFF)
0108 option(ACTS_BUILD_EXAMPLES_DD4HEP "Build DD4hep-based code in the examples" OFF)
0109 option(ACTS_BUILD_EXAMPLES_EDM4HEP "Build EDM4hep-based code in the examples" OFF)
0110 option(ACTS_BUILD_EXAMPLES_FASTJET "Build FastJet plugin" OFF)
0111 option(ACTS_BUILD_EXAMPLES_GEANT4 "Build Geant4-based code in the examples" OFF)
0112 option(ACTS_BUILD_EXAMPLES_GNN "Build the GNN example code" OFF)
0113 option(ACTS_BUILD_EXAMPLES_HASHING "Build Hashing-based code in the examples" OFF)
0114 option(ACTS_BUILD_EXAMPLES_PODIO "Build Podio-based code in the examples" OFF)
0115 option(ACTS_BUILD_EXAMPLES_PYTHIA8 "Build Pythia8-based code in the examples" OFF)
0116 option(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS "[Deprecated] Build python bindings and enables the examples" OFF)
0117 option(ACTS_BUILD_EXAMPLES_ROOT "Build modules based on ROOT I/O" OFF)
0118 option(ACTS_BUILD_ANALYSIS_APPS "Build Analysis applications in the examples" OFF)
0119 # test related options
0120 option(ACTS_BUILD_BENCHMARKS "Build benchmarks" OFF)
0121 option(ACTS_BUILD_INTEGRATIONTESTS "Build integration tests" OFF)
0122 option(ACTS_BUILD_UNITTESTS "Build unit tests" OFF)
0123 if(ACTS_BUILD_UNITTESTS AND ACTS_BUILD_EXAMPLES)
0124   set(_default_examples_unit_tests ON)
0125 else()
0126   set(_default_examples_unit_tests OFF)
0127 endif()
0128 option(ACTS_BUILD_EXAMPLES_UNITTESTS "Build unit tests" ${_default_examples_unit_tests}) # default: ACTS_BUILD_UNITTESTS AND ACTS_BUILD_EXAMPLES
0129 option(ACTS_RUN_CLANG_TIDY "Run clang-tidy static analysis" OFF)
0130 # other options
0131 option(ACTS_BUILD_DOCS "Build documentation" OFF)
0132 option(ACTS_SETUP_BOOST "Explicitly set up Boost for the project" ON)
0133 option(ACTS_SETUP_EIGEN3 "Explicitly set up Eigen3 for the project" ON)
0134 option(ACTS_BUILD_ODD "Build the OpenDataDetector" OFF)
0135 # profiling related options
0136 option(ACTS_ENABLE_CPU_PROFILING "Enable CPU profiling using gperftools" OFF)
0137 option(ACTS_ENABLE_MEMORY_PROFILING "Enable memory profiling using gperftools" OFF)
0138 set(ACTS_GPERF_INSTALL_DIR "" CACHE STRING "Hint to help find gperf if profiling is enabled")
0139 
0140 option(ACTS_ENABLE_LOG_FAILURE_THRESHOLD "Enable failing on log messages with level above certain threshold" OFF)
0141 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.")
0142 option(ACTS_COMPILE_HEADERS "Generate targets to compile header files" ON)
0143 # gersemi: on
0144 
0145 # handle option inter-dependencies and the everything flag
0146 # NOTE: ordering is important here. dependencies must come before dependees
0147 include(ActsOptionHelpers)
0148 
0149 # Preserve previous behaviour of ACTS_BUILD_PYTHON_BINDINGS but mark as deprecated
0150 if(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS)
0151     message(
0152         DEPRECATION
0153         "ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS is deprecated. Enable ACTS_BUILD_EXAMPLES and ACTS_BUILD_PYTHON_BINDINGS to achieve the same effect."
0154     )
0155     set(ACTS_BUILD_PYTHON_BINDINGS ON)
0156 endif()
0157 # any examples component activates the general examples option
0158 set_option_if(
0159     ACTS_BUILD_EXAMPLES
0160     ACTS_BUILD_EXAMPLES_DD4HEP
0161     OR
0162     ACTS_BUILD_EXAMPLES_EDM4HEP
0163     OR
0164     ACTS_BUILD_EXAMPLES_FASTJET
0165     OR
0166     ACTS_BUILD_EXAMPLES_GEANT4
0167     OR
0168     ACTS_BUILD_EXAMPLES_GNN
0169     OR
0170     ACTS_BUILD_EXAMPLES_HASHING
0171     OR
0172     ACTS_BUILD_EXAMPLES_PODIO
0173     OR
0174     ACTS_BUILD_EXAMPLES_PYTHIA8
0175     OR
0176     ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS
0177     OR
0178     ACTS_BUILD_EXAMPLES_ROOT
0179 )
0180 # core plugins might be required by examples or depend on each other
0181 set_option_if(
0182     ACTS_BUILD_PLUGIN_DD4HEP
0183     ACTS_BUILD_EXAMPLES_DD4HEP
0184     OR
0185     ACTS_BUILD_EXAMPLES_EDM4HEP
0186 )
0187 set_option_if(ACTS_BUILD_PLUGIN_EDM4HEP ACTS_BUILD_EXAMPLES_EDM4HEP)
0188 set_option_if(ACTS_BUILD_EXAMPLES_PODIO ACTS_BUILD_EXAMPLES_EDM4HEP)
0189 set_option_if(ACTS_BUILD_PLUGIN_GEANT4 ACTS_BUILD_EXAMPLES_GEANT4)
0190 set_option_if(
0191     ACTS_BUILD_PLUGIN_ROOT
0192     ACTS_BUILD_EXAMPLES_ROOT
0193     OR
0194     ACTS_BUILD_PLUGIN_DD4HEP
0195 )
0196 set_option_if(
0197     ACTS_BUILD_PLUGIN_IDENTIFICATION
0198     ACTS_BUILD_PLUGIN_ROOT
0199     OR
0200     ACTS_BUILD_PLUGIN_EDM4HEP
0201     OR
0202     ACTS_BUILD_EXAMPLES
0203 )
0204 set_option_if(ACTS_BUILD_PLUGIN_JSON ACTS_BUILD_EXAMPLES)
0205 set_option_if(ACTS_BUILD_FATRAS ACTS_BUILD_EXAMPLES)
0206 set_option_if(ACTS_BUILD_FATRAS ACTS_BUILD_EXAMPLES_FASTJET)
0207 set_option_if(ACTS_BUILD_PLUGIN_GNN ACTS_BUILD_EXAMPLES_GNN)
0208 set_option_if(ACTS_BUILD_PLUGIN_FPEMON ACTS_BUILD_EXAMPLES)
0209 set_option_if(ACTS_BUILD_PLUGIN_JSON ACTS_BUILD_PLUGIN_TRACCC)
0210 set_option_if(ACTS_BUILD_PLUGIN_ACTSVG ACTS_BUILD_PLUGIN_TRACCC)
0211 set_option_if(ACTS_GNN_ENABLE_CUDA ACTS_GNN_ENABLE_MODULEMAP)
0212 set_option_if(ACTS_BUILD_PYTHON_BINDINGS ACTS_BUILD_PYTHON_WHEEL)
0213 set_option_if(ACTS_BUILD_ALIGNMENT ACTS_BUILD_PLUGIN_MILLE)
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 0.103.0)
0307 set(_acts_traccc_version 0.26.1)
0308 set(_acts_covfie_version 0.15.2)
0309 set(_acts_vecmem_version 1.21.0)
0310 set(_acts_algebraplugins_version 0.28.0)
0311 set(_acts_annoy_version 1.17.3)
0312 set(_acts_fastjet_version 3.4.1)
0313 
0314 # Help with compiler flags discovery
0315 include(ActsFunctions)
0316 
0317 # Include the sources for the external dependencies.
0318 include(ActsExternSources)
0319 
0320 # required packages
0321 if(ACTS_SETUP_BOOST)
0322     # Enable both program_options and unit_test_framework to reduce complexity
0323     # Also Cuda tests seem to use program_options
0324     if(
0325         ACTS_BUILD_ANALYSIS_APPS
0326         OR ACTS_BUILD_UNITTESTS
0327         OR ACTS_BUILD_INTEGRATIONTESTS
0328         OR ACTS_BUILD_BENCHMARKS
0329     )
0330         find_package(
0331             Boost
0332             ${_acts_boost_version}
0333             REQUIRED
0334             COMPONENTS program_options unit_test_framework
0335         )
0336     else()
0337         find_package(Boost ${_acts_boost_version} REQUIRED COMPONENTS)
0338     endif()
0339 
0340     if(Boost_VERSION VERSION_EQUAL "1.85.0")
0341         set(_boost_version_severity WARNING)
0342         if(ACTS_BUILD_EXAMPLES)
0343             set(_boost_version_severity FATAL_ERROR)
0344         endif()
0345         message(
0346             ${_boost_version_severity}
0347             "Boost 1.85.0 is known to be broken (https://github.com/boostorg/container/issues/273). Please use a different version."
0348         )
0349     endif()
0350 endif()
0351 
0352 if(ACTS_SETUP_EIGEN3)
0353     if(ACTS_USE_SYSTEM_EIGEN3)
0354         find_package(Eigen3 REQUIRED CONFIG)
0355 
0356         if(DEFINED Eigen3_VERSION)
0357             if(Eigen3_VERSION VERSION_LESS _acts_eigen3_version)
0358                 message(
0359                     FATAL_ERROR
0360                     "Eigen3 ${Eigen3_VERSION} is too old (need >= 3.4.0)"
0361                 )
0362             endif()
0363             if(Eigen3_VERSION VERSION_GREATER_EQUAL 6.0.0)
0364                 message(
0365                     FATAL_ERROR
0366                     "Eigen3 ${Eigen3_VERSION} is not supported (need < 6.0.0)"
0367                 )
0368             endif()
0369         else()
0370             message(
0371                 WARNING
0372                 "Eigen3 version unknown - cannot verify version requirements"
0373             )
0374         endif()
0375     else()
0376         add_subdirectory(thirdparty/eigen3)
0377     endif()
0378     # get the first include path so we can nicely print where we get eigen from
0379     get_target_property(
0380         _eigen3_include_dirs
0381         Eigen3::Eigen
0382         INTERFACE_INCLUDE_DIRECTORIES
0383     )
0384     if(_eigen3_include_dirs)
0385         list(GET _eigen3_include_dirs 0 _eigen3_first_include_dir)
0386     endif()
0387 
0388     message(
0389         STATUS
0390         "Found Eigen3 at: ${_eigen3_first_include_dir} (${Eigen3_VERSION})"
0391     )
0392 endif()
0393 
0394 # CUDA settings are collected here in a macro, so that they can be reused by different plugins
0395 macro(enable_cuda)
0396     enable_language(CUDA)
0397     set(CMAKE_CUDA_STANDARD 14 CACHE STRING "CUDA C++ standard to use")
0398     set(CMAKE_CUDA_STANDARD_REQUIRED
0399         ON
0400         CACHE BOOL
0401         "Force the C++ standard requirement"
0402     )
0403     if(NOT CMAKE_CUDA_ARCHITECTURES)
0404         set(CMAKE_CUDA_ARCHITECTURES
0405             "35;52;75"
0406             CACHE STRING
0407             "CUDA architectures to generate code for"
0408         )
0409     endif()
0410     set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G")
0411     set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda")
0412 endmacro()
0413 
0414 # optional packages
0415 #
0416 # find packages explicitly for each component even if this means searching for
0417 # the same package twice. This avoids having complex if/else trees to sort out
0418 # when a particular package is actually needed.
0419 if(ACTS_BUILD_PYTHON_BINDINGS)
0420     find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development.Module)
0421     if(ACTS_USE_SYSTEM_PYBIND11)
0422         find_package(pybind11 CONFIG REQUIRED)
0423     else()
0424         add_subdirectory(thirdparty/pybind11)
0425     endif()
0426 endif()
0427 if(ACTS_BUILD_PLUGIN_ACTSVG)
0428     if(ACTS_USE_SYSTEM_ACTSVG)
0429         find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG)
0430     else()
0431         add_subdirectory(thirdparty/actsvg)
0432     endif()
0433 endif()
0434 if(ACTS_BUILD_PLUGIN_DD4HEP)
0435     # Explicitly find python so we can more easily override the version
0436     find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development.Module)
0437     find_package(
0438         DD4hep
0439         ${_acts_dd4hep_version}
0440         REQUIRED
0441         CONFIG
0442         COMPONENTS DDCore DDDetectors
0443     )
0444 endif()
0445 if(ACTS_BUILD_PLUGIN_JSON)
0446     if(ACTS_USE_SYSTEM_NLOHMANN_JSON)
0447         find_package(nlohmann_json ${_acts_nlohmanjson_version} REQUIRED CONFIG)
0448     else()
0449         add_subdirectory(thirdparty/nlohmann_json)
0450     endif()
0451 endif()
0452 if(ACTS_BUILD_PLUGIN_MILLE)
0453     if(ACTS_USE_SYSTEM_MILLE)
0454         find_package(Mille ${_acts_mille_version} REQUIRED CONFIG)
0455     else()
0456         add_subdirectory(thirdparty/Mille)
0457     endif()
0458 endif()
0459 if(ACTS_BUILD_PLUGIN_GEOMODEL)
0460     find_package(GeoModelCore CONFIG)
0461     if(NOT GeoModelCore_FOUND)
0462         message(
0463             FATAL_ERROR
0464             "GeoModel not found. Please install GeoModel or set ACTS_BUILD_PLUGIN_GEOMODEL to OFF."
0465         )
0466     endif()
0467 
0468     if(GeoModelCore_VERSION VERSION_LESS _acts_geomodel_version)
0469         message(
0470             FATAL_ERROR
0471             "GeoModel version ${GeoModelCore_VERSION} is insufficient. Please install GeoModel version ${_acts_geomodel_version} or newer."
0472         )
0473     endif()
0474     # find other GeoModel components of EXACT same version
0475     find_package(GeoModelIO ${GeoModelCore_VERSION} REQUIRED EXACT CONFIG)
0476 endif()
0477 if(ACTS_BUILD_PLUGIN_ROOT)
0478     # In the ATLAS build, the ROOT find_package call does not find VDT unless these variables are set.
0479     # This should not affect other environments.
0480     find_package(VDT)
0481     if(VDT_FOUND)
0482         set(VDT_INCLUDE_DIR "${VDT_INCLUDE_DIR}" CACHE PATH "")
0483         set(VDT_LIBRARY "${VDT_vdt_LIBRARY}" CACHE FILEPATH "")
0484     endif()
0485 
0486     find_package(
0487         ROOT
0488         ${_acts_root_version}
0489         REQUIRED
0490         CONFIG
0491         COMPONENTS Geom Graf Tree RIO Hist
0492     )
0493 endif()
0494 if(ACTS_BUILD_ANALYSIS_APPS)
0495     find_package(
0496         ROOT
0497         ${_acts_root_version}
0498         REQUIRED
0499         CONFIG
0500         COMPONENTS Geom Graf
0501     )
0502 endif()
0503 if(ACTS_BUILD_PLUGIN_GNN)
0504     if(ACTS_GNN_ENABLE_CUDA)
0505         find_package(CUDAToolkit REQUIRED)
0506         enable_cuda()
0507         message(STATUS "Build GNN plugin with CUDA")
0508     else()
0509         message(STATUS "Build GNN plugin for CPU only")
0510     endif()
0511     if(ACTS_GNN_ENABLE_TORCH)
0512         find_package(Torch REQUIRED)
0513         if(ACTS_GNN_ENABLE_CUDA)
0514             add_subdirectory(thirdparty/FRNN)
0515         endif()
0516     endif()
0517     if(ACTS_GNN_ENABLE_MODULEMAP)
0518         if(ACTS_USE_SYSTEM_MODULEMAPGRAPH)
0519             find_package(ModuleMapGraph REQUIRED COMPONENTS CPU GPU)
0520         else()
0521             add_subdirectory(thirdparty/ModuleMapGraph)
0522         endif()
0523     endif()
0524 endif()
0525 if(ACTS_BUILD_PLUGIN_ONNX OR ACTS_GNN_ENABLE_ONNX)
0526     find_package(onnxruntime ${_acts_onnxruntime_version} MODULE REQUIRED)
0527 endif()
0528 if(ACTS_BUILD_PLUGIN_EDM4HEP)
0529     find_package(EDM4HEP ${_acts_edm4hep_version} CONFIG)
0530     if(NOT EDM4HEP_FOUND)
0531         message(
0532             STATUS
0533             "EDM4hep not found, trying version ${_acts_edm4hep_fallback_version}"
0534         )
0535         find_package(EDM4HEP ${_acts_edm4hep_fallback_version} CONFIG REQUIRED)
0536     endif()
0537     find_package(podio ${_acts_podio_version} CONFIG)
0538     if(NOT podio_FOUND)
0539         message(
0540             STATUS
0541             "Podio not found, trying ${_acts_podio_fallback_version} version"
0542         )
0543         find_package(podio ${_acts_podio_fallback_version} CONFIG REQUIRED)
0544     endif()
0545     find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core)
0546 endif()
0547 if(ACTS_BUILD_PLUGIN_GEANT4)
0548     find_package(Geant4 ${_acts_geant4_version} REQUIRED CONFIG COMPONENTS gdml)
0549 endif()
0550 
0551 if(ACTS_BUILD_PLUGIN_TRACCC)
0552     if(ACTS_SETUP_VECMEM)
0553         if(ACTS_USE_SYSTEM_VECMEM)
0554             find_package(vecmem ${_acts_vecmem_version} REQUIRED)
0555         else()
0556             add_subdirectory(thirdparty/vecmem)
0557             # Make the "VecMem language code" available for the whole project.
0558             include("${VECMEM_LANGUAGE_DIR}/vecmem-check-language.cmake")
0559         endif()
0560     endif()
0561 
0562     if(ACTS_SETUP_ALGEBRAPLUGINS)
0563         if(ACTS_USE_SYSTEM_ALGEBRAPLUGINS)
0564             find_package(
0565                 algebra-plugins
0566                 ${_acts_algebraplugins_version}
0567                 REQUIRED
0568             )
0569         else()
0570             add_subdirectory(thirdparty/algebra-plugins)
0571         endif()
0572     endif()
0573 
0574     if(ACTS_SETUP_DETRAY)
0575         if(ACTS_USE_SYSTEM_DETRAY)
0576             find_package(detray ${_acts_detray_version} REQUIRED CONFIG)
0577         else()
0578             add_subdirectory(thirdparty/detray)
0579         endif()
0580     endif()
0581 
0582     if(ACTS_SETUP_COVFIE)
0583         if(ACTS_USE_SYSTEM_COVFIE)
0584             find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG)
0585         else()
0586             add_subdirectory(thirdparty/covfie)
0587         endif()
0588     endif()
0589 
0590     # traccc also depends on vecmem and covfie, but those plugins should always
0591     # be enabled if traccc is.
0592     if(ACTS_USE_SYSTEM_TRACCC)
0593         find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG)
0594     else()
0595         add_subdirectory(thirdparty/traccc)
0596     endif()
0597 endif()
0598 
0599 # examples dependencies
0600 if(ACTS_BUILD_EXAMPLES)
0601     set(THREADS_PREFER_PTHREAD_FLAG ON)
0602     find_package(Threads REQUIRED)
0603 
0604     set(_acts_hepmc3_components "search")
0605     if(ACTS_BUILD_EXAMPLES_ROOT)
0606         list(APPEND _acts_hepmc3_components "rootIO")
0607     endif()
0608 
0609     find_package(
0610         HepMC3
0611         ${_acts_hepmc3_version}
0612         REQUIRED
0613         CONFIG
0614         COMPONENTS ${_acts_hepmc3_components}
0615     )
0616 
0617     # HepMC3 only introduced a proper HepMC3::HepMC3 target in 3.2.6
0618     if(${HEPMC3_VERSION} VERSION_LESS 3.2.6)
0619         add_library(HepMC3::HepMC3 SHARED IMPORTED)
0620         set_property(
0621             TARGET HepMC3::HepMC3
0622             PROPERTY IMPORTED_LOCATION "${HEPMC3_LIB}"
0623         )
0624         target_include_directories(
0625             HepMC3::HepMC3
0626             INTERFACE "${HEPMC3_INCLUDE_DIR}"
0627         )
0628     endif()
0629     if(ACTS_BUILD_EXAMPLES_ROOT)
0630         # for simplicity always request all potentially required components.
0631         find_package(
0632             ROOT
0633             ${_acts_root_version}
0634             REQUIRED
0635             CONFIG
0636             COMPONENTS Core Geom Graf GenVector Hist Tree TreePlayer
0637         )
0638     endif()
0639     if(ACTS_BUILD_EXAMPLES_FASTJET)
0640         find_package(FastJet ${_acts_fastjet_version} REQUIRED)
0641     endif()
0642     if(ACTS_BUILD_EXAMPLES_DD4HEP AND ACTS_BUILD_EXAMPLES_GEANT4)
0643         find_package(
0644             DD4hep
0645             ${_acts_dd4hep_version}
0646             REQUIRED
0647             CONFIG
0648             COMPONENTS DDCore DDG4 DDDetectors
0649         )
0650     elseif(ACTS_BUILD_EXAMPLES_DD4HEP)
0651         find_package(
0652             DD4hep
0653             ${_acts_dd4hep_version}
0654             REQUIRED
0655             CONFIG
0656             COMPONENTS DDCore DDDetectors
0657         )
0658     endif()
0659     if(ACTS_BUILD_EXAMPLES_PYTHIA8)
0660         find_package(Pythia8 ${_acts_pythia8_version} REQUIRED)
0661     endif()
0662     if(ACTS_SETUP_ANNOY OR ACTS_BUILD_EXAMPLES_HASHING)
0663         add_subdirectory(thirdparty/Annoy)
0664     endif()
0665 endif()
0666 # other dependencies
0667 if(ACTS_BUILD_DOCS)
0668     find_package(Doxygen ${_acts_doxygen_version} REQUIRED)
0669 endif()
0670 
0671 acts_enable_static_analysis() # enable static analysis for the main code, after dependencies are set up
0672 
0673 # core library, core plugins, and other components
0674 add_component(Core Core)
0675 add_component_if(Fatras Fatras ACTS_BUILD_FATRAS)
0676 add_component_if(Alignment Alignment ACTS_BUILD_ALIGNMENT)
0677 add_subdirectory(Plugins)
0678 
0679 add_subdirectory_if(thirdparty/OpenDataDetector ACTS_BUILD_ODD)
0680 
0681 # Examples
0682 add_subdirectory_if(Examples ACTS_BUILD_EXAMPLES)
0683 
0684 # Python bindings
0685 add_subdirectory_if(Python ACTS_BUILD_PYTHON_BINDINGS)
0686 
0687 # automated tests and benchmarks
0688 if(ACTS_BUILD_BENCHMARKS OR ACTS_BUILD_INTEGRATIONTESTS OR ACTS_BUILD_UNITTESTS)
0689     enable_testing() # must be set in the main CMakeLists.txt
0690     add_subdirectory(Tests)
0691 endif()
0692 
0693 # documentation, adding unconditionally but will only set up docs build if configured
0694 add_subdirectory(docs)
0695 
0696 # create cmake configuration files and environment setup script
0697 include(ActsCreatePackageConfig)
0698 include(ActsCreateSetup)