Warning, /juggler/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # SPDX-License-Identifier: LGPL-3.0-or-later
0002 # Copyright (C) 2022 Wouter Deconinck, Whitney Armstrong
0003
0004 cmake_minimum_required(VERSION 3.19)
0005
0006 # CMP0074: find_package() uses <PackageName>_ROOT variables
0007 cmake_policy(SET CMP0074 NEW)
0008
0009 project(Juggler VERSION 4.3.0)
0010
0011 option(JUGGLER_BUILD_TRACKING "Build tracking algorithms" TRUE)
0012
0013 set(CMAKE_CXX_STANDARD 20 CACHE STRING "")
0014 if(NOT CMAKE_CXX_STANDARD MATCHES "20")
0015 message(FATAL_ERROR "Unsupported C++ standard: ${CMAKE_CXX_STANDARD}")
0016 endif()
0017 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0018 set(CMAKE_CXX_EXTENSIONS OFF)
0019
0020 # Export compile commands as json for run-clang-tidy
0021 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
0022
0023 # Also use clang-tidy integration in CMake
0024 option(ENABLE_CLANG_TIDY "Enable clang-tidy integration in cmake" OFF)
0025 if(ENABLE_CLANG_TIDY)
0026 find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
0027 if (CLANG_TIDY_EXE)
0028 message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
0029 set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" CACHE STRING "" FORCE)
0030 else()
0031 set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE)
0032 endif()
0033 endif()
0034
0035 # Set default build type
0036 set(default_build_type "Release")
0037 if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
0038 set(default_build_type "RelWithDebInfo")
0039 endif()
0040 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
0041 message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
0042 set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
0043 STRING "Choose the type of build." FORCE)
0044 # Set the possible values of build type for cmake-gui
0045 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
0046 "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
0047 endif()
0048
0049 # Set all warnings
0050 if(NOT CMAKE_BUILD_TYPE MATCHES Release)
0051 add_compile_options(-Wall -Wextra -Werror -Wno-error=deprecated-declarations)
0052 endif()
0053
0054 find_package(Microsoft.GSL CONFIG)
0055
0056 find_package(EDM4EIC REQUIRED)
0057 find_package(EDM4HEP 0.4.1 REQUIRED)
0058
0059 find_package(podio 0.16.3)
0060 if(NOT podio_FOUND)
0061 find_package(podio 1.0 REQUIRED)
0062 endif()
0063 add_definitions("-Dpodio_VERSION_MAJOR=${podio_VERSION_MAJOR}")
0064 add_definitions("-Dpodio_VERSION_MINOR=${podio_VERSION_MINOR}")
0065 add_definitions("-Dpodio_VERSION_PATCH=${podio_VERSION_PATCH}")
0066
0067 find_package(ROOT COMPONENTS Core RIO Tree MathCore GenVector Geom REQUIRED)
0068 find_package(DD4hep COMPONENTS DDRec REQUIRED)
0069
0070 if(JUGGLER_BUILD_TRACKING)
0071 find_package(Acts REQUIRED COMPONENTS Core PluginTGeo PluginDD4hep PluginJson)
0072 set(Acts_VERSION_MIN "20.2.0")
0073 set(Acts_VERSION "${Acts_VERSION_MAJOR}.${Acts_VERSION_MINOR}.${Acts_VERSION_PATCH}")
0074 if(${Acts_VERSION} VERSION_LESS ${Acts_VERSION_MIN}
0075 AND NOT "${Acts_VERSION}" STREQUAL "9.9.9")
0076 message(FATAL_ERROR "Acts version ${Acts_VERSION_MIN} or higher required, but ${Acts_VERSION} found")
0077 endif()
0078 add_definitions("-DActs_VERSION_MAJOR=${Acts_VERSION_MAJOR}")
0079 add_definitions("-DActs_VERSION_MINOR=${Acts_VERSION_MINOR}")
0080 add_definitions("-DActs_VERSION_PATCH=${Acts_VERSION_PATCH}")
0081 # Get ActsCore path for ActsExamples include
0082 get_target_property(ActsCore_LOCATION ActsCore LOCATION)
0083 get_filename_component(ActsCore_PATH ${ActsCore_LOCATION} DIRECTORY)
0084 endif()
0085
0086 ## Dependencies
0087 find_package(algorithms)
0088 find_package(Gaudi)
0089 find_package(k4FWCore)
0090
0091 ## Components
0092 add_subdirectory(JugBase)
0093 add_subdirectory(JugAlgo)
0094 add_subdirectory(JugDigi)
0095 add_subdirectory(JugFast)
0096 add_subdirectory(JugPID)
0097 add_subdirectory(JugReco)
0098 if(JUGGLER_BUILD_TRACKING)
0099 add_subdirectory(JugTrack)
0100 endif()
0101
0102 ## CMake config
0103 gaudi_install(CMAKE)
0104
0105 # create and install Juggler.xenv file as it still has a use-case
0106 # TODO: update workflow to not need xenv files anymore
0107 include(cmake/xenv.cmake)