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.19)
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 # code generation related options
0061 set(ACTS_CODEGEN_PREBUILT_DIR "" CACHE PATH "Directory holding pre-generated code; a generated file found there is used verbatim instead of being regenerated. Defaults to prebuilt-codegen/ next to this file when it exists, which is what release source archives ship")
0062 option(ACTS_CODEGEN_REQUIRE_PREBUILT "Fail the configure step instead of running the code generators when pre-generated code is missing" OFF)
0063 # external library options
0064 set(ACTS_USE_ZSTD "AUTO" CACHE STRING "zstd support: AUTO (use if available), ALWAYS (required), NEVER (disabled)")
0065 set_property(CACHE ACTS_USE_ZSTD PROPERTY STRINGS AUTO ALWAYS NEVER)
0066 if(NOT ACTS_USE_ZSTD MATCHES "^(AUTO|ALWAYS|NEVER)$")
0067     message(FATAL_ERROR "ACTS_USE_ZSTD must be AUTO, ALWAYS, or NEVER (got '${ACTS_USE_ZSTD}')")
0068 endif()
0069 option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
0070 option(ACTS_USE_SYSTEM_LIBS "Use system libraries by default" OFF)
0071 # plugins related options
0072 option(ACTS_USE_SYSTEM_ACTSVG "Use the ActSVG system library" ${ACTS_USE_SYSTEM_LIBS})
0073 option(ACTS_USE_SYSTEM_COVFIE "Use a system-provided covfie installation" ${ACTS_USE_SYSTEM_LIBS})
0074 option(ACTS_SETUP_COVFIE "If we want to set up covfie" OFF)
0075 option(ACTS_SETUP_DETRAY "If we want to set up detray" OFF)
0076 option(ACTS_USE_SYSTEM_VECMEM "Use a system-provided vecmem installation" ${ACTS_USE_SYSTEM_LIBS})
0077 option(ACTS_SETUP_VECMEM "If we want to set up vecmem" OFF)
0078 option(ACTS_USE_SYSTEM_TRACCC "Use a system-provided traccc installation" ${ACTS_USE_SYSTEM_LIBS})
0079 option(ACTS_USE_SYSTEM_NLOHMANN_JSON "Use nlohmann::json provided by the system instead of the bundled version" ${ACTS_USE_SYSTEM_LIBS})
0080 option(ACTS_USE_SYSTEM_PYBIND11 "Use a system installation of pybind11" ${ACTS_USE_SYSTEM_LIBS} )
0081 option(ACTS_USE_SYSTEM_MODULEMAPGRAPH "Use a system installation of ModuleMapGraph" ${ACTS_USE_SYSTEM_LIBS})
0082 option(ACTS_USE_SYSTEM_EIGEN3 "Use a system-provided eigen3" ON)
0083 option(ACTS_USE_SYSTEM_GBL "Use a system-provided General Broken Lines (GBL) from Mille" OFF)
0084 option(ACTS_USE_SYSTEM_MILLE "Use a system-provided Mille" ${ACTS_USE_SYSTEM_LIBS})
0085 option(ACTS_USE_SYSTEM_MP2 "Use a system-provided Millepede-2" ${ACTS_USE_SYSTEM_LIBS})
0086 
0087 option(ACTS_BUILD_PLUGIN_ACTSVG "Build SVG display plugin" OFF)
0088 option(ACTS_BUILD_PLUGIN_ARROW "Build Apache Arrow/Parquet plugin" OFF)
0089 option(ACTS_ARROW_ISOLATED
0090     "Statically link arrow/parquet into libActsPluginArrow and hide their \
0091 symbols, so they cannot collide with other arrow consumers in the same \
0092 process (e.g. pyarrow's bundled libarrow). Disable only if your arrow \
0093 install is ABI-compatible with every other arrow consumer that will be \
0094 loaded alongside ACTS."
0095     ON
0096 )
0097 option(ACTS_BUILD_PLUGIN_DD4HEP "Build DD4hep plugin" OFF)
0098 option(ACTS_BUILD_PLUGIN_EDM4HEP "Build EDM4hep plugin" OFF)
0099 option(ACTS_BUILD_PLUGIN_FPEMON "Build FPE monitoring plugin" OFF)
0100 option(ACTS_BUILD_PLUGIN_GEOMODEL "Build GeoModel plugin" OFF)
0101 option(ACTS_BUILD_PLUGIN_TRACCC "Build Traccc plugin" OFF)
0102 option(ACTS_ENABLE_CUDA "Enable CUDA for the gnn/Traccc/CudaMuonSegmentFitting plugins" OFF)
0103 option(ACTS_BUILD_PLUGIN_GEANT4 "Build Geant4 plugin" OFF)
0104 option(ACTS_BUILD_PLUGIN_GNN "Build the GNN plugin" OFF)
0105 option(ACTS_GNN_ENABLE_ONNX "Build the Onnx backend for the gnn plugin" OFF)
0106 option(ACTS_GNN_ENABLE_TORCH "Build the torchscript backend for the gnn plugin" ON)
0107 option(ACTS_GNN_ENABLE_MODULEMAP "Enable Module-Map-based graph construction" OFF)
0108 option(ACTS_GNN_ENABLE_TENSORRT "Enable the native TensorRT inference modules" OFF)
0109 option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF)
0110 option(ACTS_BUILD_PLUGIN_GBL "Build General Broken Lines (GBL) plugin from Mille" OFF)
0111 option(ACTS_BUILD_PLUGIN_MILLE "Build Mille plugin" OFF)
0112 option(ACTS_BUILD_PLUGIN_ONNX "Build ONNX plugin" OFF)
0113 option(ACTS_BUILD_PLUGIN_ROOT "Build ROOT plugin" OFF)
0114 option(ACTS_SETUP_ANNOY "Explicitly set up Annoy for the project" OFF)
0115 # python related options
0116 option(ACTS_BUILD_PYTHON_WHEEL "Settings to build for python deployment with scikit-build-core" OFF)
0117 option(ACTS_BUILD_PYTHON_BINDINGS "Build python bindings for all enabled components" OFF)
0118 option(ACTS_GENERATE_PYTHON_STUBS "Generate Python stub files (.pyi) using pybind11-stubgen via uv" OFF)
0119 # fatras related options
0120 option(ACTS_BUILD_FATRAS "Build FAst TRAcking Simulation package" OFF)
0121 option(ACTS_BUILD_FATRAS_GEANT4 "Build Geant4 Fatras package" OFF)
0122 # alignment related options
0123 option(ACTS_BUILD_ALIGNMENT "Build Alignment package" OFF)
0124 # traccc related options
0125 option(ACTS_BUILD_TRACCC "Build traccc GPU tracking package" OFF)
0126 # examples related options
0127 option(ACTS_BUILD_EXAMPLES "Build basic examples components" OFF)
0128 option(ACTS_BUILD_EXAMPLES_DD4HEP "Build DD4hep-based code in the examples" OFF)
0129 option(ACTS_BUILD_EXAMPLES_EDM4HEP "Build EDM4hep-based code in the examples" OFF)
0130 option(ACTS_BUILD_EXAMPLES_FASTJET "Build FastJet plugin" OFF)
0131 option(ACTS_BUILD_EXAMPLES_GEANT4 "Build Geant4-based code in the examples" OFF)
0132 option(ACTS_BUILD_EXAMPLES_GNN "Build the GNN example code" OFF)
0133 option(ACTS_BUILD_EXAMPLES_HASHING "Build Hashing-based code in the examples" OFF)
0134 option(ACTS_BUILD_EXAMPLES_PARQUET "Build Arrow/Parquet-based code in the examples" OFF)
0135 option(ACTS_BUILD_EXAMPLES_PODIO "Build Podio-based code in the examples" OFF)
0136 option(ACTS_BUILD_EXAMPLES_PYTHIA8 "Build Pythia8-based code in the examples" OFF)
0137 option(ACTS_BUILD_EXAMPLES_ROOT "Build modules based on ROOT I/O" OFF)
0138 option(ACTS_BUILD_EXAMPLES_CUDA_MUON_SEGMENT_FITTING "Build CUDA muon segment fitting example" OFF)
0139 option(ACTS_BUILD_ANALYSIS_APPS "Build Analysis applications in the examples" OFF)
0140 # test related options
0141 option(ACTS_BUILD_BENCHMARKS "Build benchmarks" OFF)
0142 option(ACTS_BUILD_INTEGRATIONTESTS "Build integration tests" OFF)
0143 option(ACTS_BUILD_UNITTESTS "Build unit tests" OFF)
0144 option(ACTS_BUILD_CORE_UNITTESTS "Build Core unit tests" ON) # only relevant if ACTS_BUILD_UNITTESTS is ON
0145 if(ACTS_BUILD_UNITTESTS AND ACTS_BUILD_EXAMPLES)
0146   set(_default_examples_unit_tests ON)
0147 else()
0148   set(_default_examples_unit_tests OFF)
0149 endif()
0150 option(ACTS_BUILD_EXAMPLES_UNITTESTS "Build Examples unit tests" ${_default_examples_unit_tests}) # default: ACTS_BUILD_UNITTESTS AND ACTS_BUILD_EXAMPLES
0151 option(ACTS_RUN_CLANG_TIDY "Run clang-tidy static analysis" OFF)
0152 # other options
0153 option(ACTS_BUILD_DOCS "Build documentation" OFF)
0154 option(ACTS_SETUP_BOOST "Explicitly set up Boost for the project" ON)
0155 option(ACTS_SETUP_EIGEN3 "Explicitly set up Eigen3 for the project" ON)
0156 option(ACTS_BUILD_ODD "Build the OpenDataDetector" OFF)
0157 # profiling related options
0158 option(ACTS_ENABLE_CPU_PROFILING "Enable CPU profiling using gperftools" OFF)
0159 option(ACTS_ENABLE_MEMORY_PROFILING "Enable memory profiling using gperftools" OFF)
0160 set(ACTS_GPERF_INSTALL_DIR "" CACHE STRING "Hint to help find gperf if profiling is enabled")
0161 
0162 option(ACTS_ENABLE_LOG_FAILURE_THRESHOLD "Enable failing on log messages with level above certain threshold" OFF)
0163 option(ACTS_COMPILE_HEADERS "Generate targets to compile header files" ON)
0164 # gersemi: on
0165 
0166 # Removed option: warn and drop it from the cache. Setting it used to imply
0167 # ACTS_ENABLE_LOG_FAILURE_THRESHOLD, so ignoring it silently would leave a
0168 # downstream that set only this one with no threshold at all.
0169 if(DEFINED ACTS_LOG_FAILURE_THRESHOLD)
0170     message(
0171         WARNING
0172         "ACTS_LOG_FAILURE_THRESHOLD was removed. Set "
0173         "ACTS_ENABLE_LOG_FAILURE_THRESHOLD=ON and pass the level in the "
0174         "ACTS_LOG_FAILURE_THRESHOLD environment variable instead."
0175     )
0176     unset(ACTS_LOG_FAILURE_THRESHOLD CACHE)
0177 endif()
0178 
0179 # handle option inter-dependencies and the everything flag
0180 # NOTE: ordering is important here. dependencies must come before dependees
0181 include(ActsOptionHelpers)
0182 
0183 # any examples component activates the general examples option
0184 set_option_if(
0185     ACTS_BUILD_EXAMPLES
0186     ACTS_BUILD_EXAMPLES_DD4HEP
0187     OR
0188     ACTS_BUILD_EXAMPLES_EDM4HEP
0189     OR
0190     ACTS_BUILD_EXAMPLES_FASTJET
0191     OR
0192     ACTS_BUILD_EXAMPLES_GEANT4
0193     OR
0194     ACTS_BUILD_EXAMPLES_GNN
0195     OR
0196     ACTS_BUILD_EXAMPLES_HASHING
0197     OR
0198     ACTS_BUILD_EXAMPLES_PARQUET
0199     OR
0200     ACTS_BUILD_EXAMPLES_PODIO
0201     OR
0202     ACTS_BUILD_EXAMPLES_PYTHIA8
0203     OR
0204     ACTS_BUILD_EXAMPLES_ROOT
0205     OR
0206     ACTS_BUILD_EXAMPLES_CUDA_MUON_SEGMENT_FITTING
0207 )
0208 # core plugins might be required by examples or depend on each other
0209 set_option_if(ACTS_BUILD_EXAMPLES_DD4HEP ACTS_BUILD_ODD)
0210 set_option_if(
0211     ACTS_BUILD_PLUGIN_DD4HEP
0212     ACTS_BUILD_EXAMPLES_DD4HEP
0213     OR
0214     ACTS_BUILD_EXAMPLES_EDM4HEP
0215 )
0216 set_option_if(ACTS_ENABLE_CUDA ACTS_BUILD_EXAMPLES_CUDA_MUON_SEGMENT_FITTING)
0217 set_option_if(ACTS_BUILD_PLUGIN_EDM4HEP ACTS_BUILD_EXAMPLES_EDM4HEP)
0218 set_option_if(ACTS_BUILD_EXAMPLES_PODIO ACTS_BUILD_EXAMPLES_EDM4HEP)
0219 set_option_if(ACTS_BUILD_PLUGIN_ARROW ACTS_BUILD_EXAMPLES_PARQUET)
0220 set_option_if(ACTS_BUILD_PLUGIN_GEANT4 ACTS_BUILD_EXAMPLES_GEANT4)
0221 set_option_if(
0222     ACTS_BUILD_PLUGIN_ROOT
0223     ACTS_BUILD_EXAMPLES_ROOT
0224     OR
0225     ACTS_BUILD_PLUGIN_DD4HEP
0226 )
0227 set_option_if(
0228     ACTS_BUILD_PLUGIN_IDENTIFICATION
0229     ACTS_BUILD_PLUGIN_ROOT
0230     OR
0231     ACTS_BUILD_PLUGIN_EDM4HEP
0232     OR
0233     ACTS_BUILD_EXAMPLES
0234 )
0235 set_option_if(ACTS_BUILD_PLUGIN_JSON ACTS_BUILD_EXAMPLES)
0236 set_option_if(ACTS_BUILD_FATRAS ACTS_BUILD_EXAMPLES)
0237 set_option_if(ACTS_BUILD_FATRAS ACTS_BUILD_EXAMPLES_FASTJET)
0238 set_option_if(ACTS_BUILD_PLUGIN_GNN ACTS_BUILD_EXAMPLES_GNN)
0239 set_option_if(ACTS_BUILD_PLUGIN_FPEMON ACTS_BUILD_EXAMPLES)
0240 set_option_if(ACTS_BUILD_PLUGIN_JSON ACTS_BUILD_PLUGIN_TRACCC)
0241 set_option_if(
0242     ACTS_ENABLE_CUDA
0243     ACTS_GNN_ENABLE_MODULEMAP
0244     AND
0245     ACTS_BUILD_PLUGIN_GNN
0246 )
0247 
0248 set_option_if(ACTS_BUILD_PYTHON_BINDINGS ACTS_BUILD_PYTHON_WHEEL)
0249 set_option_if(ACTS_BUILD_ALIGNMENT ACTS_BUILD_PLUGIN_MILLE)
0250 set_option_if(ACTS_BUILD_TRACCC ACTS_BUILD_PLUGIN_TRACCC)
0251 # Required for traccc
0252 set_option_if(ACTS_SETUP_DETRAY ACTS_BUILD_TRACCC)
0253 set_option_if(ACTS_SETUP_COVFIE ACTS_SETUP_DETRAY)
0254 # Required for detray
0255 set_option_if(ACTS_SETUP_VECMEM ACTS_SETUP_DETRAY)
0256 set_option_if(ACTS_BUILD_PLUGIN_JSON ACTS_SETUP_DETRAY)
0257 
0258 # feature tests
0259 include(CheckCXXSourceCompiles)
0260 
0261 # We need to set the ORIGIN token based on the system we are compiling for
0262 if(APPLE)
0263     set(_acts_rpath_origin "@loader_path")
0264 else()
0265     set(_acts_rpath_origin "\$ORIGIN")
0266 endif()
0267 
0268 # Set flags dependent whether we build ACTS in the default configuration or for deployment in pip with scikit-build-core
0269 if(ACTS_BUILD_PYTHON_WHEEL)
0270     # Check if skbuild is running
0271     if("${SKBUILD}" STREQUAL "2")
0272         message(
0273             STATUS
0274             "Build with skbuild as ${SKBUILD_PROJECT_NAME},${SKBUILD_PROJECT_VERSION_FULL} (${SKBUILD_STATE})"
0275         )
0276     else()
0277         message(WARNING "scikit-build-core not detected for building wheel")
0278     endif()
0279 
0280     # Set installation paths for proper python package creation
0281     # CMAKE_PREFIX_PATH should be site-packages (steered by scikit-build-core)
0282     set(CMAKE_INSTALL_BINDIR ${SKBUILD_NULL_DIR}) # Don't install binaries/scripts
0283     set(CMAKE_INSTALL_LIBDIR "acts")
0284     set(CMAKE_INSTALL_INCLUDEDIR ${SKBUILD_NULL_DIR}) # Don't install headers
0285     set(CMAKE_INSTALL_DATAROOTDIR "acts/share")
0286     set(CMAKE_INSTALL_DATADIR "acts/share")
0287     set(CMAKE_INSTALL_RPATH "${_acts_rpath_origin}")
0288     set(_acts_python_install_dir "acts")
0289     set(_acts_python_modules_rpath "${_acts_rpath_origin}")
0290 elseif(PROJECT_IS_TOP_LEVEL)
0291     include(GNUInstallDirs)
0292     set(CMAKE_INSTALL_RPATH "${_acts_rpath_origin}/../${CMAKE_INSTALL_LIBDIR}")
0293     set(_acts_python_install_dir "python/acts")
0294     set(_acts_python_modules_rpath
0295         "${_acts_rpath_origin}/../../${CMAKE_INSTALL_LIBDIR}"
0296     )
0297 endif()
0298 
0299 include(ActsCompilerOptions) # default compile options
0300 include(ActsComponentsHelpers) # handle components via add_..._if commands
0301 include(ActsStaticAnalysis)
0302 
0303 acts_disable_static_analysis() # disable static analysis for thirdparty dependencies, will be enabled later for the main code
0304 
0305 if(PROJECT_IS_TOP_LEVEL)
0306     # place build products in `<build>/bin` and `<build>/lib` for simple use
0307     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
0308         "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}"
0309     )
0310     set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
0311         "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}"
0312     )
0313 endif()
0314 
0315 # This needs to happen before we set up any targets
0316 include(ActsForceAssertions)
0317 
0318 # minimal dependency versions. they are defined here in a single place so
0319 # they can be easily upgraded, although they might not be used if the
0320 # dependency is included via `add_subdirectory(...)`.
0321 set(_acts_actsvg_version 0.4.57)
0322 set(_acts_boost_version 1.78.0)
0323 set(_acts_dd4hep_version 1.26)
0324 set(_acts_geant4_version 11.1.3)
0325 set(_acts_edm4hep_version 1.0)
0326 # 0.99 is the first release providing the TrackerHit interface, the CovMatrix
0327 # types (edm4hep::TrackState::covMatrix), Track::Nholes and the
0328 # edm4hep::TrackParams enum, all of which the EDM4hep plugin relies on.
0329 set(_acts_edm4hep_fallback_version 0.99)
0330 set(_acts_eigen3_version 5.0.1) # used when building Eigen from source
0331 set(_acts_eigen3_min_version 3.4.0) # minimum version accepted for a system Eigen3
0332 set(_acts_podio_version 1.0.1) # will try this first
0333 set(_acts_podio_fallback_version 0.17.4) # if not found, will try this one
0334 set(_acts_doxygen_version 1.9.4)
0335 set(_acts_hepmc3_version 3.2.4)
0336 set(_acts_nlohmanjson_version 3.11.3)
0337 set(_acts_gbl_version 04.00.05)
0338 set(_acts_mille_version 01.01.02)
0339 set(_acts_mp2_version 05.01.06)
0340 set(_acts_onnxruntime_version 1.12.0)
0341 set(_acts_geomodel_version 6.16.0)
0342 set(_acts_root_version 6.28.04) # first version with C++20 support
0343 set(_acts_tbb_version 2020.1)
0344 set(_acts_pythia8_version 8.310)
0345 set(_acts_pybind11_version 3.0.1)
0346 set(_acts_traccc_version 1.4.0)
0347 set(_acts_covfie_version 0.16.0)
0348 set(_acts_vecmem_version 1.28.0)
0349 set(_acts_annoy_version 1.17.3)
0350 set(_acts_fastjet_version 3.4.1)
0351 set(_acts_arrow_version 21.0.0)
0352 
0353 # Help with compiler flags discovery
0354 include(ActsFunctions)
0355 
0356 # Include the sources for the external dependencies.
0357 include(ActsExternSources)
0358 
0359 # required packages
0360 if(ACTS_SETUP_BOOST)
0361     # Enable both program_options and unit_test_framework to reduce complexity
0362     # Also Cuda tests seem to use program_options
0363     set(_acts_boost_components)
0364     if(
0365         ACTS_BUILD_ANALYSIS_APPS
0366         OR ACTS_BUILD_UNITTESTS
0367         OR ACTS_BUILD_INTEGRATIONTESTS
0368         OR ACTS_BUILD_BENCHMARKS
0369     )
0370         list(APPEND _acts_boost_components program_options unit_test_framework)
0371     endif()
0372 
0373     # Only the Mille plugin needs process/filesystem, and neither is part of
0374     # every Boost installation (Boost.Process is a compiled library since Boost
0375     # 1.88). The plugin reports if the one it needs is missing.
0376     find_package(
0377         Boost
0378         ${_acts_boost_version}
0379         REQUIRED
0380         COMPONENTS ${_acts_boost_components}
0381         OPTIONAL_COMPONENTS process filesystem
0382     )
0383 
0384     if(Boost_VERSION VERSION_EQUAL "1.85.0")
0385         set(_boost_version_severity WARNING)
0386         if(ACTS_BUILD_EXAMPLES)
0387             set(_boost_version_severity FATAL_ERROR)
0388         endif()
0389         message(
0390             ${_boost_version_severity}
0391             "Boost 1.85.0 is known to be broken (https://github.com/boostorg/container/issues/273). Please use a different version."
0392         )
0393     endif()
0394 endif()
0395 
0396 if(ACTS_SETUP_EIGEN3)
0397     if(ACTS_USE_SYSTEM_EIGEN3)
0398         find_package(Eigen3 REQUIRED CONFIG)
0399 
0400         if(DEFINED Eigen3_VERSION)
0401             if(Eigen3_VERSION VERSION_LESS _acts_eigen3_min_version)
0402                 message(
0403                     FATAL_ERROR
0404                     "Eigen3 ${Eigen3_VERSION} is too old (need >= ${_acts_eigen3_min_version})"
0405                 )
0406             endif()
0407             if(Eigen3_VERSION VERSION_GREATER_EQUAL 6.0.0)
0408                 message(
0409                     FATAL_ERROR
0410                     "Eigen3 ${Eigen3_VERSION} is not supported (need < 6.0.0)"
0411                 )
0412             endif()
0413         else()
0414             message(
0415                 WARNING
0416                 "Eigen3 version unknown - cannot verify version requirements"
0417             )
0418         endif()
0419     else()
0420         add_subdirectory(thirdparty/eigen3)
0421     endif()
0422     # get the first include path so we can nicely print where we get eigen from
0423     get_target_property(
0424         _eigen3_include_dirs
0425         Eigen3::Eigen
0426         INTERFACE_INCLUDE_DIRECTORIES
0427     )
0428     if(_eigen3_include_dirs)
0429         list(GET _eigen3_include_dirs 0 _eigen3_first_include_dir)
0430     endif()
0431 
0432     message(
0433         STATUS
0434         "Found Eigen3 at: ${_eigen3_first_include_dir} (${Eigen3_VERSION})"
0435     )
0436 endif()
0437 
0438 # CUDA settings are collected here in a macro, so that they can be reused by different plugins
0439 macro(enable_cuda)
0440     enable_language(CUDA)
0441     set(CMAKE_CUDA_STANDARD 20 CACHE STRING "CUDA C++ standard to use")
0442     set(CMAKE_CUDA_STANDARD_REQUIRED
0443         ON
0444         CACHE BOOL
0445         "Force the C++ standard requirement"
0446     )
0447     if(NOT CMAKE_CUDA_ARCHITECTURES)
0448         set(CMAKE_CUDA_ARCHITECTURES
0449             "75;80;86;90"
0450             CACHE STRING
0451             "CUDA architectures to generate code for"
0452         )
0453     endif()
0454     set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G")
0455     set(CMAKE_CUDA_FLAGS
0456         "${CMAKE_CUDA_FLAGS} --extended-lambda --dopt=on --generate-line-info --expt-relaxed-constexpr"
0457     )
0458 endmacro()
0459 
0460 # optional packages
0461 #
0462 # find packages explicitly for each component even if this means searching for
0463 # the same package twice. This avoids having complex if/else trees to sort out
0464 # when a particular package is actually needed.
0465 
0466 # nlohmann_json has to be resolved before any other package, because its config
0467 # file defines a non-namespaced `nlohmann_json` compatibility target whenever it
0468 # is searched for without a version. That target clashes with the one the
0469 # bundled build creates, so we have to claim the name first.
0470 if(ACTS_BUILD_PLUGIN_JSON)
0471     if(ACTS_USE_SYSTEM_NLOHMANN_JSON)
0472         find_package(nlohmann_json ${_acts_nlohmanjson_version} REQUIRED CONFIG)
0473     else()
0474         add_subdirectory(thirdparty/nlohmann_json)
0475     endif()
0476 endif()
0477 if(ACTS_BUILD_PYTHON_BINDINGS)
0478     find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development.Module)
0479     if(ACTS_USE_SYSTEM_PYBIND11)
0480         find_package(pybind11 CONFIG REQUIRED)
0481     else()
0482         add_subdirectory(thirdparty/pybind11)
0483     endif()
0484 endif()
0485 # Set up ActSVG when explicitly requested via plugin build, or when Detray's
0486 # SVG display path is enabled in the superbuild.
0487 if(
0488     ACTS_BUILD_PLUGIN_ACTSVG
0489     OR (
0490         ACTS_SETUP_DETRAY
0491         AND (NOT DEFINED DETRAY_SVG_DISPLAY OR DETRAY_SVG_DISPLAY)
0492     )
0493 )
0494     if(ACTS_USE_SYSTEM_ACTSVG)
0495         find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG)
0496     else()
0497         add_subdirectory(thirdparty/actsvg)
0498     endif()
0499 endif()
0500 if(ACTS_BUILD_PLUGIN_DD4HEP)
0501     # Explicitly find python so we can more easily override the version
0502     find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development.Module)
0503     find_package(
0504         DD4hep
0505         ${_acts_dd4hep_version}
0506         REQUIRED
0507         CONFIG
0508         COMPONENTS DDCore DDDetectors
0509     )
0510 endif()
0511 if(ACTS_BUILD_PLUGIN_GBL)
0512     if(ACTS_USE_SYSTEM_GBL)
0513         find_package(GBL ${_acts_gbl_version} REQUIRED CONFIG)
0514     else()
0515         add_subdirectory(thirdparty/GBL)
0516     endif()
0517 endif()
0518 if(ACTS_BUILD_PLUGIN_MILLE)
0519     if(ACTS_USE_SYSTEM_MILLE)
0520         find_package(Mille ${_acts_mille_version} REQUIRED CONFIG)
0521     else()
0522         add_subdirectory(thirdparty/Mille)
0523     endif()
0524     if(ACTS_USE_SYSTEM_MP2)
0525         find_package(millepedeII ${_acts_mp2_version} REQUIRED CONFIG)
0526     else()
0527         add_subdirectory(thirdparty/Millepede-II)
0528     endif()
0529 endif()
0530 if(ACTS_BUILD_PLUGIN_GEOMODEL)
0531     find_package(GeoModelCore CONFIG)
0532     if(NOT GeoModelCore_FOUND)
0533         message(
0534             FATAL_ERROR
0535             "GeoModel not found. Please install GeoModel or set ACTS_BUILD_PLUGIN_GEOMODEL to OFF."
0536         )
0537     endif()
0538 
0539     if(GeoModelCore_VERSION VERSION_LESS _acts_geomodel_version)
0540         message(
0541             FATAL_ERROR
0542             "GeoModel version ${GeoModelCore_VERSION} is insufficient. Please install GeoModel version ${_acts_geomodel_version} or newer."
0543         )
0544     endif()
0545     # find other GeoModel components of EXACT same version
0546     find_package(GeoModelIO ${GeoModelCore_VERSION} REQUIRED EXACT CONFIG)
0547 endif()
0548 if(ACTS_BUILD_PLUGIN_ROOT)
0549     # In the ATLAS build, the ROOT find_package call does not find VDT unless these variables are set.
0550     # This should not affect other environments.
0551     find_package(VDT QUIET)
0552     if(VDT_FOUND)
0553         set(VDT_INCLUDE_DIR "${VDT_INCLUDE_DIR}" CACHE PATH "")
0554         set(VDT_LIBRARY "${VDT_vdt_LIBRARY}" CACHE FILEPATH "")
0555     endif()
0556 
0557     find_package(
0558         ROOT
0559         ${_acts_root_version}
0560         REQUIRED
0561         CONFIG
0562         COMPONENTS Geom Graf Tree RIO Hist
0563     )
0564 endif()
0565 if(ACTS_BUILD_ANALYSIS_APPS)
0566     find_package(
0567         ROOT
0568         ${_acts_root_version}
0569         REQUIRED
0570         CONFIG
0571         COMPONENTS Geom Graf
0572     )
0573 endif()
0574 if(ACTS_ENABLE_CUDA)
0575     find_package(CUDAToolkit REQUIRED)
0576     enable_cuda()
0577     message(STATUS "Build ACTS with CUDA")
0578 endif()
0579 if(ACTS_BUILD_PLUGIN_GNN)
0580     if(ACTS_ENABLE_CUDA)
0581         message(STATUS "Build GNN plugin with CUDA")
0582     else()
0583         message(STATUS "Build GNN plugin for CPU only")
0584     endif()
0585     # FRNN and ModuleMapGraph are built from vendored upstream sources, which
0586     # are not ours to keep warning-clean. A normal variable, so it shadows the
0587     # cache entry for the subdirectories added below and is restored before any
0588     # ACTS target follows.
0589     set(_acts_gnn_warning_as_error "${CMAKE_COMPILE_WARNING_AS_ERROR}")
0590     set(CMAKE_COMPILE_WARNING_AS_ERROR OFF)
0591     if(ACTS_GNN_ENABLE_TORCH)
0592         find_package(Torch REQUIRED)
0593         if(ACTS_ENABLE_CUDA)
0594             add_subdirectory(thirdparty/FRNN)
0595         endif()
0596     endif()
0597     if(ACTS_GNN_ENABLE_MODULEMAP)
0598         if(ACTS_USE_SYSTEM_MODULEMAPGRAPH)
0599             find_package(ModuleMapGraph REQUIRED COMPONENTS CPU GPU)
0600         else()
0601             add_subdirectory(thirdparty/ModuleMapGraph)
0602         endif()
0603     endif()
0604     set(CMAKE_COMPILE_WARNING_AS_ERROR "${_acts_gnn_warning_as_error}")
0605 endif()
0606 if(ACTS_BUILD_PLUGIN_ONNX OR ACTS_GNN_ENABLE_ONNX)
0607     find_package(onnxruntime ${_acts_onnxruntime_version} MODULE REQUIRED)
0608 endif()
0609 if(ACTS_BUILD_PLUGIN_EDM4HEP)
0610     find_package(EDM4HEP ${_acts_edm4hep_version} CONFIG)
0611     if(NOT EDM4HEP_FOUND)
0612         message(
0613             STATUS
0614             "EDM4hep not found, trying version ${_acts_edm4hep_fallback_version}"
0615         )
0616         find_package(EDM4HEP ${_acts_edm4hep_fallback_version} CONFIG REQUIRED)
0617     endif()
0618     find_package(podio ${_acts_podio_version} CONFIG)
0619     if(NOT podio_FOUND)
0620         message(
0621             STATUS
0622             "Podio not found, trying ${_acts_podio_fallback_version} version"
0623         )
0624         find_package(podio ${_acts_podio_fallback_version} CONFIG REQUIRED)
0625     endif()
0626     find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core)
0627 endif()
0628 if(ACTS_BUILD_PLUGIN_GEANT4)
0629     find_package(Geant4 ${_acts_geant4_version} REQUIRED CONFIG COMPONENTS gdml)
0630 endif()
0631 if(ACTS_BUILD_PLUGIN_ARROW)
0632     find_package(Arrow REQUIRED CONFIG)
0633     find_package(Parquet REQUIRED CONFIG)
0634     find_package(ArrowDataset REQUIRED CONFIG)
0635     # Arrow's package config requires an exact version match, so enforce our
0636     # minimum supported major version manually instead.
0637     string(REPLACE "." ";" _acts_arrow_version_list ${_acts_arrow_version})
0638     list(GET _acts_arrow_version_list 0 _acts_arrow_version_major)
0639     if(Arrow_VERSION_MAJOR LESS _acts_arrow_version_major)
0640         message(
0641             FATAL_ERROR
0642             "Found Arrow ${Arrow_VERSION}, but at least ${_acts_arrow_version} is required"
0643         )
0644     endif()
0645 endif()
0646 
0647 if(ACTS_SETUP_VECMEM)
0648     if(ACTS_USE_SYSTEM_VECMEM)
0649         find_package(vecmem ${_acts_vecmem_version} REQUIRED)
0650     elseif(NOT TARGET vecmem::core)
0651         add_subdirectory(thirdparty/vecmem)
0652         list(PREPEND CMAKE_MODULE_PATH "${VECMEM_LANGUAGE_DIR}")
0653         list(PREPEND CMAKE_MODULE_PATH "${VECMEM_LANGUAGE_DIR}/sycl")
0654         # Make the "VecMem language code" available for the whole project.
0655         include("${VECMEM_LANGUAGE_DIR}/vecmem-check-language.cmake")
0656     endif()
0657     # Make the "VecMem language code" available for the whole project.
0658     list(APPEND CMAKE_MODULE_PATH "${VECMEM_LANGUAGE_DIR}")
0659 endif()
0660 
0661 if(ACTS_SETUP_COVFIE)
0662     if(ACTS_USE_SYSTEM_COVFIE)
0663         find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG)
0664     else()
0665         add_subdirectory(thirdparty/covfie)
0666     endif()
0667 endif()
0668 
0669 if(ACTS_SETUP_DETRAY)
0670     # HACK: Temporary logic (aka technical debt) to make the detray component
0671     # work in traccc.
0672 
0673     # Let ACTS set up all of the dependencies
0674     option(DETRAY_SETUP_VECMEM "" FALSE)
0675     option(DETRAY_SETUP_NLOHMANN "" FALSE)
0676     option(DETRAY_SETUP_EIGEN3 "" FALSE)
0677     option(DETRAY_SETUP_ACTSVG "" FALSE)
0678     option(DETRAY_SETUP_COVFIE "" FALSE)
0679     option(DETRAY_SETUP_PYBIND11 "" FALSE)
0680 
0681     # Enable optional components depending on ACTS configuration
0682     set_option_if(DETRAY_BUILD_CUDA ACTS_ENABLE_CUDA)
0683     set_option_if(DETRAY_BUILD_UNIT_TESTS ACTS_BUILD_UNITTESTS)
0684     set_option_if(DETRAY_BUILD_INTEGRATION_TESTS ACTS_BUILD_INTEGRATIONTESTS)
0685     set_option_if(DETRAY_BUILD_BENCHMARKS ACTS_BUILD_BENCHMARKS)
0686     set_option_if(DETRAY_BUILD_TUTORIALS ACTS_BUILD_EXAMPLES)
0687     set_option_if(DETRAY_SVG_DISPLAY ACTS_BUILD_PLUGIN_ACTSVG)
0688 
0689     # Enable dependencies of ACTS Detray plugin unit tests
0690     set_option_if(DETRAY_BUILD_TEST_UTILS ACTS_BUILD_EXAMPLES_UNITTESTS)
0691 
0692     if(ACTS_BUILD_TRACCC)
0693         # Some detray validation tools are used in optional traccc libraries
0694         set_option_if(
0695             DETRAY_BUILD_VALIDATION_TOOLS
0696             TRACCC_BUILD_PERFORMANCE
0697             OR
0698             TRACCC_BUILD_TESTING
0699         )
0700     endif()
0701 
0702     add_subdirectory(Detray)
0703 endif()
0704 
0705 if(ACTS_BUILD_TRACCC)
0706     # HACK: Temporary logic (aka technical debt) to make the traccc
0707     # component work. Remove this ASAP.
0708     option(TRACCC_USE_ROOT "" FALSE)
0709     option(TRACCC_SETUP_ACTS "" FALSE)
0710     option(TRACCC_SETUP_VECMEM "" FALSE)
0711     option(TRACCC_SETUP_EIGEN3 "" FALSE)
0712     option(TRACCC_SETUP_THRUST "" TRUE)
0713     option(TRACCC_SETUP_COVFIE "" FALSE)
0714     option(TRACCC_SETUP_DETRAY "" FALSE)
0715     option(TRACCC_BUILD_CUDA "" ${ACTS_ENABLE_CUDA})
0716     option(TRACCC_SETUP_TBB "" FALSE)
0717     option(TRACCC_BUILD_IO "" TRUE)
0718     option(TRACCC_BUILD_PERFORMANCE "" FALSE)
0719     option(TRACCC_BUILD_SIMULATION "" FALSE)
0720     option(TRACCC_BUILD_TESTING "" FALSE)
0721     option(TRACCC_BUILD_EXAMPLES "" FALSE)
0722     option(TRACCC_BUILD_BENCHMARKS "" FALSE)
0723 
0724     add_subdirectory(Traccc)
0725 endif()
0726 
0727 # examples dependencies
0728 if(ACTS_BUILD_EXAMPLES)
0729     set(THREADS_PREFER_PTHREAD_FLAG ON)
0730     find_package(Threads REQUIRED)
0731 
0732     set(_acts_hepmc3_components "search")
0733     if(ACTS_BUILD_EXAMPLES_ROOT)
0734         list(APPEND _acts_hepmc3_components "rootIO")
0735     endif()
0736 
0737     find_package(
0738         HepMC3
0739         ${_acts_hepmc3_version}
0740         REQUIRED
0741         CONFIG
0742         COMPONENTS ${_acts_hepmc3_components}
0743     )
0744 
0745     # HepMC3 only introduced a proper HepMC3::HepMC3 target in 3.2.6
0746     if(${HEPMC3_VERSION} VERSION_LESS 3.2.6)
0747         add_library(HepMC3::HepMC3 SHARED IMPORTED)
0748         set_property(
0749             TARGET HepMC3::HepMC3
0750             PROPERTY IMPORTED_LOCATION "${HEPMC3_LIB}"
0751         )
0752         target_include_directories(
0753             HepMC3::HepMC3
0754             INTERFACE "${HEPMC3_INCLUDE_DIR}"
0755         )
0756     endif()
0757     if(ACTS_BUILD_EXAMPLES_ROOT)
0758         # for simplicity always request all potentially required components.
0759         find_package(
0760             ROOT
0761             ${_acts_root_version}
0762             REQUIRED
0763             CONFIG
0764             COMPONENTS Core Geom Graf GenVector Hist Tree TreePlayer
0765         )
0766     endif()
0767     if(ACTS_BUILD_EXAMPLES_FASTJET)
0768         find_package(FastJet ${_acts_fastjet_version} REQUIRED)
0769     endif()
0770     if(ACTS_BUILD_EXAMPLES_DD4HEP AND ACTS_BUILD_EXAMPLES_GEANT4)
0771         find_package(
0772             DD4hep
0773             ${_acts_dd4hep_version}
0774             REQUIRED
0775             CONFIG
0776             COMPONENTS DDCore DDG4 DDDetectors
0777         )
0778     elseif(ACTS_BUILD_EXAMPLES_DD4HEP)
0779         find_package(
0780             DD4hep
0781             ${_acts_dd4hep_version}
0782             REQUIRED
0783             CONFIG
0784             COMPONENTS DDCore DDDetectors
0785         )
0786     endif()
0787     if(ACTS_BUILD_EXAMPLES_PYTHIA8)
0788         find_package(Pythia8 ${_acts_pythia8_version} REQUIRED)
0789     endif()
0790     if(ACTS_SETUP_ANNOY OR ACTS_BUILD_EXAMPLES_HASHING)
0791         add_subdirectory(thirdparty/Annoy)
0792     endif()
0793 endif()
0794 # other dependencies
0795 if(ACTS_BUILD_DOCS)
0796     find_package(Doxygen ${_acts_doxygen_version} REQUIRED)
0797 endif()
0798 
0799 acts_enable_static_analysis() # enable static analysis for the main code, after dependencies are set up
0800 
0801 # core library, core plugins, and other components
0802 add_component(Core Core)
0803 add_component_if(Fatras Fatras ACTS_BUILD_FATRAS)
0804 add_component_if(Alignment Alignment ACTS_BUILD_ALIGNMENT)
0805 add_subdirectory(Plugins)
0806 
0807 add_subdirectory_if(thirdparty/OpenDataDetector ACTS_BUILD_ODD)
0808 
0809 # Examples
0810 add_subdirectory_if(Examples ACTS_BUILD_EXAMPLES)
0811 
0812 # Python bindings
0813 add_subdirectory_if(Python ACTS_BUILD_PYTHON_BINDINGS)
0814 
0815 # automated tests and benchmarks
0816 if(ACTS_BUILD_BENCHMARKS OR ACTS_BUILD_INTEGRATIONTESTS OR ACTS_BUILD_UNITTESTS)
0817     enable_testing() # must be set in the main CMakeLists.txt
0818     add_subdirectory(Tests)
0819 endif()
0820 
0821 # documentation, adding unconditionally but will only set up docs build if configured
0822 add_subdirectory(docs)
0823 
0824 # create cmake configuration files and environment setup script
0825 include(ActsCreatePackageConfig)
0826 include(ActsCreateSetup)
0827 
0828 acts_print_auto_enabled_options()