Back to home page

EIC code displayed by LXR

 
 

    


Warning, /npsim/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
0002 
0003 project(npsim
0004   VERSION 1.0.0
0005   LANGUAGES CXX)
0006 
0007 # C++ standard
0008 set(CMAKE_CXX_STANDARD 17)
0009 set(CMAKE_CXX_STANDARD 17 CACHE STRING "Set the C++ standard to be used")
0010 if(NOT CMAKE_CXX_STANDARD MATCHES "17|20|23")
0011   message(FATAL_ERROR "Unsupported C++ standard: ${CMAKE_CXX_STANDARD}")
0012 endif()
0013 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0014 set(CMAKE_CXX_EXTENSIONS OFF)
0015 
0016 # Install prefix
0017 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
0018   set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
0019   set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Install prefix" FORCE)
0020   message(STATUS "Setting default install prefix: ${CMAKE_INSTALL_PREFIX}")
0021 endif()
0022 
0023 # Use GNU install dirs
0024 include(GNUInstallDirs)
0025 
0026 # Build type
0027 if (NOT CMAKE_BUILD_TYPE)
0028   set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type configuration" FORCE)
0029   message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}")
0030 endif()
0031 
0032 # Error on all warnings
0033 if(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
0034   add_compile_options(-Wall -Wextra -Werror -pedantic)
0035 endif()
0036 
0037 # Export compile commands as json for run-clang-tidy
0038 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
0039 
0040 # ---------------------------------------------------------------------------
0041 # Options
0042 
0043 set(USE_GEOCAD ON CACHE BOOL "build the geocad library. Requires opencascade")
0044 
0045 # ---------------------------------------------------------------------------
0046 # Load additional OS dependent settings
0047 
0048 if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
0049   ## OSX/homebrew version of root6 installs its cmake macros in a non-standard
0050   ## location. This might be an issue on other systems as well.
0051   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} $ENV{ROOTSYS}/etc/root/cmake)
0052 
0053   ## Get rid of rpath warning on OSX
0054   set(CMAKE_MACOSX_RPATH 1)
0055 endif()
0056 
0057 #----------------------------------------------------------------------------
0058 # Find Libraries
0059 #----------------------------------------------------------------------------
0060 
0061 # DD4hep
0062 find_package(DD4hep 1.18 REQUIRED COMPONENTS DDCore DDG4)
0063 include(${DD4hep_DIR}/cmake/DD4hep.cmake)
0064 include(${DD4hep_DIR}/cmake/DD4hepBuild.cmake)
0065 
0066 dd4hep_configure_output()
0067 dd4hep_set_compiler_flags()
0068 
0069 # Opencascade
0070 if(USE_GEOCAD)
0071   find_package(OpenCASCADE REQUIRED)
0072 endif()
0073 
0074 # libfmt
0075 find_package(fmt REQUIRED)
0076 
0077 #-----------------------------------------
0078 # add the library sub directories
0079 add_subdirectory(src/plugins)
0080 add_subdirectory(src/dd4pod)
0081 add_subdirectory(src/geocad)
0082 add_subdirectory(src/config)
0083 add_subdirectory(src/tools)
0084 
0085 #----------------------------------------------------------------------------
0086 # Install and export targets
0087 install(EXPORT NPDetTargets
0088     FILE NPDetTargets.cmake
0089     NAMESPACE NPDet::
0090     DESTINATION lib/NPDet
0091     )
0092 
0093 include(CMakePackageConfigHelpers)
0094 
0095 set(TARGETS_INSTALL_PATH lib/NPDet/NPDetTargets.cmake)
0096 CONFIGURE_PACKAGE_CONFIG_FILE(
0097     cmake/NPDetConfig.cmake.in
0098     ${CMAKE_CURRENT_BINARY_DIR}/NPDetConfig.cmake
0099     INSTALL_DESTINATION lib/NPDet
0100     PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR TARGETS_INSTALL_PATH
0101     )
0102 
0103 write_basic_package_version_file("NPDetConfigVersion.cmake"
0104     VERSION ${NPDet_VERSION}
0105     COMPATIBILITY SameMajorVersion
0106     )
0107 
0108 install(FILES
0109     ${CMAKE_CURRENT_BINARY_DIR}/NPDetConfig.cmake
0110     ${CMAKE_CURRENT_BINARY_DIR}/NPDetConfigVersion.cmake
0111     DESTINATION lib/NPDet
0112     )
0113 
0114 install(PROGRAMS
0115   scripts/sanitize_hepmc3.py DESTINATION bin RENAME sanitize_hepmc3
0116     )