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.77.0) # first version with C++20 support
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.0)
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 # recommended dependency version. if there is an opportunity to reach
0270 # this version we will try so.
0271 set(_acts_boost_recommended_version 1.78.0)
0272
0273 # Help with compiler flags discovery
0274 include(ActsFunctions)
0275
0276 # Include the sources for the external dependencies.
0277 include(ActsExternSources)
0278
0279 # required packages
0280 if(ACTS_SETUP_BOOST)
0281 # Enable both program_options and unit_test_framework to reduce complexity
0282 # Also Cuda tests seem to use program_options
0283 if(
0284 ACTS_BUILD_ANALYSIS_APPS
0285 OR ACTS_BUILD_UNITTESTS
0286 OR ACTS_BUILD_INTEGRATIONTESTS
0287 OR ACTS_BUILD_BENCHMARKS
0288 )
0289 find_package(
0290 Boost
0291 ${_acts_boost_version}
0292 REQUIRED
0293 COMPONENTS program_options unit_test_framework
0294 )
0295 else()
0296 find_package(Boost ${_acts_boost_version} REQUIRED COMPONENTS)
0297 endif()
0298
0299 if(Boost_VERSION VERSION_LESS _acts_boost_recommended_version)
0300 message(
0301 WARNING
0302 "Found Boost ${Boost_VERSION} - recommended is at least ${_acts_boost_recommended_version}"
0303 )
0304 endif()
0305
0306 if(Boost_VERSION VERSION_EQUAL "1.85.0")
0307 set(_boost_version_severity WARNING)
0308 if(ACTS_BUILD_EXAMPLES)
0309 set(_boost_version_severity FATAL_ERROR)
0310 endif()
0311 message(
0312 ${_boost_version_severity}
0313 "Boost 1.85.0 is known to be broken (https://github.com/boostorg/container/issues/273). Please use a different version."
0314 )
0315 endif()
0316 endif()
0317
0318 if(ACTS_SETUP_EIGEN3)
0319 if(ACTS_USE_SYSTEM_EIGEN3)
0320 find_package(Eigen3 REQUIRED CONFIG)
0321
0322 if(DEFINED Eigen3_VERSION)
0323 if(Eigen3_VERSION VERSION_LESS _acts_eigen3_version)
0324 message(
0325 FATAL_ERROR
0326 "Eigen3 ${Eigen3_VERSION} is too old (need >= 3.4.0)"
0327 )
0328 endif()
0329 if(Eigen3_VERSION VERSION_GREATER_EQUAL 6.0.0)
0330 message(
0331 FATAL_ERROR
0332 "Eigen3 ${Eigen3_VERSION} is not supported (need < 6.0.0)"
0333 )
0334 endif()
0335 else()
0336 message(
0337 WARNING
0338 "Eigen3 version unknown - cannot verify version requirements"
0339 )
0340 endif()
0341 else()
0342 add_subdirectory(thirdparty/eigen3)
0343 endif()
0344 # get the first include path so we can nicely print where we get eigen from
0345 get_target_property(
0346 _eigen3_include_dirs
0347 Eigen3::Eigen
0348 INTERFACE_INCLUDE_DIRECTORIES
0349 )
0350 if(_eigen3_include_dirs)
0351 list(GET _eigen3_include_dirs 0 _eigen3_first_include_dir)
0352 endif()
0353
0354 message(
0355 STATUS
0356 "Found Eigen3 at: ${_eigen3_first_include_dir} (${Eigen3_VERSION})"
0357 )
0358 endif()
0359
0360 find_package(Filesystem REQUIRED)
0361
0362 # CUDA settings are collected here in a macro, so that they can be reused by different plugins
0363 macro(enable_cuda)
0364 enable_language(CUDA)
0365 set(CMAKE_CUDA_STANDARD 14 CACHE STRING "CUDA C++ standard to use")
0366 set(CMAKE_CUDA_STANDARD_REQUIRED
0367 ON
0368 CACHE BOOL
0369 "Force the C++ standard requirement"
0370 )
0371 if(NOT CMAKE_CUDA_ARCHITECTURES)
0372 set(CMAKE_CUDA_ARCHITECTURES
0373 "35;52;75"
0374 CACHE STRING
0375 "CUDA architectures to generate code for"
0376 )
0377 endif()
0378 set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G")
0379 set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda")
0380 endmacro()
0381
0382 # optional packages
0383 #
0384 # find packages explicitly for each component even if this means searching for
0385 # the same package twice. This avoids having complex if/else trees to sort out
0386 # when a particular package is actually needed.
0387 if(ACTS_BUILD_PLUGIN_ACTSVG)
0388 if(ACTS_USE_SYSTEM_ACTSVG)
0389 find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG)
0390 else()
0391 add_subdirectory(thirdparty/actsvg)
0392 endif()
0393 endif()
0394 if(ACTS_BUILD_PLUGIN_DD4HEP)
0395 # Explicitly find python so we can more easily override the version
0396 find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development)
0397 find_package(
0398 DD4hep
0399 ${_acts_dd4hep_version}
0400 REQUIRED
0401 CONFIG
0402 COMPONENTS DDCore DDDetectors
0403 )
0404 endif()
0405 if(ACTS_BUILD_PLUGIN_JSON)
0406 if(ACTS_USE_SYSTEM_NLOHMANN_JSON)
0407 find_package(nlohmann_json ${_acts_nlohmanjson_version} REQUIRED CONFIG)
0408 else()
0409 add_subdirectory(thirdparty/nlohmann_json)
0410 endif()
0411 endif()
0412 if(ACTS_BUILD_PLUGIN_FASTJET)
0413 find_package(FastJet ${_acts_fastjet_version} REQUIRED)
0414 endif()
0415 if(ACTS_BUILD_PLUGIN_GEOMODEL)
0416 find_package(GeoModelCore CONFIG)
0417 if(NOT GeoModelCore_FOUND)
0418 message(
0419 FATAL_ERROR
0420 "GeoModel not found. Please install GeoModel or set ACTS_BUILD_PLUGIN_GEOMODEL to OFF."
0421 )
0422 endif()
0423
0424 if(GeoModelCore_VERSION VERSION_LESS _acts_geomodel_version)
0425 message(
0426 FATAL_ERROR
0427 "GeoModel version ${GeoModelCore_VERSION} is insufficient. Please install GeoModel version ${_acts_geomodel_version} or newer."
0428 )
0429 endif()
0430 # find other GeoModel components of EXACT same version
0431 find_package(GeoModelIO ${GeoModelCore_VERSION} REQUIRED EXACT CONFIG)
0432 endif()
0433 if(ACTS_BUILD_PLUGIN_ROOT)
0434 find_package(
0435 ROOT
0436 ${_acts_root_version}
0437 REQUIRED
0438 CONFIG
0439 COMPONENTS Geom Graf Tree RIO
0440 )
0441 check_root_compatibility()
0442 endif()
0443 if(ACTS_BUILD_ANALYSIS_APPS)
0444 find_package(
0445 ROOT
0446 ${_acts_root_version}
0447 REQUIRED
0448 CONFIG
0449 COMPONENTS Geom Graf
0450 )
0451 check_root_compatibility()
0452 endif()
0453 if(ACTS_BUILD_PLUGIN_GNN)
0454 if(ACTS_GNN_ENABLE_CUDA)
0455 find_package(CUDAToolkit REQUIRED)
0456 enable_cuda()
0457 message(STATUS "Build GNN plugin with CUDA")
0458 else()
0459 message(STATUS "Build GNN plugin for CPU only")
0460 endif()
0461 if(ACTS_GNN_ENABLE_TORCH)
0462 find_package(Torch REQUIRED)
0463 if(ACTS_GNN_ENABLE_CUDA)
0464 add_subdirectory(thirdparty/FRNN)
0465 endif()
0466 endif()
0467 if(ACTS_GNN_ENABLE_MODULEMAP)
0468 if(ACTS_USE_SYSTEM_MODULEMAPGRAPH)
0469 find_package(ModuleMapGraph REQUIRED COMPONENTS CPU GPU)
0470 else()
0471 add_subdirectory(thirdparty/ModuleMapGraph)
0472 endif()
0473 endif()
0474 endif()
0475 if(ACTS_BUILD_PLUGIN_ONNX OR ACTS_GNN_ENABLE_ONNX)
0476 find_package(onnxruntime ${_acts_onnxruntime_version} MODULE REQUIRED)
0477 endif()
0478 if(ACTS_BUILD_PLUGIN_EDM4HEP)
0479 find_package(EDM4HEP ${_acts_edm4hep_version} REQUIRED CONFIG)
0480 find_package(podio ${_acts_podio_version} CONFIG)
0481 if(NOT podio_FOUND)
0482 message(
0483 STATUS
0484 "Podio not found, trying ${_acts_podio_fallback_version} version"
0485 )
0486 find_package(podio ${_acts_podio_fallback_version} CONFIG REQUIRED)
0487 endif()
0488 find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core)
0489 endif()
0490 if(ACTS_BUILD_PLUGIN_GEANT4)
0491 find_package(Geant4 ${_acts_geant4_version} REQUIRED CONFIG COMPONENTS gdml)
0492 endif()
0493
0494 if(ACTS_BUILD_PLUGIN_TRACCC)
0495 if(ACTS_SETUP_VECMEM)
0496 if(ACTS_USE_SYSTEM_VECMEM)
0497 find_package(vecmem ${_acts_vecmem_version} REQUIRED)
0498 else()
0499 add_subdirectory(thirdparty/vecmem)
0500 # Make the "VecMem language code" available for the whole project.
0501 include("${VECMEM_LANGUAGE_DIR}/vecmem-check-language.cmake")
0502 endif()
0503 endif()
0504
0505 if(ACTS_SETUP_ALGEBRAPLUGINS)
0506 if(ACTS_USE_SYSTEM_ALGEBRAPLUGINS)
0507 find_package(
0508 algebra-plugins
0509 ${_acts_algebraplugins_version}
0510 REQUIRED
0511 )
0512 else()
0513 add_subdirectory(thirdparty/algebra-plugins)
0514 endif()
0515 endif()
0516
0517 if(ACTS_SETUP_DETRAY)
0518 if(ACTS_USE_SYSTEM_DETRAY)
0519 find_package(detray ${_acts_detray_version} REQUIRED CONFIG)
0520 else()
0521 add_subdirectory(thirdparty/detray)
0522 endif()
0523 endif()
0524
0525 if(ACTS_SETUP_COVFIE)
0526 if(ACTS_USE_SYSTEM_COVFIE)
0527 find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG)
0528 else()
0529 add_subdirectory(thirdparty/covfie)
0530 endif()
0531 endif()
0532
0533 # traccc also depends on vecmem and covfie, but those plugins should always
0534 # be enabled if traccc is.
0535 if(ACTS_USE_SYSTEM_TRACCC)
0536 find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG)
0537 else()
0538 add_subdirectory(thirdparty/traccc)
0539 endif()
0540 endif()
0541 if(ACTS_SETUP_ANNOY OR ACTS_BUILD_PLUGIN_HASHING)
0542 add_subdirectory(thirdparty/Annoy)
0543 endif()
0544
0545 # examples dependencies
0546 if(ACTS_BUILD_EXAMPLES)
0547 set(THREADS_PREFER_PTHREAD_FLAG ON)
0548 find_package(Threads REQUIRED)
0549
0550 find_package(HepMC3 ${_acts_hepmc3_version} REQUIRED CONFIG)
0551
0552 # HepMC3 only introduced a proper HepMC3::HepMC3 target in 3.2.6
0553 if(${HEPMC3_VERSION} VERSION_LESS 3.2.6)
0554 add_library(HepMC3::HepMC3 SHARED IMPORTED)
0555 set_property(
0556 TARGET HepMC3::HepMC3
0557 PROPERTY IMPORTED_LOCATION "${HEPMC3_LIB}"
0558 )
0559 target_include_directories(
0560 HepMC3::HepMC3
0561 INTERFACE "${HEPMC3_INCLUDE_DIR}"
0562 )
0563 endif()
0564 if(ACTS_BUILD_EXAMPLES_ROOT)
0565 # for simplicity always request all potentially required components.
0566 find_package(
0567 ROOT
0568 ${_acts_root_version}
0569 REQUIRED
0570 CONFIG
0571 COMPONENTS Core Geom Graf GenVector Hist Tree TreePlayer
0572 )
0573 check_root_compatibility()
0574 endif()
0575 if(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS)
0576 find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development)
0577 if(ACTS_USE_SYSTEM_PYBIND11)
0578 find_package(pybind11 CONFIG REQUIRED)
0579 else()
0580 add_subdirectory(thirdparty/pybind11)
0581 endif()
0582 endif()
0583 if(ACTS_BUILD_EXAMPLES_DD4HEP AND ACTS_BUILD_EXAMPLES_GEANT4)
0584 find_package(
0585 DD4hep
0586 ${_acts_dd4hep_version}
0587 REQUIRED
0588 CONFIG
0589 COMPONENTS DDCore DDG4 DDDetectors
0590 )
0591 elseif(ACTS_BUILD_EXAMPLES_DD4HEP)
0592 find_package(
0593 DD4hep
0594 ${_acts_dd4hep_version}
0595 REQUIRED
0596 CONFIG
0597 COMPONENTS DDCore DDDetectors
0598 )
0599 endif()
0600 if(ACTS_BUILD_EXAMPLES_PYTHIA8)
0601 find_package(Pythia8 ${_acts_pythia8_version} REQUIRED)
0602 endif()
0603 endif()
0604 # other dependencies
0605 if(ACTS_BUILD_DOCS)
0606 find_package(Doxygen ${_acts_doxygen_version} REQUIRED)
0607 find_package(Sphinx REQUIRED)
0608 endif()
0609
0610 # core library, core plugins, and other components
0611 add_component(Core Core)
0612 add_component_if(Fatras Fatras ACTS_BUILD_FATRAS)
0613 add_subdirectory(Plugins)
0614 add_component_if(Alignment Alignment ACTS_BUILD_ALIGNMENT)
0615
0616 add_subdirectory_if(thirdparty/OpenDataDetector ACTS_BUILD_ODD)
0617
0618 # Python bindings infrastructure
0619 add_subdirectory_if(Python ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS)
0620
0621 # examples
0622 add_subdirectory_if(Examples ACTS_BUILD_EXAMPLES)
0623
0624 # automated tests and benchmarks
0625 if(ACTS_BUILD_BENCHMARKS OR ACTS_BUILD_INTEGRATIONTESTS OR ACTS_BUILD_UNITTESTS)
0626 enable_testing() # must be set in the main CMakeLists.txt
0627 add_subdirectory(Tests)
0628 endif()
0629
0630 # documentation
0631 add_subdirectory_if(docs ACTS_BUILD_DOCS)
0632
0633 # create cmake configuration files and environment setup script
0634 include(ActsCreatePackageConfig)
0635 include(ActsCreateSetup)