Back to home page

EIC code displayed by LXR

 
 

    


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 REQUIRED)
0058 if(${EDM4HEP_VERSION} VERSION_LESS 0.4.1)
0059   message(FATAL_ERROR "EDM4HEP version ${EDM4HEP_VERSION} is too old. Please use at least version 0.4.1.")
0060 endif()
0061 
0062 find_package(podio 0.16.3)
0063 if(NOT podio_FOUND)
0064   find_package(podio 1.0 REQUIRED)
0065 endif()
0066 add_definitions("-Dpodio_VERSION_MAJOR=${podio_VERSION_MAJOR}")
0067 add_definitions("-Dpodio_VERSION_MINOR=${podio_VERSION_MINOR}")
0068 add_definitions("-Dpodio_VERSION_PATCH=${podio_VERSION_PATCH}")
0069 
0070 find_package(ROOT COMPONENTS Core RIO Tree MathCore GenVector Geom REQUIRED)
0071 find_package(DD4hep COMPONENTS DDRec REQUIRED)
0072 
0073 if(JUGGLER_BUILD_TRACKING)
0074   find_package(Acts REQUIRED COMPONENTS Core PluginDD4hep PluginJson)
0075   set(Acts_VERSION_MIN "20.2.0")
0076   set(Acts_VERSION "${Acts_VERSION_MAJOR}.${Acts_VERSION_MINOR}.${Acts_VERSION_PATCH}")
0077   if(${Acts_VERSION} VERSION_LESS ${Acts_VERSION_MIN}
0078     AND NOT "${Acts_VERSION}" STREQUAL "9.9.9")
0079     message(FATAL_ERROR "Acts version ${Acts_VERSION_MIN} or higher required, but ${Acts_VERSION} found")
0080   endif()
0081   add_definitions("-DActs_VERSION_MAJOR=${Acts_VERSION_MAJOR}")
0082   add_definitions("-DActs_VERSION_MINOR=${Acts_VERSION_MINOR}")
0083   add_definitions("-DActs_VERSION_PATCH=${Acts_VERSION_PATCH}")
0084   # Get Acts namespace prefix
0085   if(${Acts_VERSION} VERSION_GREATER_EQUAL "43.0.0")
0086     set(Acts_NAMESPACE_PREFIX Acts::)
0087   else()
0088     set(Acts_NAMESPACE_PREFIX Acts)
0089   endif()
0090   # Get ActsCore path for ActsExamples include
0091   get_target_property(ActsCore_LOCATION ${Acts_NAMESPACE_PREFIX}Core LOCATION)
0092   get_filename_component(ActsCore_PATH ${ActsCore_LOCATION} DIRECTORY)
0093 endif()
0094 
0095 ## Dependencies
0096 find_package(algorithms)
0097 find_package(Gaudi)
0098 find_package(k4FWCore)
0099 
0100 ## Components
0101 add_subdirectory(JugBase)
0102 add_subdirectory(JugAlgo)
0103 add_subdirectory(JugDigi)
0104 add_subdirectory(JugFast)
0105 add_subdirectory(JugPID)
0106 add_subdirectory(JugReco)
0107 if(JUGGLER_BUILD_TRACKING)
0108   add_subdirectory(JugTrack)
0109 endif()
0110 
0111 ## CMake config
0112 gaudi_install(CMAKE)
0113 
0114 # create and install Juggler.xenv file as it still has a use-case
0115 # TODO: update workflow to not need xenv files anymore
0116 include(cmake/xenv.cmake)