Back to home page

EIC code displayed by LXR

 
 

    


Warning, /algorithms/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 Whitney Armstrong, Wouter Deconinck, Sylvester Joosten
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 # must be set before project(...) call; version module is needed before
0010 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
0011 
0012 # determine project version; sets _algorithms_version
0013 include(algorithmsRetrieveVersion)
0014 
0015 project(algorithms VERSION ${_algorithms_version})
0016 
0017 set(CMAKE_CXX_STANDARD 17 CACHE STRING "")
0018 if(NOT CMAKE_CXX_STANDARD MATCHES "17|20")
0019   message(FATAL_ERROR "Unsupported C++ standard: ${CMAKE_CXX_STANDARD}")
0020 endif()
0021 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0022 set(CMAKE_CXX_EXTENSIONS OFF)
0023 
0024 # Export compile commands as json for run-clang-tidy
0025 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
0026 
0027 # Also use clang-tidy integration in CMake
0028 option(ENABLE_CLANG_TIDY "Enable clang-tidy integration in cmake" OFF)
0029 if(ENABLE_CLANG_TIDY)
0030   find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
0031   if (CLANG_TIDY_EXE)
0032     message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
0033     set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" CACHE STRING "" FORCE)
0034   else()
0035     set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE)
0036   endif()
0037 endif()
0038 
0039 # Set default build type
0040 set(default_build_type "Release")
0041 if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
0042   set(default_build_type "RelWithDebInfo")
0043 endif()
0044 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
0045   message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
0046   set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
0047       STRING "Choose the type of build." FORCE)
0048   # Set the possible values of build type for cmake-gui
0049   set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
0050     "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
0051 endif()
0052 
0053 # Set all warnings
0054 if(NOT CMAKE_BUILD_TYPE MATCHES Release)
0055   add_compile_options(-Wall -Wextra -Werror -Wno-error=deprecated-declarations)
0056 endif()
0057 
0058 # Install to the top directory by default
0059 if( ${CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT} )
0060     set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR} CACHE PATH "Install in top directory by default" FORCE)
0061 endif()
0062 
0063 find_package(Microsoft.GSL CONFIG)
0064 find_package(EDM4EIC REQUIRED)
0065 find_package(EDM4HEP 0.4.1 REQUIRED)
0066 find_package(DD4hep COMPONENTS DDRec REQUIRED)
0067 find_package(fmt REQUIRED)
0068 
0069 include(GNUInstallDirs)
0070 include(algorithmsComponentsHelpers) # handle components via add_..._if commands
0071 
0072 add_component(core Core)
0073 
0074 # FIXME: add directory as soon as one algorithm converted
0075 #add_component(acts Acts)
0076 add_component(calorimetry Calorimetry)
0077 #add_component(dis DIS)
0078 #add_component(far_forward Far_Forward)
0079 #add_component(pid PID)
0080 #add_component(tracking Tracking)
0081 add_component(truth Truth)
0082 #add_component(utility Utility)
0083 
0084 # create cmake configuration files
0085 include(algorithmsCreatePackageConfig)