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