diff --git a/CMakeLists.txt b/CMakeLists.txt index 3307213ad9..b2ccdc6660 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,34 +5,21 @@ # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ -# The name of our project is "FairBase". CMakeLists files in this project can +# The name of our project is "FairRoot". CMakeLists files in this project can # refer to the root source directory of the project as ${FAIRROOT_SOURCE_DIR} or # as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as # ${FAIRROOT_BINARY_DIR} or ${CMAKE_BINARY_DIR}. # This difference is important for the base classes which are in FAIRROOT -# and PANDAROOT. +# and the subproject (i.e: CbmRoot, Pandaroot,... etc). # Check if cmake has the required version CMAKE_MINIMUM_REQUIRED(VERSION 3.11.0 FATAL_ERROR) -### CMP0025 Compiler id for Apple Clang is now AppleClang. -### CMP0042 MACOSX_RPATH is enabled by default. - -foreach(p - CMP0025 # CMake 3.0 - CMP0028 # double colon for imported and alias targets - CMP0042 # CMake 3.0 - CMP0054 # Only interpret ``if()`` arguments as variables or keywords when unquoted. - ) - if(POLICY ${p}) - cmake_policy(SET ${p} NEW) - endif() -endforeach() - +set(CMAKE_INSTALL_MESSAGE LAZY) # Set project version SET(FAIRROOT_MAJOR_VERSION 18) SET(FAIRROOT_MINOR_VERSION 0) -SET(FAIRROOT_PATCH_VERSION 1) +SET(FAIRROOT_PATCH_VERSION 7) # Set name of our project to "FAIRROOT". # Has to be done after check of cmake version @@ -42,7 +29,7 @@ project(FAIRROOT VERSION ${FAIRROOT_MAJOR_VERSION}.${FAIRROOT_MINOR_VERSION}.${F # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ # is checked set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/cuda" ${CMAKE_MODULE_PATH}) +#set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/cuda" ${CMAKE_MODULE_PATH}) if(APPLE) # Configure RPATH entries on macOS @@ -83,6 +70,10 @@ include(WriteConfigFile) include(Dart) include(CheckCompiler) + +set_fairroot_cmake_policies() + + #Check the compiler and set the compile and link flags Check_Compiler() @@ -161,17 +152,21 @@ if(SIMPATH) endif() # FairRoot only supports ROOT6, so check which version is available -find_package(ROOT 6.10.00 REQUIRED) -find_package(FairLogger 1.1.0 REQUIRED) -find_package(Pythia6) -find_package(Pythia8) +find_package2(PUBLIC ROOT VERSION 6.10.00 REQUIRED) +find_package2(PUBLIC FairLogger VERSION 1.2.0 REQUIRED) +find_package2(PUBLIC Pythia6) +find_package2(PUBLIC Pythia8) +find_package2(PUBLIC Protobuf) +find_package2(PUBLIC msgpack) +find_package2(PUBLIC FlatBuffers) + if(FAIRROOT_MODULAR_BUILD) # Geant3, Geant4 installed via cmake - Message(STATUS "Looking for GEANT3...") - Find_Package(Geant3) - # Fill the variables needed to create the config script + #Message(STATUS "Looking for GEANT3...") + Find_Package2(PUBLIC Geant3) If(Geant3_DIR) + list(APPEND PROJECT_PACKAGE_COMPONENTS Geant3) Set(GEANT3_INCLUDE_DIR ${Geant3_INCLUDE_DIRS}) Set(GEANT3_LIBRARIES ${Geant3_LIBRARIES}) Set(GEANT3_LIBRARY_DIR ${Geant3_DIR}/..) @@ -186,17 +181,17 @@ if(FAIRROOT_MODULAR_BUILD) Set(GEANT3_FOUND FALSE) Message(Status "Looking for GEANT3... - Not found ") EndIf() - Message(STATUS "Looking for GEANT4...") - Find_Package(Geant4) + #Message(STATUS "Looking for GEANT4...") + find_package2(PUBLIC Geant4) If(Geant4_DIR) Set(GEANT4_INCLUDE_DIR ${Geant4_INCLUDE_DIRS}) Set(GEANT4_LIBRARY_DIR "${Geant4_DIR}/..") Set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${GEANT4_LIBRARY_DIR}) Set(GEANT4_SHARE_DIR "${Geant4_DIR}/../../share") Set(GEANT4_FOUND TRUE) - Message(STATUS "Looking for GEANT4... - found ${GEANT4_LIBRARY_DIR}") + # Message(STATUS "Looking for GEANT4... - found ${GEANT4_LIBRARY_DIR}") Set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules_old" ${CMAKE_MODULE_PATH}) - Find_Package(GEANT4DATA) + Find_Package2(PUBLIC GEANT4DATA) Else() Set(GEANT4_FOUND FALSE) Message(Status "Looking for GEANT4... - Not found ") @@ -204,7 +199,7 @@ if(FAIRROOT_MODULAR_BUILD) # Checking for Genat4VMC has to be done in a better way. # In the moment the Geant4VMC version is hardcoded Message(STATUS "Looking for GEANT4VMC...") - Find_Package(Geant4VMC) + Find_Package2(PUBLIC Geant4VMC) If(Geant4VMC_DIR) Set(GEANT4VMC_INCLUDE_DIR ${Geant4VMC_INCLUDE_DIRS}) Set(GEANT4VMC_LIBRARY_DIR "${Geant4VMC_DIR}/..") @@ -215,10 +210,11 @@ if(FAIRROOT_MODULAR_BUILD) NO_DEFAULT_PATH ) Set(GEANT4VMC_FOUND TRUE) - Message(STATUS "Looking for GEANT4VMC... - found ${GEANT4VMC_LIBRARY_DIR}") + # Message(STATUS "Looking for GEANT4VMC... - found ${GEANT4VMC_LIBRARY_DIR}") EndIf() - Message(STATUS "Looking for VGM...") - Find_Package(VGM) + + Find_Package2(PUBLIC VGM) + If(VGM_DIR) Set(VGM_INCLUDE_DIR ${VGM_INCLUDE_DIRS}) Set(VGM_LIBRARY_DIR "${VGM_DIR}/..") @@ -227,30 +223,37 @@ if(FAIRROOT_MODULAR_BUILD) Message(STATUS "Looking for VGM... - found ${VGM_LIBRARY_DIR}") EndIf() else(FAIRROOT_MODULAR_BUILD) - # For old versions of VMC packages (to be removed) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules_old" ${CMAKE_MODULE_PATH}) - find_package(GEANT3) - find_package(GEANT4) - find_package(GEANT4DATA) - find_package(GEANT4VMC) + find_package2(PUBLIC GEANT3) + find_package2(PUBLIC GEANT4) + find_package2(PUBLIC GEANT4DATA) + Find_Package2(PUBLIC VGM) + find_package2(PUBLIC GEANT4VMC) find_package(CLHEP) endif(FAIRROOT_MODULAR_BUILD) -find_package(CUDA) -find_package(IWYU) -if(NOT DISABLE_GO) - find_package(Go 1.7) +#find_package(CUDA) +find_package2( PUBLIC IWYU) + +if(WITH_GO_EXAMPLE) + find_package2(PUBLIC Go VERSION 1.7) + if(Go_FOUND) + set(Go_VERSION "${GO_VERSION}") + set(Go_ROOT "${GO_EXECUTABLE}" ) + endif() endif() -find_package(GSL) + +find_package2(PUBLIC GSL) if(NOT DEFINED GTEST_ROOT) set(GTEST_ROOT ${SIMPATH}) endif() -find_package(FairMQ 1.2.3) + +find_package2(PUBLIC FairMQ VERSION 1.2.3) If(WITH_DBASE) - find_package(MYSQL) - find_package(PGSQL) - find_package(SQLITE) + find_package2(PUBLIC MYSQL) + find_package2(PUBLIC PGSQL) + find_package2(PUBLIC SQLITE) EndIf(WITH_DBASE) If(FAIRSOFT_EXTERN) @@ -265,7 +268,7 @@ if(NOT DEFINED Boost_NO_SYSTEM_PATHS) Set(Boost_NO_SYSTEM_PATHS TRUE) endif() Set(Boost_NO_BOOST_CMAKE TRUE) -Message("-- Looking for Boost ...") +#Message("-- Looking for Boost ...") # If an older version of boost is found both of the variables below are # cached and in a second cmake run, a good boost version is found even # if the version is to old. @@ -273,10 +276,13 @@ Message("-- Looking for Boost ...") # for boost. Unset(Boost_INCLUDE_DIR CACHE) Unset(Boost_LIBRARY_DIRS CACHE) -set(FairRoot_Boost_COMPONENTS thread system timer program_options random filesystem chrono exception regex serialization log log_setup atomic date_time signals) -list(APPEND FairRoot_Boost_COMPONENTS ${FairMQ_Boost_COMPONENTS}) -list(REMOVE_DUPLICATES FairRoot_Boost_COMPONENTS) -find_package(Boost 1.67 COMPONENTS ${FairRoot_Boost_COMPONENTS}) + +find_package2(PUBLIC Boost + VERSION 1.67 ${FairMQ_Boost_VERSION} + COMPONENTS thread system timer program_options random filesystem chrono exception regex serialization log log_setup atomic date_time signals ${FairMQ_Boost_COMPONENTS} +) + + If (Boost_FOUND) Set(Boost_Avail 1) Set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${Boost_LIBRARY_DIR}) @@ -377,14 +383,12 @@ endif(IWYU_FOUND) Option(BUILD_UNITTESTS "Build all unittests and add them as new tests" OFF) -Message("Test_Model: ${CMAKE_BUILD_TYPE}") +#Message("Test_Model: ${CMAKE_BUILD_TYPE}") If(${CMAKE_BUILD_TYPE} MATCHES PROFILE) Set(BUILD_UNITTESTS ON) EndIf() If(BUILD_UNITTESTS) - Message("Build the unit tests.") - If(GTEST_FOUND) Message("Add tests library and tests.") add_subdirectory(test) @@ -402,28 +406,26 @@ Install(FILES ${CMAKE_BINARY_DIR}/config.sh_install RENAME FairRootConfig.sh ) -Install(FILES ${CMAKE_BINARY_DIR}/check_system.sh - DESTINATION bin - ) +Install(FILES ${CMAKE_BINARY_DIR}/check_system.sh + DESTINATION bin + ) Install(FILES ${CMAKE_BINARY_DIR}/FairVersion.h - DESTINATION include - ) - + DESTINATION include + ) Install(FILES ${CMAKE_BINARY_DIR}/config.csh_install - DESTINATION bin - RENAME FairRootConfig.csh - ) - + DESTINATION bin + RENAME FairRootConfig.csh + ) Install(FILES ${CMAKE_BINARY_DIR}/check_system.csh - DESTINATION bin - ) + DESTINATION bin + ) + Install(DIRECTORY cmake + DESTINATION share/fairbase + PATTERN ".svn" EXCLUDE) -Install(DIRECTORY cmake - DESTINATION share/fairbase - PATTERN ".svn" EXCLUDE) - -Find_Package(Git) +find_package2(PUBLIC Git) +set (Git_VERSION ${GIT_VERSION_STRING}) If(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git") Execute_Process(COMMAND ${GIT_EXECUTABLE} describe --tags @@ -440,16 +442,126 @@ Install(PROGRAMS ${CMAKE_BINARY_DIR}/fairroot-config DESTINATION bin ) -if(NOT FAIRROOT_MINIMAL) - WRITE_CONFIG_FILE(config.sh) - WRITE_CONFIG_FILE(config.csh) +WRITE_CONFIG_FILE(config.sh) +WRITE_CONFIG_FILE(config.csh) +SET(VMCWORKDIR ${CMAKE_INSTALL_PREFIX}/share/fairbase/examples) +SET(ROOT_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include) +WRITE_CONFIG_FILE(config.sh_install) +WRITE_CONFIG_FILE(config.csh_install) + +# Summary ###################################################################### +if(CMAKE_CXX_FLAGS) + message(STATUS " ") + message(STATUS " ${Cyan}GLOBAL CXX FLAGS${CR} ${BGreen}${CMAKE_CXX_FLAGS}${CR}") +endif() +if(CMAKE_CONFIGURATION_TYPES) + message(STATUS " ") + message(STATUS " ${Cyan}BUILD TYPE CXX FLAGS${CR}") + string(TOUPPER "${CMAKE_BUILD_TYPE}" selected_type) + foreach(type IN LISTS CMAKE_CONFIGURATION_TYPES) + string(TOUPPER "${type}" type_upper) + if(type_upper STREQUAL selected_type) + pad("${type}" 18 " " type_padded) + message(STATUS "${BGreen}* ${type_padded}${CMAKE_CXX_FLAGS_${type_upper}}${CR}") + else() + pad("${type}" 18 " " type_padded) + message(STATUS " ${BWhite}${type_padded}${CR}${CMAKE_CXX_FLAGS_${type_upper}}") + endif() + unset(type_padded) + unset(type_upper) + endforeach() + message(STATUS " ") + message(STATUS " (Change the build type with ${BMagenta}-DCMAKE_BUILD_TYPE=...${CR})") +endif() + +################################################################################ +if(PROJECT_PACKAGE_DEPENDENCIES) + message(STATUS " ") + message(STATUS " ${Cyan}DEPENDENCY FOUND VERSION PREFIX${CR}") + foreach(dep IN LISTS PROJECT_PACKAGE_DEPENDENCIES) + if(${dep}_VERSION) + if(${dep} STREQUAL DDS) + set(version_str "${BGreen}${${dep}_MAJOR_VERSION}.${${dep}_MINOR_VERSION}${CR}") + else() + set(version_str "${BGreen}${${dep}_VERSION}${CR}") + endif() + if(${dep} STREQUAL Boost) + set(version_str "${BGreen}${${dep}_MAJOR_VERSION}.${${dep}_MINOR_VERSION}${CR}") + else() + set(version_str "${BGreen}${${dep}_VERSION}${CR}") + endif() + else() + set(version_str "${BYellow}unknown${CR}") + endif() + if(PROJECT_${dep}_VERSION) + set(version_req_str " (>= ${PROJECT_${dep}_VERSION})") + endif() + pad(${dep} 20 " " dep_padded) + if(DISABLE_COLOR) + pad("${version_str}${version_req_str}" 25 " " version_padded) + else() + pad("${version_str}${version_req_str}" 25 " " version_padded COLOR 1) + endif() + set(prefix ${${dep}_ROOT}) + if(${dep} STREQUAL Boost) + set(prefix ${BOOST_ROOT}) + endif() + if(${dep} STREQUAL Protobuf) + set(prefix ${Protobuf_INCLUDE_DIRS}) + endif() + if(${dep} STREQUAL msgpack) + set(prefix ${Protobuf_INCLUDE_DIRS}) + endif() + if(${dep} STREQUAL Pythia8) + set(prefix ${PYTHIA8_LIB_DIR}) + endif() + + message(STATUS " ${BWhite}${dep_padded}${CR}${version_padded}${prefix}") + + unset(version_str) + unset(version_padded) + unset(version_req_str) + endforeach() +endif() +message(STATUS " ") + +message(STATUS " ${Cyan}COMPONENT BUILT? INFO${CR}") +if(BUILD_EXAMPLES) + set(examples_summary "${BGreen}YES${CR} (default, disable with ${BMagenta}-DBUILD_EXAMPLES=OFF${CR})") +else() + set(examples_summary "${BRed} NO${CR} (enable with ${BMagenta}-DBBUILD_EXAMPLES=ON${CR})") +endif() +message(STATUS " ${BWhite}Examples${CR} ${examples_summary}") + +if(WITH_DBASE) + set(DBASE_summary "${BGreen} YES${CR} (disable with ${BMagenta}-DWITH_DBASE=OFF${CR})") +else() + set(DBASE_summary "${BRed} NO${CR} (default, enable with ${BMagenta}-DWITH_DBASE=ON${CR})") +endif() +message(STATUS " ${BWhite}FAIR-DB${CR} ${DBASE_summary}") + +if(BUILD_DOXYGEN) + set(doxygen_summary "${BGreen}YES${CR} (default, disable with ${BMagenta}-DBUILD_DOXYGENS=OFF${CR})") +else() + set(doxygen_summary "${BRed} NO${CR} (enable with ${BMagenta}-DBUILD_DOXYGEN=ON${CR})") +endif() +message(STATUS " ${BWhite}Doxygen${CR} ${doxygen_summary}") + +if(BUILD_UNITTESTS) + set(unittests_summary "${BGreen} YES${CR} (disable with ${BMagenta}-DBUILD_UNITTESTS=OFF${CR})") +else() + set(unittests_summary "${BRed} NO${CR} (default, enable with ${BMagenta}-DBUILD_UNITTESTS=ON${CR})") +endif() +message(STATUS " ${BWhite}Unit-tests${CR} ${unittests_summary}") + +if(WITH_GO_EXAMPLE) + set(Go_summary "${BGreen} YES${CR} (disable with ${BMagenta}-DWITH_GO_EXAMPLE=OFF${CR})") +else() + set(Go_summary "${BRed} NO${CR} (default, enable with ${BMagenta}-DWITH_GO_EXAMPLE=ON${CR})") +endif() +message(STATUS " ${BWhite}Go-Example ${CR} ${Go_summary}") - SET(VMCWORKDIR ${CMAKE_INSTALL_PREFIX}/share/fairbase/examples) - SET(ROOT_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include) - WRITE_CONFIG_FILE(config.sh_install) - WRITE_CONFIG_FILE(config.csh_install) -else(NOT FAIRROOT_MINIMAL) - WRITE_MINIMAL_CONFIG_FILE(config.sh) -endif(NOT FAIRROOT_MINIMAL) +message(STATUS " ") +################################################################################ diff --git a/README.md b/README.md index 35f4715c1c..92be797ae6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/639125056b554837b9fd996fb197f833)](https://www.codacy.com/app/FairRootGroup/FairRoot?utm_source=github.com&utm_medium=referral&utm_content=FairRootGroup/FairRoot&utm_campaign=Badge_Grade) +# FairRoot [![license](https://alfa-ci.gsi.de/shields/badge/license-LGPL--3.0-orange.svg)](COPYRIGHT) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/639125056b554837b9fd996fb197f833)](https://www.codacy.com/app/FairRootGroup/FairRoot?utm_source=github.com&utm_medium=referral&utm_content=FairRootGroup/FairRoot&utm_campaign=Badge_Grade) ## The FairRoot framework A simulation, reconstruction and analysis framework that is based on the ROOT system. diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 02df5b91d2..ad177f02ce 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # Create a library called "libBase" which includes the source files given in @@ -175,7 +175,7 @@ EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE} OUTPUT_VARIABLE ROOT_HAS_GDML ) If ( ${ROOT_HAS_GDML} STREQUAL yes ) - Message(STATUS "Build CbmModule with Gdml support") + Message(STATUS "Build FairModule with Gdml support") Add_Definitions(-DROOT_HAS_GDML) EndIf ( ${ROOT_HAS_GDML} STREQUAL yes ) diff --git a/cmake/cuda/FindCUDA.cmake b/cmake/cuda/FindCUDA.cmake index 9dac98c5d3..ef6be68d31 100644 --- a/cmake/cuda/FindCUDA.cmake +++ b/cmake/cuda/FindCUDA.cmake @@ -1,8 +1,8 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Tools for building CUDA C files: libraries and build dependencies. @@ -299,7 +299,7 @@ ############################################################################### # FindCUDA.cmake -Message(STATUS "Looking for CUDA...") +#Message(STATUS "Looking for CUDA...") # We need to have at least this version to support the VERSION_LESS argument to 'if' (2.6.2) and unset (2.6.3) cmake_policy(PUSH) cmake_minimum_required(VERSION 2.6.3) @@ -804,7 +804,7 @@ If(CUDA_FOUND) Message(STATUS "CUDA BLAS : ${CUDA_CUBLAS_LIBRARIES}") Message(STATUS "CUDA RAND : ${CUDA_curand_LIBRARY}") Message(STATUS "CUDA Performance Primitives library: ${CUDA_npp_LIBRARY}") - + EndIf(CUDA_FOUND) ############################################################################### @@ -1286,7 +1286,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) endif() endif() # message("_cuda_generate_dependencies = ${_cuda_generate_dependencies}") - + # If we needed to regenerate the dependency file, do so now. if (_cuda_generate_dependencies) @@ -1337,7 +1337,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # Try and reload the dependies cuda_include_nvcc_dependencies(${cmake_dependency_file}) endif() - endif() + endif() endif() # Build the generated file and dependency file ########################## diff --git a/cmake/modules/CheckCompiler.cmake b/cmake/modules/CheckCompiler.cmake index 629b4deba8..15565e61df 100644 --- a/cmake/modules/CheckCompiler.cmake +++ b/cmake/modules/CheckCompiler.cmake @@ -1,8 +1,8 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ MACRO ( Check_Compiler ) @@ -38,12 +38,14 @@ If(FAIRSOFT_CONFIG) Get_Filename_Component(FAIRSOFT_C_COMPILER ${FAIRSOFT_C_COMPILER} REALPATH) Get_Filename_Component(FAIRSOFT_CXX_COMPILER ${FAIRSOFT_CXX_COMPILER} REALPATH) Get_Filename_Component(FAIRSOFT_Fortran_COMPILER ${FAIRSOFT_Fortran_COMPILER} REALPATH) - + Set(FAIRROOT_C_COMPILER ${CMAKE_C_COMPILER}) Set(FAIRROOT_CXX_COMPILER ${CMAKE_CXX_COMPILER}) Set(FAIRROOT_Fortran_COMPILER ${CMAKE_Fortran_COMPILER}) + String(STRIP ${FAIRROOT_C_COMPILER} FAIRROOT_C_COMPILER) String(STRIP ${FAIRROOT_CXX_COMPILER} FAIRROOT_CXX_COMPILER) + If(FAIRROOT_Fortran_COMPILER) String(STRIP ${FAIRROOT_Fortran_COMPILER} FAIRROOT_Fortran_COMPILER) Get_Filename_Component(FAIRROOT_Fortran_COMPILER ${FAIRROOT_Fortran_COMPILER} REALPATH) @@ -52,7 +54,22 @@ If(FAIRSOFT_CONFIG) Get_Filename_Component(FAIRROOT_C_COMPILER ${FAIRROOT_C_COMPILER} REALPATH) Get_Filename_Component(FAIRROOT_CXX_COMPILER ${FAIRROOT_CXX_COMPILER} REALPATH) - If(NOT (${FAIRSOFT_C_COMPILER} STREQUAL ${FAIRROOT_C_COMPILER}) OR NOT (${FAIRSOFT_CXX_COMPILER} STREQUAL ${FAIRROOT_CXX_COMPILER})) + Execute_Process(COMMAND ${FAIRSOFT_C_COMPILER} --version + OUTPUT_VARIABLE FAIRSOFT_C_COMPILER_STRING + ) + + Execute_Process(COMMAND ${FAIRROOT_C_COMPILER} --version + OUTPUT_VARIABLE FAIRROOT_C_COMPILER_STRING + ) + + Execute_Process(COMMAND ${FAIRSOFT_CXX_COMPILER} --version + OUTPUT_VARIABLE FAIRSOFT_CXX_COMPILER_STRING + ) + Execute_Process(COMMAND ${FAIRROOT_CXX_COMPILER} --version + OUTPUT_VARIABLE FAIRROOT_CXX_COMPILER_STRING + ) + + If(NOT ("${FAIRSOFT_C_COMPILER_STRING}" STREQUAL "${FAIRROOT_C_COMPILER_STRING}") OR NOT ("${FAIRSOFT_CXX_COMPILER_STRING}" STREQUAL "${FAIRROOT_CXX_COMPILER_STRING}")) execute_process(COMMAND cmake -E compare_files ${FAIRSOFT_CXX_COMPILER} ${FAIRROOT_CXX_COMPILER} RESULT_VARIABLE COMPILER_DIFF) If(NOT ${COMPILER_DIFF} EQUAL 0) Message(STATUS "C compiler used for FairSoft installation: ${FAIRSOFT_C_COMPILER}") @@ -68,7 +85,7 @@ If(FAIRSOFT_CONFIG) EndIf() EndIf() - If(FAIRROOT_Fortran_COMPILER) + If(FAIRROOT_Fortran_COMPILER) If(NOT (${FAIRSOFT_Fortran_COMPILER} STREQUAL ${FAIRROOT_Fortran_COMPILER})) String(STRIP ${FAIRSOFT_Fortran_COMPILER} FAIRSOFT_Fortran_COMPILER) Message(STATUS "Fortran compiler used for FairSoft installation: ${FAIRSOFT_Fortran_COMPILER}") @@ -94,70 +111,59 @@ EndIf() if (CMAKE_SYSTEM_NAME MATCHES Linux) MESSAGE("--- Found a Linux system") if (CMAKE_COMPILER_IS_GNUCXX) - MESSAGE("--- Found GNU compiler collection") -# set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}") -# set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}") - # we profile... -# if(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) -# set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") -# set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") -# endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) + MESSAGE("--- Found GNU compiler collection") + + # Configure build types + set(CMAKE_CONFIGURATION_TYPES "RELWITHDEBINFO" "NIGHTLY" "TEST" "RELEASE" "DEBUG" "DEBUGFULL" "PROFILE" "ARRAY_CHECK") + + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -Wshadow") + set(CMAKE_CXX_FLAGS_NIGHTLY "-O0 -g -Wshadow") + set(CMAKE_CXX_FLAGS_TEST "-O2 -g -Wshadow") + set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wshadow ") + + set(CMAKE_CXX_FLAGS_DEBUG "-g -Wshadow ") + set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common -fexceptions") + set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs -Wshadow -Wall -Wextra -Wunused-variable") + set(CMAKE_CXX_FLAGS_ARRAY_CHECK "-g3 -fno-inline -ftest-coverage -fprofile-arcs -fstack-protector") + + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_C_FLAGS_RELEASE "-O2") +# set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline") + set(CMAKE_C_FLAGS_DEBUG "-g") + set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common -fexceptions") + set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs") + set(CMAKE_C_FLAGS_ARRAY_CHECK "-g3 -fno-inline -ftest-coverage -fprofile-arcs -fstack-protector") - # Select flags. - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -Wshadow") - set(CMAKE_CXX_FLAGS_NIGHTLY "-O0 -g -Wshadow") - set(CMAKE_CXX_FLAGS_TEST "-O2 -g -Wshadow") - set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wshadow ") -# set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline") - set(CMAKE_CXX_FLAGS_DEBUG "-g -Wshadow ") - set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common -fexceptions") - set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs -Wshadow -Wall -Wextra -Wunused-variable") - set(CMAKE_CXX_FLAGS_ARRAY_CHECK "-g3 -fno-inline -ftest-coverage -fprofile-arcs -fstack-protector") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") - set(CMAKE_C_FLAGS_RELEASE "-O2") -# set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline") - set(CMAKE_C_FLAGS_DEBUG "-g") - set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common -fexceptions") - set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs") - set(CMAKE_C_FLAGS_ARRAY_CHECK "-g3 -fno-inline -ftest-coverage -fprofile-arcs -fstack-protector") - -# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") -# set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common") endif (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_C_COMPILER MATCHES "icc") MESSAGE("--- Found Intel compiler collection") -# set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}") -# set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}") - # Select flags. - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g ") - set(CMAKE_CXX_FLAGS_RELEASE "-O2") - set(CMAKE_CXX_FLAGS_DEBUG "-O2 -g -0b0 -noalign") - set(CMAKE_CXX_FLAGS_DEBUGFULL "-g -Ob0 -noalign -W") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") - set(CMAKE_C_FLAGS_RELEASE "-O2") - set(CMAKE_C_FLAGS_DEBUG "-O2 -g -Ob0 -noalign") - set(CMAKE_C_FLAGS_DEBUGFULL "-g -Ob0 -noalign -W") - -# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi -Wpointer-arith -fno-common") -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -Wpointer-arith -fno-exceptions -fno-common") - - # Get the directory where to find libimf. The only way I found is to get the install dir from icpc and - # from there one knows where the the libraries are installed - Execute_process(COMMAND which icpc OUTPUT_VARIABLE _bla) - String(REPLACE "bin" "compiler/lib" _intel_lib_dirs ${_bla}) - String(REPLACE "/icpc" "" _intel_lib_dirs ${_intel_lib_dirs}) - String(STRIP ${_intel_lib_dirs} _intel_lib_dirs) + set(CMAKE_CONFIGURATION_TYPES "RELWITHDEBINFO" "RELEASE" "DEBUG" "DEBUGFULL") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g ") + set(CMAKE_CXX_FLAGS_RELEASE "-O2") + set(CMAKE_CXX_FLAGS_DEBUG "-O2 -g -0b0 -noalign") + set(CMAKE_CXX_FLAGS_DEBUGFULL "-g -Ob0 -noalign -W") + + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_C_FLAGS_RELEASE "-O2") + set(CMAKE_C_FLAGS_DEBUG "-O2 -g -Ob0 -noalign") + set(CMAKE_C_FLAGS_DEBUGFULL "-g -Ob0 -noalign -W") + # Get the directory where to find libimf. The only way I found is to get the install dir from icpc and + # from there one knows where the the libraries are installed + Execute_process(COMMAND which icpc OUTPUT_VARIABLE _bla) + String(REPLACE "bin" "compiler/lib" _intel_lib_dirs ${_bla}) + String(REPLACE "/icpc" "" _intel_lib_dirs ${_intel_lib_dirs}) + String(STRIP ${_intel_lib_dirs} _intel_lib_dirs) endif (CMAKE_C_COMPILER MATCHES "icc") - if (CMAKE_C_COMPILER MATCHES "clang") - MESSAGE("--- Clang compiler") - # Select flags. + if (CMAKE_C_COMPILER MATCHES "clang") + MESSAGE("-- Clang compiler") - set(CMAKE_C_FLAGS_PROFILE "--coverage -g3") - set(CMAKE_CXX_FLAGS_PROFILE "--coverage -g3") + # Select flags. + set(CMAKE_C_FLAGS_PROFILE "--coverage -g3") + set(CMAKE_CXX_FLAGS_PROFILE "--coverage -g3") endif (CMAKE_C_COMPILER MATCHES "clang") endif (CMAKE_SYSTEM_NAME MATCHES Linux) @@ -165,9 +171,9 @@ endif (CMAKE_SYSTEM_NAME MATCHES Linux) if (CMAKE_SYSTEM_NAME MATCHES Darwin) EXEC_PROGRAM("sw_vers -productVersion | cut -d . -f 1-2" OUTPUT_VARIABLE MAC_OS_VERSION) - MESSAGE("--- Found a Mac OS X System ${MAC_OS_VERSION}") + MESSAGE("-- Found a Mac OS X System ${MAC_OS_VERSION}") if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - MESSAGE("--- Found GNU compiler collection") + MESSAGE("-- Found GNU compiler collection") STRING(COMPARE EQUAL "10.5" "${MAC_OS_VERSION}" MAC_OS_10_5) STRING(COMPARE EQUAL "10.6" "${MAC_OS_VERSION}" MAC_OS_10_6) @@ -204,41 +210,42 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin) Get_Filename_Component(FORTRAN_LIBDIR ${FORTRAN_LIBDIR} PATH ) - Message("Fortran libraries found in ${FORTRAN_LIBDIR}") + Message("-- Fortran libraries found in ${FORTRAN_LIBDIR}") SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup") - # Select flags. + # Configure build types + set(CMAKE_CONFIGURATION_TYPES "RELWITHDEBINFO" "NIGHTLY" "RELEASE" "DEBUG" "DEBUGFULL" "PROFILE") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -Wshadow ") set(CMAKE_CXX_FLAGS_NIGHTLY "-O2 -g -Wshadow -Wall -Wextra") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wshadow ") set(CMAKE_CXX_FLAGS_DEBUG "-g -Wshadow -fno-inline") set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common") set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs -Wall -Wextra") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-g -fno-inline") set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs") - + else (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") Message("CXX Compiler: ${CMAKE_CXX_COMPILER}") Message("CXX Compiler ABI: ${CMAKE_CXX_COMPILER_ABI}") Message("CXX Compiler ID: ${CMAKE_CXX_COMPILER_ID}") - MESSAGE(FATAL_ERROR "This compiler is not known.") + MESSAGE(FATAL_ERROR "This compiler is not known.") endif (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif (CMAKE_SYSTEM_NAME MATCHES Darwin) - if (CMAKE_BUILD_TYPE) STRING(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER) SET(CMAKE_BUILD_TYPE_CXXFLAGS_KEY CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER}) endif () -MESSAGE("--- Build Type: ${CMAKE_BUILD_TYPE}") -MESSAGE("--- Compiler Flags: ${CMAKE_CXX_FLAGS} ${${CMAKE_BUILD_TYPE_CXXFLAGS_KEY}}") +#MESSAGE("--- Build Type: ${CMAKE_BUILD_TYPE}") +#MESSAGE("--- Compiler Flags: ${CMAKE_CXX_FLAGS} ${${CMAKE_BUILD_TYPE_CXXFLAGS_KEY}}") ENDMACRO ( Check_Compiler ) diff --git a/cmake/modules/FairMacros.cmake b/cmake/modules/FairMacros.cmake index aac4c562f6..6fb94f3edc 100644 --- a/cmake/modules/FairMacros.cmake +++ b/cmake/modules/FairMacros.cmake @@ -1,152 +1,168 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - ########################################### - # - # Usefull macros - # - ########################################### - - ############################################################### - # - # Exchange file extention of LIST from - # FILE_EXT1 to FILE_EXT2 and assign the - # newly created list to OUTVAR. The input - # list LIST is not changed at all - # Ex: CHANGE_FILE_EXTENSION(*.cxx *.h TRD_HEADERS "${TRD_SRCS}") - # - ################################################################ - +################################################################################ +# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# # +# This software is distributed under the terms of the # +# GNU Lesser General Public Licence (LGPL) version 3, # +# copied verbatim in the file "LICENSE" # +################################################################################ + +#Defines some variables with console color escape sequences + if(NOT WIN32 AND NOT DISABLE_COLOR) + string(ASCII 27 Esc) + set(CR "${Esc}[m") + set(CB "${Esc}[1m") + set(Red "${Esc}[31m") + set(Green "${Esc}[32m") + set(Yellow "${Esc}[33m") + set(Blue "${Esc}[34m") + set(Magenta "${Esc}[35m") + set(Cyan "${Esc}[36m") + set(White "${Esc}[37m") + set(BRed "${Esc}[1;31m") + set(BGreen "${Esc}[1;32m") + set(BYellow "${Esc}[1;33m") + set(BBlue "${Esc}[1;34m") + set(BMagenta "${Esc}[1;35m") + set(BCyan "${Esc}[1;36m") + set(BWhite "${Esc}[1;37m") + endif() + +################################################################################ +#Sets CMake policies. +MACRO(set_fairroot_cmake_policies) +#Find more details to each policy with cmake-- help - policy CMPXXXX + foreach(policy + CMP0025 # Compiler id for Apple Clang is now AppleClang. + CMP0028 # Double colon in target name means ALIAS or IMPORTED target. + CMP0042 # MACOSX_RPATH is enabled by default. + CMP0048 # The ``project()`` command manages VERSION variables. + CMP0054 # Only interpret ``if()`` arguments as variables or keywords when unquoted. + ) + if(POLICY ${policy}) + cmake_policy(SET ${policy} NEW) + endif() + endforeach() +ENDMACRO() + +################################################################################ +MACRO(SUBDIRLIST result curdir) + FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) + SET(dirlist "") + FOREACH(child ${children}) + IF(IS_DIRECTORY ${curdir}/${child}) + LIST(APPEND dirlist ${child}) + ENDIF() + ENDFOREACH() + SET(${result} ${dirlist}) +ENDMACRO() + +################################################################################ +# +#Exchange file extention of LIST from +#FILE_EXT1 to FILE_EXT2 and assign the +#newly created list to OUTVAR.The input +#list LIST is not changed at all +#Ex : CHANGE_FILE_EXTENSION(*.cxx *.h TRD_HEADERS "${TRD_SRCS}") +# +################################################################################ MACRO (CHANGE_FILE_EXTENSION FILE_EXT1 FILE_EXT2 OUTVAR LIST) - SET(BLA) - IF (${FILE_EXT1} MATCHES "^[*][.]+.*$") - STRING(REGEX REPLACE "^[*]+([.].*)$" "\\1" FILE_EXT1_NEW ${FILE_EXT1}) + STRING(REGEX REPLACE "^[*]+([.].*)$" "\\1" FILE_EXT1_NEW ${FILE_EXT1}) ENDIF (${FILE_EXT1} MATCHES "^[*][.]+.*$") - IF (${FILE_EXT2} MATCHES "^[*][.]+.*$") - STRING(REGEX REPLACE "^[*]+([.].*)" "\\1" FILE_EXT2_NEW ${FILE_EXT2}) + STRING(REGEX REPLACE "^[*]+([.].*)" "\\1" FILE_EXT2_NEW ${FILE_EXT2}) ENDIF (${FILE_EXT2} MATCHES "^[*][.]+.*$") - foreach (_current_FILE ${LIST}) - STRING(REGEX REPLACE "^(.*)${FILE_EXT1_NEW}$" "\\1${FILE_EXT2_NEW}" test ${_current_FILE}) SET (BLA ${BLA} ${test}) - endforeach (_current_FILE ${ARGN}) - SET (${OUTVAR} ${BLA}) - - - ENDMACRO (CHANGE_FILE_EXTENSION) - ###################################################### - # - # Macro get string with a colon seperated string of - # pathes or any other colon sperated list. - # First the string is seperated and the entries are - # filled into a list. - # Loop over the list and searches for the occurence - # of keywords which are provided as a list. - # If the keyword occurs this path (entry) is - # deleted from the list. Returns the list of pathes - # (entries) wich survives the loop. - # - # PATH: colon separated string of pathes or other - # input entries - # LIST_OF_KEYWORDS: list of the keywords which - # should be excluded in the output - # OUTVAR: name of the variable which should be filled - # with the resulting output list - # - ###################################################### +################################################################################ +# +# Macro get string with a colon seperated string of +# pathes or any other colon sperated list. +# First the string is seperated and the entries are +# filled into a list. +# Loop over the list and searches for the occurence +# of keywords which are provided as a list. +# If the keyword occurs this path (entry) is +# deleted from the list. Returns the list of pathes +# (entries) wich survives the loop. +# +# PATH: colon separated string of pathes or other +# input entries +# LIST_OF_KEYWORDS: list of the keywords which +# should be excluded in the output +# OUTVAR: name of the variable which should be filled +# with the resulting output list +# +################################################################################ MACRO (CLEAN_PATH_LIST PATH LIST_OF_KEYWORDS OUTVAR) - SET(BLA "") - STRING(REGEX MATCHALL "[^:]+" PATH1 ${PATH}) - FOREACH(_current_PATH ${PATH1}) - SET(KEYWORD_FOUND FALSE) - FOREACH(_current_KEYWORD ${LIST_OF_KEYWORDS}) - IF (${_current_PATH} MATCHES "${_current_KEYWORD}") SET(KEYWORD_FOUND TRUE) ENDIF (${_current_PATH} MATCHES "${_current_KEYWORD}") - ENDFOREACH(_current_KEYWORD ${LIST_OF_KEYWORDS}) - IF (NOT KEYWORD_FOUND) SET(BLA ${BLA} ${_current_PATH}) - ENDIF (NOT KEYWORD_FOUND) - + ENDIF (NOT KEYWORD_FOUND) ENDFOREACH(_current_PATH ${PATH1}) - UNIQUE(${OUTVAR} "${BLA}") - ENDMACRO (CLEAN_PATH_LIST) - ########################################################## - # - # The macro checks if the user wants to build the project - # in the source directory and if so stop the execution - # of cmake with an error message. - # - ########################################################## +################################################################################# +# The macro checks if the user wants to build the project +# in the source directory and if so stop the execution +# of cmake with an error message. +# +################################################################################ MACRO (CHECK_OUT_OF_SOURCE_BUILD) - STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource) IF(insource) FILE(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/Testing) FILE(REMOVE ${CMAKE_SOURCE_DIR}/DartConfiguration.tcl) - MESSAGE(FATAL_ERROR "FAIRROOT should be installed as an out of source build, to keep the source directory clean. Please create a extra build directory and run the command 'cmake path_to_source_dir' in this newly created directory. You have also to delete the directory CMakeFiles and the file CMakeCache.txt in the source directory. Otherwise cmake will complain even if you run it from an out-of-source directory.") + MESSAGE(FATAL_ERROR "FAIRROOT should be installed as an out of source build, to keep the source directory clean. Please create a extra build directory and run the command 'cmake path_to_source_dir' in this newly created directory. You have also to delete the directory CMakeFiles and the file CMakeCache.txt in the source directory. Otherwise cmake will complain even if you run it from an out-of-source directory.") ENDIF(insource) ENDMACRO (CHECK_OUT_OF_SOURCE_BUILD) - ########################################################## - # - # The macro checks if the build directory is different from the - # installation directory. In case both are the same - # stop the execution of cmake with an error message. - # - ########################################################## - -Macro (CHECK_INSTALL_DIRECTORY) +################################################################################# +# The macro checks if the build directory is different from the +# installation directory. In case both are the same +# stop the execution of cmake with an error message. +# +################################################################################ +MACRO (CHECK_INSTALL_DIRECTORY) String(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "${CMAKE_BINARY_DIR}" _same) If(_same) MESSAGE(FATAL_ERROR "Your build and installation directory is the same one. This option does not work. Please change either your build or your installation directory and rerun cmake.") EndIf(_same) - EndMacro (CHECK_INSTALL_DIRECTORY) +################################################################################ -Macro(CHECK_EXTERNAL_PACKAGE_INSTALL_DIR) +MACRO(CHECK_EXTERNAL_PACKAGE_INSTALL_DIR) If(IS_DIRECTORY ${SIMPATH}/bin) Set(FAIRSOFT_EXTERN TRUE) Else(IS_DIRECTORY ${SIMPATH}/bin) Set(FAIRSOFT_EXTERN FALSE) EndIf(IS_DIRECTORY ${SIMPATH}/bin) EndMacro(CHECK_EXTERNAL_PACKAGE_INSTALL_DIR) - - MACRO(UNIQUE var_name list) - - ####################################################################### - # Make the given list have only one instance of each unique element and - # store it in var_name. - ####################################################################### +################################################################################ +# Make the given list have only one instance of each unique element and +# store it in var_name. +################################################################################ SET(unique_tmp "") FOREACH(l ${list}) @@ -157,12 +173,10 @@ MACRO(UNIQUE var_name list) ENDFOREACH(l) SET(${var_name} ${unique_tmp}) ENDMACRO(UNIQUE) - - -################################################### -# Creates a variable which stores the intersection +################################################################################ +# Creates a variable which stores the intersection # between two lists -#################################################### +################################################################################ MACRO(INTERSECTION var_name list1 list2) # Store the intersection between the two given lists in var_name. @@ -174,7 +188,7 @@ MACRO(INTERSECTION var_name list1 list2) ENDFOREACH(l) SET(${var_name} ${intersect_tmp}) ENDMACRO(INTERSECTION) - +################################################################################ MACRO(REMOVE_FROM_LIST var_name list1 list2) # Remove elements in list2 from list1 and store the result in var_name. SET(filter_tmp "") @@ -185,8 +199,8 @@ MACRO(REMOVE_FROM_LIST var_name list1 list2) ENDFOREACH(l) SET(${var_name} ${filter_tmp}) ENDMACRO(REMOVE_FROM_LIST) - -MACRO (GENERATE_TEST_SCRIPT SCRIPT_FULL_NAME) +################################################################################ +MACRO (GENERATE_TEST_SCRIPT SCRIPT_FULL_NAME) get_filename_component(path_name ${SCRIPT_FULL_NAME} PATH) get_filename_component(file_extension ${SCRIPT_FULL_NAME} EXT) @@ -200,10 +214,6 @@ MACRO (GENERATE_TEST_SCRIPT SCRIPT_FULL_NAME) ${PROJECT_BINARY_DIR} new_path ${path_name} ) EndIf() - -# Message("${new_path}/${shell_script_name}") -# file(MAKE_DIRECTORY ${new_path}/data) - CONVERT_LIST_TO_STRING(${LD_LIBRARY_PATH}) set(MY_LD_LIBRARY_PATH ${output}) set(my_script_name ${SCRIPT_FULL_NAME}) @@ -217,15 +227,11 @@ MACRO (GENERATE_TEST_SCRIPT SCRIPT_FULL_NAME) ${new_path}/${shell_script_name} ) ENDIF(FAIRROOT_FOUND) - - - - EXEC_PROGRAM(/bin/chmod ARGS "u+x ${new_path}/${shell_script_name}") - + EXEC_PROGRAM(/bin/chmod ARGS "u+x ${new_path}/${shell_script_name}" OUTPUT_VARIABLE tmp) ENDMACRO (GENERATE_TEST_SCRIPT) +################################################################################ -Macro(Generate_Exe_Script _Path _ExeName) - +Macro(Generate_Exe_Script _Path _ExeName) Message("PATH: ${_Path}") Message("ExeName: ${_ExeName}") @@ -242,39 +248,39 @@ Macro(Generate_Exe_Script _Path _ExeName) ${new_path}/${shell_script_name} ) - EXEC_PROGRAM(/bin/chmod ARGS "u+x ${new_path}/${shell_script_name}") + EXEC_PROGRAM(/bin/chmod ARGS "u+x ${new_path}/${shell_script_name}" OUTPUT_VARIABLE tmp ) EndMacro(Generate_Exe_Script) +################################################################################ Macro (Generate_Version_Info) IF(FAIRROOT_FOUND) - + Add_Custom_Target(svnheader ALL) - Add_Custom_Command(TARGET svnheader + Add_Custom_Command(TARGET svnheader COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${PROJECT_SOURCE_DIR} - -DBINARY_DIR=${CMAKE_BINARY_DIR} + -DBINARY_DIR=${CMAKE_BINARY_DIR} -DINCLUDE_OUTPUT_DIRECTORY=${INCLUDE_OUTPUT_DIRECTORY} -DFAIRROOT=${FAIRROOT_CMAKEMOD_DIR} -P ${FAIRROOT_CMAKEMOD_DIR}/modules/GenerateVersionInfo.cmake ) ELSE(FAIRROOT_FOUND) Add_Custom_Target(svnheader ALL) - - Add_Custom_Command(TARGET svnheader + Add_Custom_Command(TARGET svnheader COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} - -DBINARY_DIR=${CMAKE_BINARY_DIR} + -DBINARY_DIR=${CMAKE_BINARY_DIR} -DINCLUDE_OUTPUT_DIRECTORY=${INCLUDE_OUTPUT_DIRECTORY} -P ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateVersionInfo.cmake ) ENDIF(FAIRROOT_FOUND) EndMacro (Generate_Version_Info) +################################################################################ Macro (SetBasicVariables) - IF(FAIRROOT_FOUND) - Set(BASE_INCLUDE_DIRECTORIES + Set(BASE_INCLUDE_DIRECTORIES ${FAIRROOT_INCLUDE_DIR} ) Set(SYSTEM_INCLUDE_DIRECTORIES @@ -305,12 +311,12 @@ ELSE(FAIRROOT_FOUND) ${CMAKE_SOURCE_DIR}/input/db ${CMAKE_SOURCE_DIR}/dbase/dbInput ${CMAKE_SOURCE_DIR}/dbase/dbIO - ${CMAKE_SOURCE_DIR}/alignment + ${CMAKE_SOURCE_DIR}/alignment ) Set(SYSTEM_INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} - ) + ) Set(ROOT_INCLUDE_PATH ${BASE_INCLUDE_DIRECTORIES} ) @@ -320,19 +326,93 @@ ENDIF(FAIRROOT_FOUND) Set(BASE_LINK_DIRECTORIES ${ROOT_LIBRARY_DIR} ${Boost_LIBRARY_DIRS} -) +) IF(FAIRROOT_FOUND) - Set(FAIRLIBDIR ${FAIRROOT_LIBRARY_DIR}) - ELSE(FAIRROOT_FOUND) - Set(FAIRLIBDIR ${CMAKE_BINARY_DIR}/lib) - ENDIF(FAIRROOT_FOUND) - Set(LD_LIBRARY_PATH ${FAIRLIBDIR} ${LD_LIBRARY_PATH}) - - EndMacro (SetBasicVariables) + +################################################################################ +macro(find_package2 qualifier pkgname) + cmake_parse_arguments(ARGS "" "" "VERSION;COMPONENTS" ${ARGN}) + string(TOUPPER ${pkgname} pkgname_upper) + set(old_CPP ${CMAKE_PREFIX_PATH}) + set(CMAKE_PREFIX_PATH ${${pkgname_upper}_ROOT} $ENV{${pkgname_upper}_ROOT} ${CMAKE_PREFIX_PATH}) + unset(__version__) + if(ARGS_VERSION) + list(GET ARGS_VERSION 0 __version__) + list(LENGTH ARGS_VERSION __length__) + foreach(v IN LISTS ARGS_VERSION) + if(${v} VERSION_GREATER ${__version__}) + set(__version__ ${v}) + endif() + endforeach() + endif() + if(ARGS_COMPONENTS) + list(REMOVE_DUPLICATES ARGS_COMPONENTS) + find_package(${pkgname} ${__version__} QUIET COMPONENTS ${ARGS_COMPONENTS} ${ARGS_UNPARSED_ARGUMENTS}) + else() + find_package(${pkgname} ${__version__} QUIET ${ARGS_UNPARSED_ARGUMENTS}) + endif() + set(CMAKE_PREFIX_PATH ${old_CPP}) + unset(old_CPP) + if(${pkgname}_FOUND) + if(${qualifier} STREQUAL PRIVATE) + set(PROJECT_${pkgname}_VERSION ${__version__}) + set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) + set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname}) + elseif(${qualifier} STREQUAL PUBLIC) + set(PROJECT_${pkgname}_VERSION ${__version__}) + set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) + set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname}) + set(PROJECT_INTERFACE_${pkgname}_VERSION ${__version__}) + set(PROJECT_INTERFACE_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) + set(PROJECT_INTERFACE_PACKAGE_DEPENDENCIES ${PROJECT_INTERFACE_PACKAGE_DEPENDENCIES} ${pkgname}) + elseif(${qualifier} STREQUAL INTERFACE) + set(PROJECT_INTERFACE_${pkgname}_VERSION ${__version__}) + set(PROJECT_INTERFACE_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) + set(PROJECT_INTERFACE_PACKAGE_DEPENDENCIES ${PROJECT_INTERFACE_PACKAGE_DEPENDENCIES} ${pkgname}) + endif() + endif() + + unset(__version__) +endmacro() + +################################################################################ +function(pad str width char out) + cmake_parse_arguments(ARGS "" "COLOR" "" ${ARGN}) + string(LENGTH ${str} length) + if(ARGS_COLOR) + math(EXPR padding "${width}-(${length}-10*${ARGS_COLOR})") + else() + math(EXPR padding "${width}-${length}") + endif() + if(padding GREATER 0) + foreach(i RANGE ${padding}) + set(str "${str}${char}") + endforeach() + endif() + set(${out} ${str} PARENT_SCOPE) +endfunction() +################################################################################ +function(generate_package_components) + join("${PROJECT_PACKAGE_COMPONENTS}" " " COMPS) + set(PACKAGE_COMPONENTS "\ +####### Expanded from @PACKAGE_COMPONENTS@ by configure_package_config_file() ######### +set(${PROJECT_NAME}_PACKAGE_COMPONENTS ${COMPS}) +") + foreach(comp IN LISTS PROJECT_PACKAGE_COMPONENTS) + string(CONCAT PACKAGE_COMPONENTS ${PACKAGE_COMPONENTS} "\ +set(${PROJECT_NAME}_${comp}_FOUND TRUE) +") + endforeach() + string(CONCAT PACKAGE_COMPONENTS ${PACKAGE_COMPONENTS} "\ +check_required_components(${PROJECT_NAME}) +") +set(PACKAGE_COMPONENTS ${PACKAGE_COMPONENTS} PARENT_SCOPE) +endfunction() +################################################################################ diff --git a/cmake/modules/FindFlatBuffers.cmake b/cmake/modules/FindFlatBuffers.cmake index 95ff066798..31483e80ef 100644 --- a/cmake/modules/FindFlatBuffers.cmake +++ b/cmake/modules/FindFlatBuffers.cmake @@ -6,7 +6,7 @@ # copied verbatim in the file "LICENSE" # ################################################################################ -MESSAGE(STATUS "Looking for FlatBuffers...") +#MESSAGE(STATUS "Looking for FlatBuffers...") find_path(FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h PATHS ${FLATBUFFERS_PATH}/include @@ -28,9 +28,8 @@ find_path(FLATBUFFERS_BINARY_DIR NAMES flatc if(FLATBUFFERS_INCLUDE_DIR AND FLATBUFFERS_LIBRARY_DIR AND FLATBUFFERS_BINARY_DIR) set(FLATBUFFERS_FOUND true) - message(STATUS "Looking for FlatBuffers ... found at ${FLATBUFFERS_INCLUDE_DIR}") +# message(STATUS "Looking for FlatBuffers ... found at ${FLATBUFFERS_INCLUDE_DIR}") else(FLATBUFFERS_INCLUDE_DIR AND FLATBUFFERS_LIBRARY_DIR AND FLATBUFFERS_BINARY_DIR) set(FLATBUFFERS_FOUND false) message(STATUS "Looking for FlatBuffers ... not found.") endif(FLATBUFFERS_INCLUDE_DIR AND FLATBUFFERS_LIBRARY_DIR AND FLATBUFFERS_BINARY_DIR) - diff --git a/cmake/modules/FindGo.cmake b/cmake/modules/FindGo.cmake index b16292b973..c02dd77925 100644 --- a/cmake/modules/FindGo.cmake +++ b/cmake/modules/FindGo.cmake @@ -12,7 +12,7 @@ # find_package(Go 1.2 REQUIRED) -MESSAGE(STATUS "Looking for Go...") +#MESSAGE(STATUS "Looking for Go...") find_program(GO_EXECUTABLE go PATHS ENV GOROOT GOPATH GOBIN PATH_SUFFIXES bin) if (GO_EXECUTABLE) execute_process(COMMAND ${GO_EXECUTABLE} version OUTPUT_VARIABLE GO_VERSION_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/cmake/modules/FindHEPMC.cmake b/cmake/modules/FindHEPMC.cmake index 993c4e6de9..ba78db9c75 100644 --- a/cmake/modules/FindHEPMC.cmake +++ b/cmake/modules/FindHEPMC.cmake @@ -1,8 +1,8 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Try to find HEPMC instalation @@ -11,7 +11,7 @@ -MESSAGE(STATUS "Looking for HepMC ...") +#MESSAGE(STATUS "Looking for HepMC ...") FIND_PATH(HEPMC_INCLUDE_DIR NAMES HepMC/HepMCDefs.h PATHS ${HEPMC_DIR}/include @@ -41,4 +41,3 @@ else (HEPMC_FOUND) message(FATAL_ERROR "Looking for HepMC... - Not found") endif (HEPMC_FOUND_REQUIRED) endif (HEPMC_FOUND) - diff --git a/cmake/modules/FindIWYU.cmake b/cmake/modules/FindIWYU.cmake index e1810e76f7..0a9b34f76a 100644 --- a/cmake/modules/FindIWYU.cmake +++ b/cmake/modules/FindIWYU.cmake @@ -1,8 +1,8 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Try to find the include-what-you-use (IWYU) instalation @@ -13,17 +13,27 @@ # # IWYU_FOUND - system has include-what-you-use -Message(STATUS "Looking for IWYU...") +#Message(STATUS "Looking for IWYU...") Find_File(IWYU_BINARY NAMES include-what-you-use PATHS ENV PATH) + If(IWYU_BINARY) Set(IWYU_FOUND TRUE) + Execute_Process(COMMAND ${IWYU_BINARY} --version + OUTPUT_VARIABLE IWYU_VERSION_STRING) EndIf(IWYU_BINARY) +string(STRIP "${IWYU_VERSION_STRING}" IWYU_VERSION_STRING) + +#string(REPLACE "include" " " ${IWYU_VERSION_STRING} IWYU_VERSION_S) +#MESSAGE(STATUS "Looking for IWYU... - found ${IWYU_VERSION_STRING}") +#MESSAGE(STATUS "Looking for IWYU... - found ${IWYU_VERSION_S}") + +Set(IWYU_VERSION ${IWYU_VERSION_STRING}) If (IWYU_FOUND) If (NOT IWYU_FIND_QUIETLY) - MESSAGE(STATUS "Looking for IWYU... - found ${IWYU_BINARY}") + #MESSAGE(STATUS "Looking for IWYU... - found ${IWYU_BINARY}") SET(ENV{ALL_HEADER_RULES} "") endif (NOT IWYU_FIND_QUIETLY) else (IWYU_FOUND) @@ -40,26 +50,26 @@ Macro(CHECK_HEADERS INFILES INCLUDE_DIRS_IN HEADER_RULE_NAME) Set(_all_files) ForEach(_current_FILE ${INCLUDE_DIRS_IN}) - Set(_INCLUDE_DIRS ${_INCLUDE_DIRS} -I${_current_FILE}) + Set(_INCLUDE_DIRS ${_INCLUDE_DIRS} -I${_current_FILE}) EndForEach(_current_FILE ${INCLUDE_DIRS_IN}) ForEach (_current_FILE ${INFILES}) Get_Filename_Component(file_name ${_current_FILE} NAME_WE) Get_Filename_Component(path ${_current_FILE} PATH) - + Set(_current_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}") Set(headerfile "${CMAKE_CURRENT_SOURCE_DIR}/${path}/${file_name}.h") - + If(NOT EXISTS ${headerfile}) Set(headerfile) EndIf(NOT EXISTS ${headerfile}) - + Set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.iwyu") - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${IWYU_BINARY} ${_current_FILE} ${_INCLUDE_DIRS} 2> ${outfile} - # COMMAND /bin/bash ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/iwyu.sh ${outfile} ${_current_FILE} ${headerfile} + # COMMAND /bin/bash ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/iwyu.sh ${outfile} ${_current_FILE} ${headerfile} DEPENDS ${_current_FILE} ${headerfile} ) @@ -67,7 +77,7 @@ Macro(CHECK_HEADERS INFILES INCLUDE_DIRS_IN HEADER_RULE_NAME) endforeach (_current_FILE ${INFILES}) - Add_CUSTOM_TARGET(${HEADER_RULE_NAME} + Add_CUSTOM_TARGET(${HEADER_RULE_NAME} COMMAND touch ${CMAKE_BINARY_DIR}/${RULE_NAME} DEPENDS ${_all_files} ) diff --git a/cmake/modules/FindPLUTO.cmake b/cmake/modules/FindPLUTO.cmake index 8ee4516d4a..4312c1a994 100644 --- a/cmake/modules/FindPLUTO.cmake +++ b/cmake/modules/FindPLUTO.cmake @@ -1,8 +1,8 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Try to find PLUTO instalation @@ -48,7 +48,6 @@ endif (PLUTO_INCLUDE_DIR AND PLUTO_LIBRARY_DIR) if (PLUTO_FOUND) if (NOT PLUTO_FIND_QUIETLY) MESSAGE(STATUS "Looking for Pluto... - found ${PLUTO_LIBRARY_DIR}") -# message(STATUS "Found PLUTO: ${PLUTO_LIBRARY_DIR}") SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${PLUTO_LIBRARY_DIR}) endif (NOT PLUTO_FIND_QUIETLY) else (PLUTO_FOUND) @@ -56,4 +55,3 @@ else (PLUTO_FOUND) message(FATAL_ERROR "Looking for Pluto... - Not found") endif (PLUTO_FIND_REQUIRED) endif (PLUTO_FOUND) - diff --git a/cmake/modules/FindPythia6.cmake b/cmake/modules/FindPythia6.cmake index 3d69898c05..e967844470 100644 --- a/cmake/modules/FindPythia6.cmake +++ b/cmake/modules/FindPythia6.cmake @@ -1,8 +1,8 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Try to find PLUTO instalation @@ -12,7 +12,7 @@ # Pythia6_LIBRARY_DIR - The libraries directory for Pythia6 # -MESSAGE(STATUS "Looking for Pythia6...") +#MESSAGE(STATUS "Looking for Pythia6...") FIND_PATH(Pythia6_LIBRARY_DIR NAMES libPythia6.so libPythia6.dylib PATHS $ENV{PYTHIA6_ROOT}/lib @@ -29,13 +29,15 @@ if (Pythia6_LIBRARY_DIR) endif(Pythia6_LIBRARY_DIR) if (Pythia6_FOUND) - if (NOT Pythia6_FIND_QUIETLY) + SET(Pythia6_VERSION "6.4") + SET(Pythia6_ROOT ${Pythia6_LIBRARY_DIR}) + if (NOT Pythia6_FIND_QUIETLY) MESSAGE(STATUS "Looking for Pythia6... - found ${Pythia6_LIBRARY_DIR}") SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${Pythia6_LIBRARY_DIR}) + MESSAGE(STATUS "Looking for Pythia6... - found ${Pythia6_VERSION}") endif (NOT Pythia6_FIND_QUIETLY) else (Pythia6_FOUND) if (Pythia6_FIND_REQUIRED) message(FATAL_ERROR "Looking for Pythia6... - Not found") endif (Pythia6_FIND_REQUIRED) endif (Pythia6_FOUND) - diff --git a/cmake/modules/FindPythia8.cmake b/cmake/modules/FindPythia8.cmake index 20abb0a624..4c6e60a336 100644 --- a/cmake/modules/FindPythia8.cmake +++ b/cmake/modules/FindPythia8.cmake @@ -1,59 +1,87 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Try to find PYTHIA8 instalation # Once done this will define -# - -MESSAGE(STATUS "Looking for PYTHIA8 ...") - -FIND_PATH(PYTHIA8_INCLUDE_DIR NAMES Pythia.h PATHS - $ENV{PYTHIA_ROOT}/include/Pythia8 - ${PYTHIA8_DIR}/include/Pythia8 - ${AlFa_DIR}/include/Pythia8 - ${SIMPATH}/include/Pythia8 - ${SIMPATH}/include/pythia8 - ${SIMPATH}/generators/include/pythia8 - ${SIMPATH}/generators/pythia8/include - NO_DEFAULT_PATH -) - -FIND_PATH(PYTHIA8_LIB_DIR NAMES libpythia8.so libpythia8.dylib PATHS - $ENV{PYTHIA_ROOT}/lib - ${PYTHIA8_DIR}/lib - ${AlFa_DIR}/lib - ${SIMPATH}/lib - ${SIMPATH}/generators/lib - NO_DEFAULT_PATH -) - -Find_Path(PYTHIA8DATA NAMES MainProgramSettings.xml PATHS - $ENV{PYTHIA8DATA} - $ENV{PYTHIA_ROOT}/share/Pythia8/xmldoc - ${PYTHIA8_DIR}/share/Pythia8/xmldoc - ${SIMPATH}/share/pythia8/xmldoc -) - -If(NOT PYTHIA8DATA) - Message(STATUS "Could not find Pythia8 data files") -EndIf() - -if (PYTHIA8_INCLUDE_DIR AND PYTHIA8_LIB_DIR) - set(PYTHIA8_FOUND TRUE) -endif (PYTHIA8_INCLUDE_DIR AND PYTHIA8_LIB_DIR) - -if (PYTHIA8_FOUND) - if (NOT PYTHIA8_FOUND_QUIETLY) - MESSAGE(STATUS "Looking for PYTHIA8... - found ${PYTHIA8_LIB_DIR}") - SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${PYTHIA8_LIB_DIR}) - endif (NOT PYTHIA8_FOUND_QUIETLY) -else (PYTHIA8_FOUND) - if (PYTHIA8_FOUND_REQUIRED) - message(FATAL_ERROR "Looking for PYTHIA8... - Not found") - endif (PYTHIA8_FOUND_REQUIRED) -endif (PYTHIA8_FOUND) +# PYTHIA8_INCLUDE_DIR where to locate Pythia.h file +# PYTHIA8_LIBRARY where to find the libpythia8 library +# PYTHIA8__LIBRARY Addicional libraries +# PYTHIA8_LIBRARIES (not cached) the libraries to link against to use Pythia8 +# PYTHIA8_FOUND if false, you cannot build anything that requires Pythia8 +# PYTHIA8_VERSION version of Pythia8 if found +################################################################################ +set(_pythia8dirs + ${PYTHIA8} + $ENV{PYTHIA8} + ${PYTHIA8_DIR} + $ENV{PYTHIA8_DIR} + $ENV{PYTHIA_ROOT} + ${AlFa_DIR} + ${SIMPATH} + ${SIMPATH}/generators + /usr + /opt/pythia8) + +find_path(PYTHIA8_INCLUDE_DIR + NAMES Pythia8/Pythia.h pythia8/Pythia.h pythia8/pythia.h Pythia8/pythia.h + HINTS ${_pythia8dirs} + PATH_SUFFIXES include include/Pythia8 include/pythia8 + DOC "Specify the directory containing Pythia.h.") + +find_library(PYTHIA8_LIBRARY + NAMES pythia8 Pythia8 + HINTS ${_pythia8dirs} + PATH_SUFFIXES lib + DOC "Specify the Pythia8 library here.") + +find_path(PYTHIA8_LIB_DIR NAMES libpythia8.so libpythia8.dylib PATHS + $ENV{PYTHIA_ROOT}/lib + ${PYTHIA8_DIR}/lib + ${AlFa_DIR}/lib + ${SIMPATH}/lib + ${SIMPATH}/generators/lib + NO_DEFAULT_PATH + ) + +find_library(PYTHIA8_hepmcinterface_LIBRARY + NAMES hepmcinterface pythia8tohepmc + HINTS ${_pythia8dirs} + PATH_SUFFIXES lib) + +find_library(PYTHIA8_lhapdfdummy_LIBRARY + NAMES lhapdfdummy + HINTS ${_pythia8dirs} + PATH_SUFFIXES lib) + + +find_path(PYTHIA8DATA NAMES MainProgramSettings.xml PATHS + $ENV{PYTHIA8DATA} + $ENV{PYTHIA_ROOT}/share/Pythia8/xmldoc + ${PYTHIA8_DIR}/share/Pythia8/xmldoc + ${SIMPATH}/share/pythia8/xmldoc + ) + + +foreach(_lib PYTHIA8_LIBRARY PYTHIA8_hepmcinterface_LIBRARY PYTHIA8_lhapdfdummy_LIBRARY) + if(${_lib}) + set(PYTHIA8_LIBRARIES ${PYTHIA8_LIBRARIES} ${${_lib}}) + endif() +endforeach() +set(PYTHIA8_INCLUDE_DIRS ${PYTHIA8_INCLUDE_DIR} ${PYTHIA8_INCLUDE_DIR}/Pythia8 ) + +find_path(PYTHIA8_DATA + NAMES MainProgramSettings.xml + HINTS ${_pythia8dirs} + PATH_SUFFIXES xmldoc) + +# handle the QUIETLY and REQUIRED arguments and set PYTHIA8_FOUND to TRUE if +# all listed variables are TRUE + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Pythia8 DEFAULT_MSG PYTHIA8_INCLUDE_DIR PYTHIA8_LIBRARY) +mark_as_advanced(PYTHIA8_INCLUDE_DIR PYTHIA8_LIBRARY PYTHIA8_hepmcinterface_LIBRARY PYTHIA8_lhapdfdummy_LIBRARY) diff --git a/cmake/modules/FindROOT.cmake b/cmake/modules/FindROOT.cmake index 5f061d9893..471c3f0c11 100644 --- a/cmake/modules/FindROOT.cmake +++ b/cmake/modules/FindROOT.cmake @@ -1,23 +1,23 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Find ROOT instalation # This module tries to find the ROOT installation on your system. -# It tries to find the root-config script which gives you all the needed +# It tries to find the root-config script which gives you all the needed # information. # If the system variable ROOTSYS is set this is straight forward. # If not the module uses the pathes given in ROOT_CONFIG_SEARCHPATH. -# If you need an other path you should add this path to this varaible. +# If you need an other path you should add this path to this varaible. # The root-config script is then used to detect basically everything else. # This module defines a number of key variables and macros. # # Variables defined by this module: # -# ROOT_FOUND System has ROOT, this means the root-config +# ROOT_FOUND System has ROOT, this means the root-config # executable was found. # # ROOT_INCLUDE_DIR ROOT include directories: not cached @@ -35,33 +35,33 @@ # ROOT_VERSION_MINOR Minor version number of ROOT # ROOT_VERSION_PATCH Patch version number of ROOT # -# ROOT_VERSION_NUMBER A unique version number which is calculated from +# ROOT_VERSION_NUMBER A unique version number which is calculated from # major, minor and patch version found # # ROOT_CINT_EXECUTABLE The rootcint executable. # # RLIBMAP_EXECUTABLE The rlibmap executable. -Message(STATUS "Looking for Root...") +#Message(STATUS "Looking for Root...") Set(ROOT_FOUND FALSE) Set(ROOT_DEFINITIONS "") Set(ROOT_INSTALLED_VERSION_TOO_OLD FALSE) Set(ROOT_CONFIG_EXECUTABLE ROOT_CONFIG_EXECUTABLE-NOTFOUND) -Find_Program(ROOT_CONFIG_EXECUTABLE NAMES root-config +Find_Program(ROOT_CONFIG_EXECUTABLE NAMES root-config HINTS ${ROOT_DIR} ${SIMPATH} ${ROOTSYS} $ENV{ROOTSYS} PATH_SUFFIXES bin tools/root/bin NO_DEFAULT_PATH ) - + If(ROOT_CONFIG_EXECUTABLE) - - String(REGEX REPLACE "(^.*)/bin/root-config" "\\1" test ${ROOT_CONFIG_EXECUTABLE}) + + String(REGEX REPLACE "(^.*)/bin/root-config" "\\1" test ${ROOT_CONFIG_EXECUTABLE}) Set(ENV{ROOTSYS} ${test}) Set(ROOTSYS ${test}) - Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --version + Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --version OUTPUT_VARIABLE ROOT_VERSION_STRING ) Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix @@ -71,9 +71,9 @@ If(ROOT_CONFIG_EXECUTABLE) String(STRIP ${ROOT_INSTALL_DIR} ROOT_INSTALL_DIR) - MESSAGE(STATUS "Looking for Root... - Found ${ROOT_INSTALL_DIR}/bin/root") - MESSAGE(STATUS "Looking for Root... - Found version is ${ROOT_VERSION_STRING} ") - + # MESSAGE(STATUS "Looking for Root... - Found ${ROOT_INSTALL_DIR}/bin/root") + # MESSAGE(STATUS "Looking for Root... - Found version is ${ROOT_VERSION_STRING} ") + # extract major, minor, and patch versions from # the version string given by root-config String(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+.*" "\\1" ROOT_VERSION_MAJOR "${ROOT_VERSION_STRING}") @@ -87,6 +87,8 @@ If(ROOT_CONFIG_EXECUTABLE) Set(ROOT_Version ${found_vers}) Set(ROOT_VERSION_NUMBER ${found_vers}) + Set(ROOT_VERSION ${ROOT_VERSION_STRING}) + Set(ROOT_ROOT ${ROOT_INSTALL_DIR}) If(found_vers LESS req_vers) Set(ROOT_FOUND FALSE) @@ -138,8 +140,8 @@ If(ROOT_FOUND) ####################################### # - # Check the executables of ROOT - # ( rootcint ) + # Check the executables of ROOT + # ( rootcint ) # ####################################### diff --git a/cmake/modules/FindSQLITE.cmake b/cmake/modules/FindSQLITE.cmake index 3a6b98e3be..692f29df5c 100644 --- a/cmake/modules/FindSQLITE.cmake +++ b/cmake/modules/FindSQLITE.cmake @@ -7,7 +7,7 @@ # SQLITE_LIBRARIES - Link these to use sqlite # -# : +# : # Date: 11.08.2014 -- Changes to favor user local installation @@ -17,7 +17,7 @@ /usr/local/include /usr/include ) - find_library(SQLITE_LIBRARIES sqlite3 + find_library(SQLITE_LIBRARIES sqlite3 NAMES sqlite3 PATHS /usr/local/lib diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake index f8bad982d2..ce9c3a6f76 100644 --- a/cmake/modules/FindTBB.cmake +++ b/cmake/modules/FindTBB.cmake @@ -1,12 +1,12 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # Locate Intel Threading Building Blocks include paths and libraries -# TBB can be found at http://www.threadingbuildingblocks.org/ +# TBB can be found at http://www.threadingbuildingblocks.org/ # Written by Hannes Hofmann, hannes.hofmann _at_ informatik.uni-erlangen.de # Adapted by Gino van den Bergen gino _at_ dtecta.com @@ -32,7 +32,7 @@ # TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols. # TBB_FOUND, If false, don't try to use TBB. -MESSAGE(STATUS "Looking for TBB...") +#MESSAGE(STATUS "Looking for TBB...") if (WIN32) # has em64t/vc8 em64t/vc9 @@ -134,7 +134,7 @@ if (NOT TBB_INSTALL_DIR) endif (NOT TBB_INSTALL_DIR) -#-- A macro to rewrite the paths of the library. This is necessary, because +#-- A macro to rewrite the paths of the library. This is necessary, because # find_library() always found the em64t/vc9 version of the TBB libs macro(TBB_CORRECT_LIB_DIR var_name) # if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t") @@ -160,7 +160,7 @@ mark_as_advanced(TBB_INCLUDE_DIR) #-- Look for libraries # GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh] if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "") - set (_TBB_LIBRARY_DIR + set (_TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib ${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM} ) diff --git a/cmake/modules/FindVGM.cmake b/cmake/modules/FindVGM.cmake new file mode 100644 index 0000000000..c9dd966768 --- /dev/null +++ b/cmake/modules/FindVGM.cmake @@ -0,0 +1,54 @@ +################################################################################ +# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# # +# This software is distributed under the terms of the # +# GNU Lesser General Public Licence (LGPL) version 3, # +# copied verbatim in the file "LICENSE" # +################################################################################ +# - Try to find VGM +# Once done this will define +# +# VGM_FOUND - system has VGM +# VGM_INCLUDE_DIR - the VGM include directory +# VGM_LIBRARIES - The libraries needed to use VGM +# VGM_DEFINITIONS - Compiler switches required for using VGM + + +#MESSAGE(STATUS "Looking for VGM...") + +FIND_PATH(VGM_LIBRARY_DIR NAMES libBaseVGM.so libBaseVGM.dylib PATHS + ${SIMPATH}/transport/vgm/lib/Linux-g++ + ${SIMPATH}/transport/vgm/lib/Linux-icc + ${SIMPATH}/transport/vgm/lib + ${SIMPATH}/lib + ${VGM_ROOT}/lib + NO_DEFAULT_PATH +) + +SUBDIRLIST (SUBDIRS ${VGM_LIBRARY_DIR}) + +FOREACH(subdir ${SUBDIRS}) + SET(fullpath_subdir ${VGM_LIBRARY_DIR}/${subdir}) + FIND_PATH(VGM_CONFIG_DIR NAMES VGMConfigVersion.cmake PATHS ${fullpath_subdir}) + if(EXISTS ${VGM_CONFIG_DIR}/VGMConfigVersion.cmake) + include(${VGM_CONFIG_DIR}/VGMConfig.cmake) + include(${VGM_CONFIG_DIR}/VGMConfigVersion.cmake) + set(VGM_VERSION ${PACKAGE_VERSION}) + set(VGM_ROOT ${VGM_LIBRARY_DIR}) + endif() +ENDFOREACH() + + +if (VGM_LIBRARY_DIR) + if (NOT VGM_FIND_QUIETLY) + MESSAGE(STATUS "Looking for VGM... - found ${VGM_LIBRARY_DIR}") + endif (NOT VGM_FIND_QUIETLY) +else (VGM_LIBRARY_DIR) + if (VGM_FIND_REQUIRED) + message(FATAL_ERROR "Looking for VGM... - Not found ") + endif (VGM_FIND_REQUIRED) +endif (VGM_LIBRARY_DIR) + +Set(VGM_INCLUDE_DIR ${VGM_INCLUDE_DIR}) +Set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${VGM_LIBRARY_DIR}) +Set(VGM_FOUND TRUE) diff --git a/cmake/modules/Findglpk.cmake b/cmake/modules/Findglpk.cmake index 9553d50b75..d362510961 100644 --- a/cmake/modules/Findglpk.cmake +++ b/cmake/modules/Findglpk.cmake @@ -1,19 +1,19 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Try to find GLPK instalation # Once done this will define # -MESSAGE(STATUS "Looking for GLPK ...") +#MESSAGE(STATUS "Looking for GLPK ...") FIND_PATH(GLPK_INCLUDE_DIR NAMES glpk.h PATHS - ${SIMPATH}/basics/glpk/include - ${SIMPATH}/include + ${SIMPATH}/basics/glpk/include + ${SIMPATH}/include NO_DEFAULT_PATH ) @@ -38,4 +38,3 @@ else (GLPK_FOUND) message(FATAL_ERROR "Looking for GLPK... - Not found") endif (GLPK_FOUND_REQUIRED) endif (GLPK_FOUND) - diff --git a/cmake/modules/ROOTMacros.cmake b/cmake/modules/ROOTMacros.cmake index 6268514346..8e777dcf23 100644 --- a/cmake/modules/ROOTMacros.cmake +++ b/cmake/modules/ROOTMacros.cmake @@ -114,7 +114,9 @@ Macro(ROOT_GENERATE_DICTIONARY_NEW) Configure_File(${FAIRROOTPATH}/share/fairbase/cmake/scripts/generate_dictionary_root.sh.in ${CMAKE_CURRENT_BINARY_DIR}/generate_dictionary_${script_name}.sh ) - EXEC_PROGRAM(/bin/chmod ARGS "u+x ${CMAKE_CURRENT_BINARY_DIR}/generate_dictionary_${script_name}.sh") + #EXEC_PROGRAM(/bin/chmod ARGS "u+x ${CMAKE_CURRENT_BINARY_DIR}/generate_dictionary_${script_name}.sh") + execute_process(COMMAND /bin/chmod u+x ${CMAKE_CURRENT_BINARY_DIR}/generate_dictionary_${script_name}.sh OUTPUT_QUIET) + ELSE(FAIRROOTPATH) Configure_File(${PROJECT_SOURCE_DIR}/cmake/scripts/generate_dictionary_root.sh.in ${CMAKE_CURRENT_BINARY_DIR}/generate_dictionary_${script_name}.sh @@ -209,8 +211,7 @@ MACRO (GENERATE_ROOT_TEST_SCRIPT SCRIPT_FULL_NAME) ${new_path}/${shell_script_name} ) ENDIF(FAIRROOTPATH) - - EXEC_PROGRAM(/bin/chmod ARGS "u+x ${new_path}/${shell_script_name}") + execute_process(COMMAND /bin/chmod u+x ${new_path}/${shell_script_name} OUTPUT_QUIET) ENDMACRO (GENERATE_ROOT_TEST_SCRIPT) @@ -311,13 +312,13 @@ Macro(GENERATE_LIBRARY) get_filename_component(_ext ${d} EXT) If(NOT _ext MATCHES a$) set(Int_DEPENDENCIES ${Int_DEPENDENCIES} ${d}) - Else() + Else() Message("Found Static library with extension ${_ext}") get_filename_component(_lib ${d} NAME_WE) set(Int_DEPENDENCIES ${Int_DEPENDENCIES} ${_lib}) EndIf() endforeach() - + ############### build the library ##################### If(${CMAKE_GENERATOR} MATCHES Xcode) Add_Library(${Int_LIB} SHARED ${Int_SRCS} ${NO_DICT_SRCS} ${HDRS} ${LINKDEF}) @@ -364,4 +365,3 @@ Macro(GENERATE_EXECUTABLE) Set(DEPENDENCIES) EndMacro(GENERATE_EXECUTABLE) - diff --git a/cmake/modules/WriteConfigFile.cmake b/cmake/modules/WriteConfigFile.cmake index 88d6448942..e0f44cdbf2 100644 --- a/cmake/modules/WriteConfigFile.cmake +++ b/cmake/modules/WriteConfigFile.cmake @@ -1,8 +1,8 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ MACRO (WRITE_CONFIG_FILE filename) @@ -13,24 +13,24 @@ MACRO (WRITE_CONFIG_FILE filename) List(REMOVE_ITEM LD_LIBRARY_PATH ${CMAKE_BINARY_DIR}/lib) If (INSTALL_TRUE) - SET(_INSTALLDIR ${CMAKE_INSTALL_PREFIX}) - SET(_BINDIR ${CMAKE_INSTALL_PREFIX}/bin) -# SET(VMCWORKDIR ${CMAKE_INSTALL_PREFIX}/share/fairbase) - SET(FAIRLIBDIR ${CMAKE_INSTALL_PREFIX}/lib) - SET(_LD_LIBRARY_PATH ${FAIRLIBDIR} ${LD_LIBRARY_PATH}) + SET(_INSTALLDIR ${CMAKE_INSTALL_PREFIX}) + SET(_BINDIR ${CMAKE_INSTALL_PREFIX}/bin) +# SET(VMCWORKDIR ${CMAKE_INSTALL_PREFIX}/share/fairbase) + SET(FAIRLIBDIR ${CMAKE_INSTALL_PREFIX}/lib) + SET(_LD_LIBRARY_PATH ${FAIRLIBDIR} ${LD_LIBRARY_PATH}) Else (INSTALL_TRUE) - SET(_INSTALLDIR ${CMAKE_BINARY_DIR}) - SET(_BINDIR ${CMAKE_BINARY_DIR}) -# SET(VMCWORKDIR ${CMAKE_SOURCE_DIR}) - SET(FAIRLIBDIR ${CMAKE_BINARY_DIR}/lib) - SET(_LD_LIBRARY_PATH ${FAIRLIBDIR} ${LD_LIBRARY_PATH}) + SET(_INSTALLDIR ${CMAKE_BINARY_DIR}) + SET(_BINDIR ${CMAKE_BINARY_DIR}) +# SET(VMCWORKDIR ${CMAKE_SOURCE_DIR}) + SET(FAIRLIBDIR ${CMAKE_BINARY_DIR}/lib) + SET(_LD_LIBRARY_PATH ${FAIRLIBDIR} ${LD_LIBRARY_PATH}) EndIf (INSTALL_TRUE) If(NOT DEFINED FULL_CONFIG_FILE) Set(FULL_CONFIG_FILE "true") EndIf(NOT DEFINED FULL_CONFIG_FILE) - + IF(CMAKE_SYSTEM_NAME MATCHES Linux) IF(FAIRROOTPATH) configure_file(${FAIRROOTPATH}/share/fairbase/cmake/scripts/check_system.sh.in @@ -47,8 +47,8 @@ MACRO (WRITE_CONFIG_FILE filename) ${CMAKE_CURRENT_BINARY_DIR}/check_system.csh ) ENDIF(FAIRROOTPATH) - - EXECUTE_PROCESS(COMMAND lsb_release -sd + + EXECUTE_PROCESS(COMMAND lsb_release -sd OUTPUT_VARIABLE _linux_flavour OUTPUT_STRIP_TRAILING_WHITESPACE ) @@ -58,11 +58,11 @@ MACRO (WRITE_CONFIG_FILE filename) STRING(REGEX REPLACE "\"$" "" _linux_flavour ${_linux_flavour}) ENDIF(_linux_flavour) - EXECUTE_PROCESS(COMMAND uname -m - OUTPUT_VARIABLE _system + EXECUTE_PROCESS(COMMAND uname -m + OUTPUT_VARIABLE _system OUTPUT_STRIP_TRAILING_WHITESPACE ) - + ElseIf(CMAKE_SYSTEM_NAME MATCHES Darwin) IF(FAIRROOTPATH) configure_file(${FAIRROOTPATH}/share/fairbase/cmake/scripts/check_system_mac.sh.in @@ -79,17 +79,17 @@ MACRO (WRITE_CONFIG_FILE filename) ${CMAKE_CURRENT_BINARY_DIR}/check_system.csh ) ENDIF(FAIRROOTPATH) - EXECUTE_PROCESS(COMMAND uname -sr + EXECUTE_PROCESS(COMMAND uname -sr OUTPUT_VARIABLE _linux_flavour OUTPUT_STRIP_TRAILING_WHITESPACE ) - EXECUTE_PROCESS(COMMAND uname -m - OUTPUT_VARIABLE _system + EXECUTE_PROCESS(COMMAND uname -m + OUTPUT_VARIABLE _system OUTPUT_STRIP_TRAILING_WHITESPACE ) ENDIF(CMAKE_SYSTEM_NAME MATCHES Linux) - + CONVERT_LIST_TO_STRING(${GEANT4_LIBRARY_DIR}) Set(GEANT4_LIBRARY_DIR ${output}) @@ -137,7 +137,7 @@ MACRO (WRITE_CONFIG_FILE filename) CONVERT_LIST_TO_STRING(${CLHEP_BASE_DIR}) Set(CLHEP_BASE_DIR ${output}) - + CONVERT_LIST_TO_STRING(${PLUTO_LIBRARY_DIR}) Set(PLUTO_LIBRARY_DIR ${output}) @@ -212,7 +212,7 @@ MACRO (WRITE_CONFIG_FILE filename) configure_file(${FAIRROOTPATH}/share/fairbase/cmake/scripts/config.csh.in ${CMAKE_CURRENT_BINARY_DIR}/${filename} ) - ELSE(FAIRROOTPATH) + ELSE(FAIRROOTPATH) configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/config.csh.in ${CMAKE_CURRENT_BINARY_DIR}/${filename} ) @@ -224,7 +224,7 @@ MACRO (WRITE_CONFIG_FILE filename) configure_file(${FAIRROOTPATH}/share/fairbase/cmake/scripts/config.sh.in ${CMAKE_CURRENT_BINARY_DIR}/${filename} ) - ELSE(FAIRROOTPATH) + ELSE(FAIRROOTPATH) configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/config.sh.in ${CMAKE_CURRENT_BINARY_DIR}/${filename} ) @@ -247,7 +247,7 @@ MACRO (CONVERT_LIST_TO_STRING) endforeach (_current ${ARGN}) If(tmp) - STRING(REGEX REPLACE "^:(.*)" "\\1" output ${tmp}) + STRING(REGEX REPLACE "^:(.*)" "\\1" output ${tmp}) Else(tmp) Set(output "") EndIf(tmp) diff --git a/cmake/modules_old/FindCLHEP.cmake b/cmake/modules_old/FindCLHEP.cmake index 2e4a1da256..2cf3825c8a 100644 --- a/cmake/modules_old/FindCLHEP.cmake +++ b/cmake/modules_old/FindCLHEP.cmake @@ -1,8 +1,8 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Try to find CLHEP @@ -20,7 +20,7 @@ if (CLHEP_INCLUDE_DIR AND CLHEP_LIBRARY_DIR) SET (CLHEP_PLISTS_LIB_DIR CLHEP_PLISTS_LIB_DIR-NOTFOUND) endif (CLHEP_INCLUDE_DIR AND CLHEP_LIBRARY_DIR) -MESSAGE(STATUS "Looking for CLHEP...") +#MESSAGE(STATUS "Looking for CLHEP...") # If we find the new clhep-config executable use it, otherwise search in the path Find_Program(CLHEP_CONFIG_EXE NAMES clhep-config PATHS @@ -64,7 +64,7 @@ If(CLHEP_CONFIG_EXE) List (REMOVE_DUPLICATES _incs_found) EndIf (_length GREATER 1) Set (CLHEP_INCLUDE_DIR ${_incs_found}) - set(CLHEP_LIBRARIES "-L${CLHEP_LIBRARY_DIR} -lCLHEP") + set(CLHEP_LIBRARIES "-L${CLHEP_LIBRARY_DIR} -lCLHEP") Else(CLHEP_CONFIG_EXE) @@ -74,7 +74,7 @@ Else(CLHEP_CONFIG_EXE) find_path(CLHEP_LIBRARY_DIR NAMES libG4clhep.so PATHS ${GEANT4_LIBRARY_DIR} ) - set(CLHEP_LIBRARIES "-L${CLHEP_LIBRARY_DIR} -lG4clhep") + set(CLHEP_LIBRARIES "-L${CLHEP_LIBRARY_DIR} -lG4clhep") FIND_PATH(CLHEP_INCLUDE_DIR NAMES CLHEP PATHS ${GEANT4_INCLUDE_DIR} @@ -84,7 +84,7 @@ Else(CLHEP_CONFIG_EXE) ) Else (GEANT4_FOUND) - + FIND_PATH(CLHEP_INCLUDE_DIR NAMES CLHEP PATHS ${SIMPATH}/cern/clhep/include ${SIMPATH}/include @@ -102,7 +102,7 @@ Else(CLHEP_CONFIG_EXE) ${SIMPATH}/lib NO_DEFAULT_PATH ) - set(CLHEP_LIBRARIES "-L${CLHEP_LIBRARY_DIR} -lCLHEP") + set(CLHEP_LIBRARIES "-L${CLHEP_LIBRARY_DIR} -lCLHEP") EndIf (GEANT4_FOUND) EndIf(CLHEP_CONFIG_EXE) @@ -113,7 +113,7 @@ EndIf (CLHEP_INCLUDE_DIR AND CLHEP_LIBRARY_DIR) If (CLHEP_FOUND) if (NOT CLHEP_FIND_QUIETLY) - MESSAGE(STATUS "Looking for CLHEP... - found ${CLHEP_LIBRARY_DIR}") +# MESSAGE(STATUS "Looking for CLHEP... - found ${CLHEP_LIBRARY_DIR}") # message(STATUS "Found CLHEP: ${CLHEP_LIBRARY_DIR}") SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${CLHEP_LIBRARY_DIR}) endif (NOT CLHEP_FIND_QUIETLY) @@ -122,4 +122,3 @@ Else (CLHEP_FOUND) message(FATAL_ERROR "Looking for CLHEP... - Not found") endif (CLHEP_FIND_REQUIRED) EndIf (CLHEP_FOUND) - diff --git a/cmake/modules_old/FindGEANT3.cmake b/cmake/modules_old/FindGEANT3.cmake index 492b9e7dad..f080454844 100644 --- a/cmake/modules_old/FindGEANT3.cmake +++ b/cmake/modules_old/FindGEANT3.cmake @@ -1,8 +1,8 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Try to find GEANT3 @@ -16,6 +16,9 @@ INCLUDE(CheckCXXSourceCompiles) + + + MACRO (TEST_GEANT3_VERSION) # Check if SetCUTS from TGeant3 has 11 or 16 parameters @@ -25,29 +28,30 @@ MACRO (TEST_GEANT3_VERSION) # If the compilation succed the library has the new version, # if not the library has the old version. -SET(CMAKE_REQUIRED_INCLUDES ${GEANT3_INCLUDE_DIR} ${ROOT_INCLUDE_DIR}) -SET(CMAKE_REQUIRED_LIBRARIES - ${GEANT3_LIB} - ${ROOT_LIBRARY_DIR}/libCore.so - Cint - Hist + +SET(CMAKE_REQUIRED_INCLUDES ${GEANT3_INCLUDE_DIR} ${ROOT_INCLUDE_DIR}) +SET(CMAKE_REQUIRED_LIBRARIES + ${GEANT3_LIB} + ${ROOT_LIBRARY_DIR}/libCore.so + Cint + Hist RIO Net - Graf - Graf3d - Gpad - Tree - Rint - Postscript - Matrix - Physics - Gui - EG - ${Pythia6_LIBRARY_DIR}/libPythia6.so - EGPythia6 - VMC - Geom - dl + Graf + Graf3d + Gpad + Tree + Rint + Postscript + Matrix + Physics + Gui + EG + ${Pythia6_LIBRARY_DIR}/libPythia6.so + EGPythia6 + VMC + Geom + dl ) check_cxx_source_compiles(" @@ -56,7 +60,7 @@ check_cxx_source_compiles(" TGeant3* geant3= new TGeant3(\"\"); float cut = 1.e-3; float usrcuts[5]={0.,0.,0.,0.,0}; - geant3->SetCUTS(cut, cut, cut, cut ,cut, cut, cut, cut, cut, cut, cut,usrcuts); + geant3->SetCUTS(cut, cut, cut, cut ,cut, cut, cut, cut, cut, cut, cut,usrcuts); return 0; } " TGEANT3_SETCUTS ) @@ -68,6 +72,8 @@ ELSE (TGEANT3_SETCUTS) ADD_DEFINITIONS(-DHAVE_OLD_GEANT3) ENDIF (TGEANT3_SETCUTS) + + ENDMACRO (TEST_GEANT3_VERSION) @@ -78,7 +84,7 @@ if (GEANT3_INCLUDE_DIR AND GEANT3_LIBRARIES) SET (GEANT3_SYSTEM_DIR GEANT3_SYSTEM_DIR-NOTFOUND) endif (GEANT3_INCLUDE_DIR AND GEANT3_LIBRARIES) -MESSAGE(STATUS "Looking for GEANT3...") +#MESSAGE(STATUS "Looking for GEANT3...") FIND_PATH(GEANT3_SYSTEM_DIR NAMES data PATHS ${GEANT3_PATH}/share/geant3 @@ -104,6 +110,20 @@ FIND_PATH(GEANT3_LIBRARY_DIR NAMES libgeant321.so PATHS NO_DEFAULT_PATH ) +SUBDIRLIST (SUBDIRS ${GEANT3_LIBRARY_DIR}) + +FOREACH(subdir ${SUBDIRS}) + SET(fullpath_subdir ${GEANT3_LIBRARY_DIR}/${subdir}) + FIND_PATH(GEANT3_CONFIG_DIR NAMES Geant3ConfigVersion.cmake PATHS ${fullpath_subdir}) + if(EXISTS ${GEANT3_CONFIG_DIR}/Geant3ConfigVersion.cmake) + include(${GEANT3_CONFIG_DIR}/Geant3Config.cmake) + include(${GEANT3_CONFIG_DIR}/Geant3ConfigVersion.cmake) + set(GEANT3_VERSION ${PACKAGE_VERSION}) + set(GEANT3_ROOT ${GEANT3_LIBRARY_DIR}) + endif() +ENDFOREACH() + + FIND_LIBRARY(GEANT3_LIB NAMES geant321 PATHS ${GEANT3_PATH}/lib ${SIMPATH}/lib @@ -133,4 +153,3 @@ else (GEANT3_FOUND) message(FATAL_ERROR "Looking for GEANT3... - Not found ") endif (GEANT3_FIND_REQUIRED) endif (GEANT3_FOUND) - diff --git a/cmake/modules_old/FindGEANT4.cmake b/cmake/modules_old/FindGEANT4.cmake index 5123f418d2..eefd67089a 100644 --- a/cmake/modules_old/FindGEANT4.cmake +++ b/cmake/modules_old/FindGEANT4.cmake @@ -1,8 +1,8 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Try to find GEANT4 @@ -21,7 +21,7 @@ if (GEANT4_INCLUDE_DIR AND GEANT4_LIBRARY_DIR) SET (GEANT4_DIR GEANT4_DIR-NOTFOUND) endif (GEANT4_INCLUDE_DIR AND GEANT4_LIBRARY_DIR) -MESSAGE(STATUS "Looking for GEANT4...") +#MESSAGE(STATUS "Looking for GEANT4...") FIND_PATH(GEANT4_DIR NAMES geant4-config PATHS ${SIMPATH}/transport/geant4/bin @@ -32,9 +32,13 @@ FIND_PATH(GEANT4_DIR NAMES geant4-config PATHS If(GEANT4_DIR) Set(PATH ${PATH} ${GEANT4_DIR}) + Execute_Process(COMMAND "${GEANT4_DIR}/geant4-config" --version + OUTPUT_VARIABLE GEANT4_VERSION + ) + String(STRIP ${GEANT4_VERSION} GEANT4_VERSION) + set(GEANT4_ROOT ${GEANT4_DIR}) EndIf(GEANT4_DIR) - FIND_PATH(GEANT4_INCLUDE_DIR NAMES G4Event.hh PATHS ${SIMPATH}/transport/geant4/include ${SIMPATH}/transport/geant4/include/geant4 @@ -47,8 +51,8 @@ FIND_PATH(GEANT4_INCLUDE_DIR NAMES G4Event.hh PATHS SET(GEANT4_INCLUDE_DIR ${GEANT4_INCLUDE_DIR} - ${SIMPATH}/transport/geant4/source/interfaces/common/include - ${SIMPATH}/transport/geant4/physics_lists/hadronic/Packaging/include + ${SIMPATH}/transport/geant4/source/interfaces/common/include + ${SIMPATH}/transport/geant4/physics_lists/hadronic/Packaging/include ${SIMPATH}/transport/geant4/physics_lists/hadronic/QGSP/include ) @@ -57,7 +61,7 @@ FIND_PATH(GEANT4_LIB_DIR NAMES libG3toG4.so PATHS ${SIMPATH}/transport/geant4/lib/Linux-icc ${SIMPATH}/transport/geant4/lib ${SIMPATH}/lib - ${GEANT4_ROOT}/lib + ${GEANT4_ROOT}/lib NO_DEFAULT_PATH ) @@ -72,7 +76,7 @@ endif (GEANT4_INCLUDE_DIR AND GEANT4_LIBRARY_DIR) if (GEANT4_FOUND) if (NOT GEANT4_FIND_QUIETLY) - MESSAGE(STATUS "Looking for GEANT4... - found ${GEANT4_LIBRARY_DIR}") + # MESSAGE(STATUS "Looking for GEANT4... - found ${GEANT4_LIBRARY_DIR}") # message(STATUS "Found ${GEANT4_LIBRARY_DIR}") endif (NOT GEANT4_FIND_QUIETLY) SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${GEANT4_LIBRARY_DIR}) @@ -81,4 +85,3 @@ else (GEANT4_FOUND) message(FATAL_ERROR "Looking for GEANT4... - Not found") endif (GEANT4_FIND_REQUIRED) endif (GEANT4_FOUND) - diff --git a/cmake/modules_old/FindGEANT4DATA.cmake b/cmake/modules_old/FindGEANT4DATA.cmake index 118ad33b8f..d5a6328b28 100644 --- a/cmake/modules_old/FindGEANT4DATA.cmake +++ b/cmake/modules_old/FindGEANT4DATA.cmake @@ -8,8 +8,8 @@ # - Try to find GEANT4 data files # - -MESSAGE(STATUS "Looking for GEANT4 DATA files...") +# +#MESSAGE(STATUS "Looking for GEANT4 DATA files...") FIND_PATH(GEANT4_DATA NAMES $ENV{G4PIIDATA} G4PII G4PII1.3 PATHS ${SIMPATH}/share/Geant4/data @@ -18,70 +18,53 @@ FIND_PATH(GEANT4_DATA NAMES $ENV{G4PIIDATA} G4PII G4PII1.3 PATHS NO_DEFAULT_PATH ) -#If(DEFINED ENV{G4LEDATA}) -# Set(G4LEDATA $ENV{G4LEDATA}) -#Else() - FIND_PATH(G4LEDATA NAMES README PATHS - $ENV{G4LEDATA} - ${GEANT4_DATA}/G4EMLOW - NO_DEFAULT_PATH - ) -#EndIf() +FIND_PATH(G4LEDATA NAMES README PATHS + $ENV{G4LEDATA} + ${GEANT4_DATA}/G4EMLOW + NO_DEFAULT_PATH +) If (G4LEDATA) - Message(STATUS "Found G4EMLOW data") +# Message(STATUS "NOT Found G4EMLOW data") Else (G4LEDATA) Message(STATUS "NOT Found G4EMLOW data") EndIf (G4LEDATA) -#If(DEFINED ENV{G4LEVELGAMMADATA}) -# Set(G4LEVELGAMMADATA $ENV{G4LEVELGAMMADATA}) -#Else() - FIND_PATH(G4LEVELGAMMADATA NAMES README-LevelGammaData PATHS +FIND_PATH(G4LEVELGAMMADATA NAMES README-LevelGammaData PATHS $ENV{G4LEVELGAMMADATA} ${GEANT4_DATA}/PhotonEvaporation/ NO_DEFAULT_PATH - ) -#EndIf() +) If (G4LEVELGAMMADATA) - Message(STATUS "Found PhotonEvaporation data") +# Message(STATUS "Found PhotonEvaporation data") Else (G4LEVELGAMMADATA) Message(STATUS "NOT Found PhotonEvaporation data") EndIf (G4LEVELGAMMADATA) - -#If(DEFINED ENV{G4NEUTRONHPDATA}) -# Set(G4NEUTRONHPDATA $ENV{G4NEUTRONHPDATA}) -#Else() - FIND_PATH(G4NEUTRONHPDATA NAMES README PATHS +FIND_PATH(G4NEUTRONHPDATA NAMES README PATHS $ENV{G4NEUTRONHPDATA} ${GEANT4_DATA}/G4NDL NO_DEFAULT_PATH - ) -#EndIf() +) If (G4NEUTRONHPDATA) - Message(STATUS "Found G4NDL data") + # Message(STATUS "Found G4NDL data") SET(G4NeutronHPCrossSections ${G4NEUTRONHPDATA}) Else () Message(STATUS "NOT Found G4NDL data") EndIf () -#If(DEFINED ENV{G4NEUTRONXSDATA}) -# Set(G4NEUTRONXSDATA $ENV{G4NEUTRONXSDATA}) -#Else() - FIND_PATH(G4NEUTRONXSDATA NAMES cap1 PATHS + FIND_PATH(G4NEUTRONXSDATA NAMES cap1 PATHS $ENV{G4NEUTRONXSDATA} ${GEANT4_DATA}/G4NEUTRONXS NO_DEFAULT_PATH ) -#EndIf() If (G4NEUTRONXSDATA) - Message(STATUS "Found G4NEUTRONXS data") +# Message(STATUS "Found G4NEUTRONXS data") Else (G4NEUTRONXSDATA) - Message(STATUS "NOT Found G4NEUTRONXS data") + Message(STATUS "NOT Found G4NEUTRONXS data, Needed for Geant versions < 10.5 ") EndIf (G4NEUTRONXSDATA) @@ -90,96 +73,70 @@ FIND_PATH(G4PARTICLEXSDATA NAMES He3 PATHS ${GEANT4_DATA}/G4PARTICLEXS NO_DEFAULT_PATH ) -#EndIf() If (G4PARTICLEXSDATA) -Message(STATUS "Found G4PARTICLEXSDATA data") +# Message(STATUS "Found G4PARTICLEXSDATA data") Else (G4PARTICLEXSDATA) -Message(STATUS "NOT Found G4PARTICLEXSDATA data") + Message(STATUS "NOT Found G4PARTICLEXSDATA data, Needed for Geant versions >= 10.5") EndIf (G4PARTICLEXSDATA) - -Message("G4PIIDATA: $ENV{G4PIIDATA}") -#If(DEFINED ENV{G4PIIDATA}) -# Set(G4PIIDATA $ENV{G4PIIDATA}) -#Else() - FIND_PATH(G4PIIDATA NAMES PIXE_DataLibrary.pdf documentation.pdf PATHS +FIND_PATH(G4PIIDATA NAMES PIXE_DataLibrary.pdf documentation.pdf PATHS $ENV{G4PIIDATA} ${GEANT4_DATA}/G4PII NO_DEFAULT_PATH - ) -#EndIf() +) If (G4PIIDATA) - Message(STATUS "Found G4PII data") + # Message(STATUS "Found G4PII data") Else (G4PIIDATA) Message(STATUS "NOT Found G4PII data") EndIf (G4PIIDATA) - -#If(DEFINED ENV{G4RADIOACTIVEDATA}) -# Set(G4RADIOACTIVEDATA $ENV{G4RADIOACTIVEDATA}) -#Else() - FIND_PATH(G4RADIOACTIVEDATA NAMES README_RDM PATHS +FIND_PATH(G4RADIOACTIVEDATA NAMES README_RDM PATHS $ENV{G4RADIOACTIVEDATA} ${GEANT4_DATA}/RadioactiveDecay NO_DEFAULT_PATH - ) -#EndIf() +) If (G4RADIOACTIVEDATA) - Message(STATUS "Found RadioactiveDecay data") + # Message(STATUS "Found RadioactiveDecay data") Else (G4RADIOACTIVEDATA) Message(STATUS "NOT Found RadioactiveDecay data") EndIf (G4RADIOACTIVEDATA) - -#If(DEFINED ENV{G4REALSURFACEDATA}) -# Set(G4REALSURFACEDATA $ENV{G4REALSURFACEDATA}) -#Else() - FIND_PATH(G4REALSURFACEDATA NAMES EtchedTiO.dat Rough_LUT.dat PATHS +FIND_PATH(G4REALSURFACEDATA NAMES EtchedTiO.dat Rough_LUT.dat PATHS $ENV{G4REALSURFACEDATA} ${GEANT4_DATA}/RealSurface NO_DEFAULT_PATH - ) -#EndIf() - +) If (G4REALSURFACEDATA) - Message(STATUS "Found RealSurface data") + # Message(STATUS "Found RealSurface data") Else (G4REALSURFACEDATA) Message(STATUS "NOT Found RealSurface data") EndIf (G4REALSURFACEDATA) -#If(DEFINED ENV{G4SAIDXSDATA}) -# Set(G4SAIDXSDATA $ENV{G4SAIDXSDATA}) -#Else() - FIND_PATH(G4SAIDXSDATA NAMES README_Eta PATHS +FIND_PATH(G4SAIDXSDATA NAMES README_Eta PATHS $ENV{G4SAIDXSDATA} ${GEANT4_DATA}/G4SAIDDATA NO_DEFAULT_PATH ) -#EndIf() If (G4SAIDXSDATA) - Message(STATUS "Found G4SAID data") + # Message(STATUS "Found G4SAID data") Else (G4SAIDXSDATA) Message(STATUS "NOT Found G4SAID data") EndIf (G4SAIDXSDATA) -#If(DEFINED ENV{G4ENSDFSTATEDATA}) -# Set(G4ENSDFSTATEDATA $ENV{G4ENSDFSTATEDATA}) -#Else() - FIND_PATH(G4ENSDFSTATEDATA NAMES ENSDFSTATE.dat PATHS +FIND_PATH(G4ENSDFSTATEDATA NAMES ENSDFSTATE.dat PATHS $ENV{G4ENSDFSTATEDATA} ${GEANT4_DATA}/G4ENSDFSTATE NO_DEFAULT_PATH - ) -#EndIf() +) If (G4ENSDFSTATEDATA) - Message(STATUS "Found G4ENSDFSTATE data") + # Message(STATUS "Found G4ENSDFSTATE data") Else (G4ENSDFSTATEDATA) Message(STATUS "NOT Found G4ENSDFSTATE data") EndIf (G4ENSDFSTATEDATA) diff --git a/cmake/modules_old/FindGEANT4VMC.cmake b/cmake/modules_old/FindGEANT4VMC.cmake index 1162b04bb4..299c3aeb2c 100644 --- a/cmake/modules_old/FindGEANT4VMC.cmake +++ b/cmake/modules_old/FindGEANT4VMC.cmake @@ -1,17 +1,17 @@ ################################################################################ # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # + # This software is distributed under the terms of the # + # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ # - Try to find GEANT4VMC # Once done this will define # -# GEANT4VMC_FOUND - system has GEANT3 -# GEANT4VMC_INCLUDE_DIR - the GEANT3 include directory -# GEANT4VMC_LIBRARIES - The libraries needed to use GEANT3 -# GEANT4VMC_DEFINITIONS - Compiler switches required for using GEANT3 +# GEANT4VMC_FOUND - system has GEANT4VMC +# GEANT4VMC_INCLUDE_DIR - the GEANT4VMC include directory +# GEANT4VMC_LIBRARIES - The libraries needed to use GEANT4VMC +# GEANT4VMC_DEFINITIONS - Compiler switches required for using GEANT4VMC # if (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR) @@ -20,7 +20,7 @@ if (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR) SET (GEANT4VMC_PLISTS_LIB_DIR GEANT4VMC_PLISTS_LIB_DIR-NOTFOUND) endif (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR) -MESSAGE(STATUS "Looking for GEANT4VMC...") +#MESSAGE(STATUS "Looking for GEANT4VMC...") FIND_PATH(GEANT4VMC_INCLUDE_DIR NAMES TG4G3Units.h PATHS ${SIMPATH}/transport/geant4_vmc/include/geant4vmc @@ -30,26 +30,6 @@ FIND_PATH(GEANT4VMC_INCLUDE_DIR NAMES TG4G3Units.h PATHS NO_DEFAULT_PATH ) -#set(GEANT4VMC_INCLUDE_DIR -#${SIMPATH}/transport/geant4_vmc/source/global/include -#${SIMPATH}/transport/geant4_vmc/source/geometry/include -#${SIMPATH}/transport/geant4_vmc/source/digits+hits/include -#${SIMPATH}/transport/geant4_vmc/source/physics/include -#${SIMPATH}/transport/geant4_vmc/source/event/include -#${SIMPATH}/transport/geant4_vmc/source/run/include -#${SIMPATH}/transport/geant4_vmc/source/interfaces/include -#${SIMPATH}/transport/geant4_vmc/source/visualization/include -#${SIMPATH}/transport/geant4_vmc/include -#${SIMPATH}/transport/geant4_vmc/include/geant4vmc -#${SIMPATH}/transport/geant4_vmc/include/g4root -#${SIMPATH}/transport/vgm/packages/BaseVGM/include -#${SIMPATH}/transport/vgm/packages/ClhepVGM/include -#${SIMPATH}/transport/vgm/packages/Geant4GM/include -#${SIMPATH}/transport/vgm/packages/RootGM/include -#${SIMPATH}/transport/vgm/packages/VGM/include -#${SIMPATH}/transport/vgm/packages/XmlVGM/include -#) - FIND_PATH(GEANT4VMC_MACRO_DIR NAMES g4libs.C PATHS ${SIMPATH}/transport/macro @@ -70,6 +50,20 @@ FIND_PATH(GEANT4VMC_LIBRARY_DIR NAMES libgeant4vmc.so libgeant4vmc.dylib PATHS NO_DEFAULT_PATH ) +SUBDIRLIST (SUBDIRS ${GEANT4VMC_LIBRARY_DIR}) + +FOREACH(subdir ${SUBDIRS}) + SET(fullpath_subdir ${GEANT4VMC_LIBRARY_DIR}/${subdir}) + FIND_PATH(GEANT4VMC_CONFIG_DIR NAMES Geant4VMCConfigVersion.cmake PATHS ${fullpath_subdir}) + if(EXISTS ${GEANT4VMC_CONFIG_DIR}/Geant4VMCConfigVersion.cmake) + include(${GEANT4VMC_CONFIG_DIR}/Geant4VMCConfig.cmake) + include(${GEANT4VMC_CONFIG_DIR}/Geant4VMCConfigVersion.cmake) + set(GEANT4VMC_VERSION ${PACKAGE_VERSION}) + set(GEANT4VMC_ROOT ${GEANT4VMC_LIBRARY_DIR}) + endif() +ENDFOREACH() + + # check for existence of header file, which is needed in FairRunConfiguration # The file is only present in old versions of VMC FIND_FILE(GEANT4_MODULAR_PHYSICS_LIST TG4ModularPhysicsList.h PATHS @@ -88,35 +82,12 @@ else (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR) endif (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR) -MESSAGE(STATUS "Looking for VGM...") - -FIND_PATH(VGM_LIBRARY_DIR NAMES libBaseVGM.so libBaseVGM.dylib PATHS - ${SIMPATH}/transport/vgm/lib/Linux-g++ - ${SIMPATH}/transport/vgm.2.08.04/lib/Linux-g++ - ${SIMPATH}/transport/vgm/lib/Linux-icc - ${SIMPATH}/transport/vgm/lib - ${SIMPATH}/lib - ${VGM_ROOT}/lib - NO_DEFAULT_PATH -) - -if (VGM_LIBRARY_DIR) - if (NOT GEANT4VMC_FIND_QUIETLY) - MESSAGE(STATUS "Looking for VGM... - found ${VGM_LIBRARY_DIR}") - endif (NOT GEANT4VMC_FIND_QUIETLY) -else (VGM_LIBRARY_DIR) - if (GEANT4VMC_FIND_REQUIRED) - message(FATAL_ERROR "Looking for VGM... - Not found ") - endif (GEANT4VMC_FIND_REQUIRED) -endif (VGM_LIBRARY_DIR) - if (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR AND VGM_LIBRARY_DIR) set(GEANT4VMC_FOUND TRUE) endif (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR AND VGM_LIBRARY_DIR) if (GEANT4VMC_FOUND) - SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${GEANT4VMC_LIBRARY_DIR} + SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${GEANT4VMC_LIBRARY_DIR} ${VGM_LIBRARY_DIR}) endif (GEANT4VMC_FOUND) - diff --git a/cmake/modules_old/FindGENERATORS.cmake b/cmake/modules_old/FindGENERATORS.cmake index 1ff6fe2308..9b0b049568 100644 --- a/cmake/modules_old/FindGENERATORS.cmake +++ b/cmake/modules_old/FindGENERATORS.cmake @@ -9,7 +9,7 @@ if (GENERATORS_LIBRARY_DIR) SET (GENERATORS_LIBRARY_DIR GENERATORS_LIBRARY_DIR-NOTFOUND) endif (GENERATORS_LIBRARY_DIR) -MESSAGE(STATUS "Looking for Pythia6...") +#MESSAGE(STATUS "Looking for Pythia6...") FIND_PATH(PYTHIA6_LIBRARY_DIR NAMES libPythia6.so PATHS ${SIMPATH}/lib @@ -25,7 +25,7 @@ if (PYTHIA6_LIBRARY_DIR) endif(PYTHIA6_LIBRARY_DIR) if (GENERATORS_FOUND) - if (NOT GENERATORS_FIND_QUIETLY) + if (NOT GENERATORS_FIND_QUIETLY) MESSAGE(STATUS "Looking for Pythia6... - found ${GENERATORS_LIBRARY_DIR}") SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${GENERATORS_LIBRARY_DIR}) endif (NOT GENERATORS_FIND_QUIETLY) @@ -34,4 +34,3 @@ else (GENERATORS_FOUND) message(FATAL_ERROR "Looking for Pythia6... - Not found") endif (GENERATORS_FIND_REQUIRED) endif (GENERATORS_FOUND) - diff --git a/doxygen/CMakeLists.txt b/doxygen/CMakeLists.txt index e5bfd11c9a..134f6b50c0 100644 --- a/doxygen/CMakeLists.txt +++ b/doxygen/CMakeLists.txt @@ -6,12 +6,12 @@ IF (BUILD_DOXYGEN) - FIND_PACKAGE(UnixCommands) - FIND_PACKAGE(Doxygen) - FIND_PACKAGE(Gnuplot) - FIND_PACKAGE(HTMLHelp) - FIND_PACKAGE(Perl) - FIND_PACKAGE(Wget) + FIND_PACKAGE2(PUBLIC UnixCommands) + FIND_PACKAGE2(PUBLIC Doxygen) + FIND_PACKAGE2(PUBLIC Gnuplot) + FIND_PACKAGE2(PUBLIC HTMLHelp) + FIND_PACKAGE2(PUBLIC Perl) + FIND_PACKAGE2(PUBLIC Wget) SET(DOXYGEN_PROJECT_NAME FairRoot) diff --git a/examples/advanced/Tutorial3/CMakeLists.txt b/examples/advanced/Tutorial3/CMakeLists.txt index 0146cc6298..74fc3c4d0e 100644 --- a/examples/advanced/Tutorial3/CMakeLists.txt +++ b/examples/advanced/Tutorial3/CMakeLists.txt @@ -6,9 +6,6 @@ # copied verbatim in the file "LICENSE" # ################################################################################ -find_package(Protobuf) -find_package(msgpack) -find_package(FlatBuffers) Set(INCLUDE_DIRECTORIES ${BASE_INCLUDE_DIRECTORIES} diff --git a/templates/project_root_containers/CMakeLists.txt b/templates/project_root_containers/CMakeLists.txt index bc17b29d60..a30ae2882c 100644 --- a/templates/project_root_containers/CMakeLists.txt +++ b/templates/project_root_containers/CMakeLists.txt @@ -1,34 +1,19 @@ # The name of our project is “MYPROJ”. CMakeLists files in this project can -# refer to the root source directory of the project as ${MYPROJ_SOURCE_DIR} -# or as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as +# refer to the root source directory of the project as ${MYPROJ_SOURCE_DIR} +# or as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as # ${MYPROJ_BINARY_DIR} or ${CMAKE_BINARY_DIR}. -# This difference is important for the base classes which are in FAIRROOT +# This difference is important for the base classes which are in FAIRROOT # and the experiment part. # Check if cmake has the required version -CMAKE_MINIMUM_REQUIRED(VERSION 3.7.2 FATAL_ERROR) - -### CMP0025 Compiler id for Apple Clang is now AppleClang. -### CMP0042 MACOSX_RPATH is enabled by default. - -foreach(p - CMP0025 # CMake 3.0 - CMP0028 # double colon for imported and alias targets - CMP0042 # CMake 3.0 - CMP0054 # Only interpret ``if()`` arguments as variables or keywords when unquoted. - ) - if(POLICY ${p}) - cmake_policy(SET ${p} NEW) - endif() -endforeach() - +CMAKE_MINIMUM_REQUIRED(VERSION 3.11.0 FATAL_ERROR) # Set name of our project to “MYPROJ". Has to be done -# after check of cmake version since this is a new feature +# after check of cmake version since this is a new feature project(MYPROJ) -#In case you need Fortran +#In case you need Fortran #ENABLE_LANGUAGE(Fortran) # Check for needed environment variables @@ -37,15 +22,15 @@ IF(NOT DEFINED ENV{FAIRROOTPATH}) ENDIF(NOT DEFINED ENV{FAIRROOTPATH}) IF(NOT DEFINED ENV{SIMPATH}) - MESSAGE(FATAL_ERROR "You did not define the environment variable SIMPATH which is nedded to find the external packages. Please set this variable and execute cmake again.") + MESSAGE(FATAL_ERROR "You did not define the environment variable SIMPATH which is nedded to find the external packages. Please set this variable and execute cmake again.") ENDIF(NOT DEFINED ENV{SIMPATH}) SET(SIMPATH $ENV{SIMPATH}) SET(FAIRROOTPATH $ENV{FAIRROOTPATH}) -# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ +# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ # is checked - set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH}) + set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old" ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH}) @@ -60,6 +45,8 @@ include(CTest) include(CheckCompiler) #include(CheckFortran) +set_fairroot_cmake_policies() + #Check the compiler and set the compile and link flags If(NOT CMAKE_BUILD_TYPE) Message("Set BuildType DEBUG") @@ -94,7 +81,7 @@ CHECK_OUT_OF_SOURCE_BUILD() # message IF(NOT UNIX) MESSAGE(FATAL_ERROR "You're not on an UNIX system. The project was up to now only tested on UNIX systems, so we break here. If you want to go on please edit the CMakeLists.txt in the source directory.") -ENDIF(NOT UNIX) +ENDIF(NOT UNIX) # Check if the external packages are installed into a separate install # directory @@ -105,17 +92,21 @@ CHECK_EXTERNAL_PACKAGE_INSTALL_DIR() # For example the framework can run without GEANT4, but ROOT is # mandatory -find_package(ROOT 5.32.00 REQUIRED) -find_package(Pythia8) -find_package(Pythia6 REQUIRED) -find_package(Geant3 REQUIRED) -find_package(Geant4) -find_package(GEANT4) -find_package(GEANT4DATA) -find_package(GEANT4VMC) -#find_package(CLHEP) + +find_package2(PUBLIC ROOT VERSION 6.10.00 REQUIRED) +find_package2(PUBLIC FairLogger VERSION 1.2.0 REQUIRED) +find_package2(PUBLIC Pythia6) +find_package2(PUBLIC Pythia8) +find_package2(PUBLIC GEANT3) +find_package2(PUBLIC GEANT4) +find_package2(PUBLIC GEANT4DATA) +Find_Package2(PUBLIC VGM) +find_package2(PUBLIC GEANT4VMC) +find_package(CLHEP) find_package(HEPMC) + + Set(Boost_NO_SYSTEM_PATHS TRUE) Set(Boost_NO_BOOST_CMAKE TRUE) If(${ROOT_LIBRARY_DIR} MATCHES /lib/root) @@ -125,15 +116,15 @@ Else(${ROOT_LIBRARY_DIR} MATCHES /lib/root) set(BOOST_ROOT ${SIMPATH}/basics/boost) set(GSL_DIR ${SIMPATH}/basics/gsl) EndIf(${ROOT_LIBRARY_DIR} MATCHES /lib/root) -Message("-- Looking for Boost ...") -# If an older version of boost is found both of the variables below are -# cached and in a second cmake run, a good boost version is found even -# if the version is to old. -# To overcome this problem both variables are cleared before checking -# for boost. + Unset(Boost_INCLUDE_DIR CACHE) Unset(Boost_LIBRARY_DIRS CACHE) -find_package(Boost 1.41) + +find_package2(PUBLIC Boost + VERSION 1.67 ${FairMQ_Boost_VERSION} + COMPONENTS thread system timer program_options random filesystem chrono exception regex serialization log log_setup atomic date_time signals ${FairMQ_Boost_COMPONENTS} +) + If (Boost_FOUND) Set(Boost_Avail 1) Else (Boost_FOUND) @@ -189,11 +180,36 @@ add_subdirectory (MyProjData) add_subdirectory (MyProjGenerators) add_subdirectory (NewDetector) add_subdirectory (passive) -add_subdirectory (field) +add_subdirectory (field) WRITE_CONFIG_FILE(config.sh) - -configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake + +configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake ) - +# Summary ###################################################################### +if(CMAKE_CXX_FLAGS) + message(STATUS " ") + message(STATUS " ${Cyan}GLOBAL CXX FLAGS${CR} ${BGreen}${CMAKE_CXX_FLAGS}${CR}") +endif() +if(CMAKE_CONFIGURATION_TYPES) + message(STATUS " ") + message(STATUS " ${Cyan}BUILD TYPE CXX FLAGS${CR}") + string(TOUPPER "${CMAKE_BUILD_TYPE}" selected_type) + foreach(type IN LISTS CMAKE_CONFIGURATION_TYPES) + string(TOUPPER "${type}" type_upper) + if(type_upper STREQUAL selected_type) + pad("${type}" 18 " " type_padded) + message(STATUS "${BGreen}* ${type_padded}${CMAKE_CXX_FLAGS_${type_upper}}${CR}") + else() + pad("${type}" 18 " " type_padded) + message(STATUS " ${BWhite}${type_padded}${CR}${CMAKE_CXX_FLAGS_${type_upper}}") + endif() + unset(type_padded) + unset(type_upper) + endforeach() +message(STATUS " ") +message(STATUS " (Change the build type with ${BMagenta}-DCMAKE_BUILD_TYPE=...${CR})") +endif() + + ################################################################################ diff --git a/templates/project_root_containers/MyProjGenerators/Pythia8Generator.h b/templates/project_root_containers/MyProjGenerators/Pythia8Generator.h index 1734d02afa..f164ea406a 100644 --- a/templates/project_root_containers/MyProjGenerators/Pythia8Generator.h +++ b/templates/project_root_containers/MyProjGenerators/Pythia8Generator.h @@ -13,7 +13,7 @@ #ifndef PNDP8GENERATOR_H #define PNDP8GENERATOR_H 1 -#include "Basics.h" // for RndmEngine +#include "Pythia8/Basics.h" // for RndmEngine #include "FairGenerator.h" // for FairGenerator #include "Pythia8/Pythia.h" // for Pythia #include "Rtypes.h" // for Double_t, Bool_t, Int_t, etc @@ -30,9 +30,9 @@ class PyTr1Rng : public RndmEngine public: PyTr1Rng() { rng = new TRandom1(gRandom->GetSeed()); }; virtual ~PyTr1Rng() {}; - + Double_t flat() { return rng->Rndm(); }; - + private: TRandom1 *rng; //! }; @@ -42,9 +42,9 @@ class PyTr3Rng : public RndmEngine public: PyTr3Rng() { rng = new TRandom3(gRandom->GetSeed()); }; virtual ~PyTr3Rng() {}; - + Double_t flat() { return rng->Rndm(); }; - + private: TRandom3 *rng; //! }; @@ -55,20 +55,20 @@ class PyTr3Rng : public RndmEngine class Pythia8Generator : public FairGenerator { public: - + /** default constructor **/ Pythia8Generator(); - + /** destructor **/ virtual ~Pythia8Generator(); - + /** public method ReadEvent **/ Bool_t ReadEvent(FairPrimaryGenerator*); void SetParameters(char*); void Print(); //! - + virtual Bool_t Init(); //! - + void SetMom(Double_t mom) { fMom = mom; }; void SetId(Double_t id) { fId = id; }; void SetHNLId(Int_t id) { fHNL = id; }; @@ -77,12 +77,12 @@ class Pythia8Generator : public FairGenerator void GetPythiaInstance(int); private: - + Pythia fPythia; //! RndmEngine* fRandomEngine; //! - + protected: - + Double_t fMom; // proton momentum Int_t fHNL; // HNL ID Int_t fId; // target type diff --git a/templates/project_stl_containers/CMakeLists.txt b/templates/project_stl_containers/CMakeLists.txt index bc17b29d60..a30ae2882c 100644 --- a/templates/project_stl_containers/CMakeLists.txt +++ b/templates/project_stl_containers/CMakeLists.txt @@ -1,34 +1,19 @@ # The name of our project is “MYPROJ”. CMakeLists files in this project can -# refer to the root source directory of the project as ${MYPROJ_SOURCE_DIR} -# or as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as +# refer to the root source directory of the project as ${MYPROJ_SOURCE_DIR} +# or as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as # ${MYPROJ_BINARY_DIR} or ${CMAKE_BINARY_DIR}. -# This difference is important for the base classes which are in FAIRROOT +# This difference is important for the base classes which are in FAIRROOT # and the experiment part. # Check if cmake has the required version -CMAKE_MINIMUM_REQUIRED(VERSION 3.7.2 FATAL_ERROR) - -### CMP0025 Compiler id for Apple Clang is now AppleClang. -### CMP0042 MACOSX_RPATH is enabled by default. - -foreach(p - CMP0025 # CMake 3.0 - CMP0028 # double colon for imported and alias targets - CMP0042 # CMake 3.0 - CMP0054 # Only interpret ``if()`` arguments as variables or keywords when unquoted. - ) - if(POLICY ${p}) - cmake_policy(SET ${p} NEW) - endif() -endforeach() - +CMAKE_MINIMUM_REQUIRED(VERSION 3.11.0 FATAL_ERROR) # Set name of our project to “MYPROJ". Has to be done -# after check of cmake version since this is a new feature +# after check of cmake version since this is a new feature project(MYPROJ) -#In case you need Fortran +#In case you need Fortran #ENABLE_LANGUAGE(Fortran) # Check for needed environment variables @@ -37,15 +22,15 @@ IF(NOT DEFINED ENV{FAIRROOTPATH}) ENDIF(NOT DEFINED ENV{FAIRROOTPATH}) IF(NOT DEFINED ENV{SIMPATH}) - MESSAGE(FATAL_ERROR "You did not define the environment variable SIMPATH which is nedded to find the external packages. Please set this variable and execute cmake again.") + MESSAGE(FATAL_ERROR "You did not define the environment variable SIMPATH which is nedded to find the external packages. Please set this variable and execute cmake again.") ENDIF(NOT DEFINED ENV{SIMPATH}) SET(SIMPATH $ENV{SIMPATH}) SET(FAIRROOTPATH $ENV{FAIRROOTPATH}) -# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ +# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ # is checked - set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH}) + set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old" ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH}) @@ -60,6 +45,8 @@ include(CTest) include(CheckCompiler) #include(CheckFortran) +set_fairroot_cmake_policies() + #Check the compiler and set the compile and link flags If(NOT CMAKE_BUILD_TYPE) Message("Set BuildType DEBUG") @@ -94,7 +81,7 @@ CHECK_OUT_OF_SOURCE_BUILD() # message IF(NOT UNIX) MESSAGE(FATAL_ERROR "You're not on an UNIX system. The project was up to now only tested on UNIX systems, so we break here. If you want to go on please edit the CMakeLists.txt in the source directory.") -ENDIF(NOT UNIX) +ENDIF(NOT UNIX) # Check if the external packages are installed into a separate install # directory @@ -105,17 +92,21 @@ CHECK_EXTERNAL_PACKAGE_INSTALL_DIR() # For example the framework can run without GEANT4, but ROOT is # mandatory -find_package(ROOT 5.32.00 REQUIRED) -find_package(Pythia8) -find_package(Pythia6 REQUIRED) -find_package(Geant3 REQUIRED) -find_package(Geant4) -find_package(GEANT4) -find_package(GEANT4DATA) -find_package(GEANT4VMC) -#find_package(CLHEP) + +find_package2(PUBLIC ROOT VERSION 6.10.00 REQUIRED) +find_package2(PUBLIC FairLogger VERSION 1.2.0 REQUIRED) +find_package2(PUBLIC Pythia6) +find_package2(PUBLIC Pythia8) +find_package2(PUBLIC GEANT3) +find_package2(PUBLIC GEANT4) +find_package2(PUBLIC GEANT4DATA) +Find_Package2(PUBLIC VGM) +find_package2(PUBLIC GEANT4VMC) +find_package(CLHEP) find_package(HEPMC) + + Set(Boost_NO_SYSTEM_PATHS TRUE) Set(Boost_NO_BOOST_CMAKE TRUE) If(${ROOT_LIBRARY_DIR} MATCHES /lib/root) @@ -125,15 +116,15 @@ Else(${ROOT_LIBRARY_DIR} MATCHES /lib/root) set(BOOST_ROOT ${SIMPATH}/basics/boost) set(GSL_DIR ${SIMPATH}/basics/gsl) EndIf(${ROOT_LIBRARY_DIR} MATCHES /lib/root) -Message("-- Looking for Boost ...") -# If an older version of boost is found both of the variables below are -# cached and in a second cmake run, a good boost version is found even -# if the version is to old. -# To overcome this problem both variables are cleared before checking -# for boost. + Unset(Boost_INCLUDE_DIR CACHE) Unset(Boost_LIBRARY_DIRS CACHE) -find_package(Boost 1.41) + +find_package2(PUBLIC Boost + VERSION 1.67 ${FairMQ_Boost_VERSION} + COMPONENTS thread system timer program_options random filesystem chrono exception regex serialization log log_setup atomic date_time signals ${FairMQ_Boost_COMPONENTS} +) + If (Boost_FOUND) Set(Boost_Avail 1) Else (Boost_FOUND) @@ -189,11 +180,36 @@ add_subdirectory (MyProjData) add_subdirectory (MyProjGenerators) add_subdirectory (NewDetector) add_subdirectory (passive) -add_subdirectory (field) +add_subdirectory (field) WRITE_CONFIG_FILE(config.sh) - -configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake + +configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake ) - +# Summary ###################################################################### +if(CMAKE_CXX_FLAGS) + message(STATUS " ") + message(STATUS " ${Cyan}GLOBAL CXX FLAGS${CR} ${BGreen}${CMAKE_CXX_FLAGS}${CR}") +endif() +if(CMAKE_CONFIGURATION_TYPES) + message(STATUS " ") + message(STATUS " ${Cyan}BUILD TYPE CXX FLAGS${CR}") + string(TOUPPER "${CMAKE_BUILD_TYPE}" selected_type) + foreach(type IN LISTS CMAKE_CONFIGURATION_TYPES) + string(TOUPPER "${type}" type_upper) + if(type_upper STREQUAL selected_type) + pad("${type}" 18 " " type_padded) + message(STATUS "${BGreen}* ${type_padded}${CMAKE_CXX_FLAGS_${type_upper}}${CR}") + else() + pad("${type}" 18 " " type_padded) + message(STATUS " ${BWhite}${type_padded}${CR}${CMAKE_CXX_FLAGS_${type_upper}}") + endif() + unset(type_padded) + unset(type_upper) + endforeach() +message(STATUS " ") +message(STATUS " (Change the build type with ${BMagenta}-DCMAKE_BUILD_TYPE=...${CR})") +endif() + + ################################################################################ diff --git a/templates/project_stl_containers/MyProjGenerators/Pythia8Generator.h b/templates/project_stl_containers/MyProjGenerators/Pythia8Generator.h index 1734d02afa..f164ea406a 100644 --- a/templates/project_stl_containers/MyProjGenerators/Pythia8Generator.h +++ b/templates/project_stl_containers/MyProjGenerators/Pythia8Generator.h @@ -13,7 +13,7 @@ #ifndef PNDP8GENERATOR_H #define PNDP8GENERATOR_H 1 -#include "Basics.h" // for RndmEngine +#include "Pythia8/Basics.h" // for RndmEngine #include "FairGenerator.h" // for FairGenerator #include "Pythia8/Pythia.h" // for Pythia #include "Rtypes.h" // for Double_t, Bool_t, Int_t, etc @@ -30,9 +30,9 @@ class PyTr1Rng : public RndmEngine public: PyTr1Rng() { rng = new TRandom1(gRandom->GetSeed()); }; virtual ~PyTr1Rng() {}; - + Double_t flat() { return rng->Rndm(); }; - + private: TRandom1 *rng; //! }; @@ -42,9 +42,9 @@ class PyTr3Rng : public RndmEngine public: PyTr3Rng() { rng = new TRandom3(gRandom->GetSeed()); }; virtual ~PyTr3Rng() {}; - + Double_t flat() { return rng->Rndm(); }; - + private: TRandom3 *rng; //! }; @@ -55,20 +55,20 @@ class PyTr3Rng : public RndmEngine class Pythia8Generator : public FairGenerator { public: - + /** default constructor **/ Pythia8Generator(); - + /** destructor **/ virtual ~Pythia8Generator(); - + /** public method ReadEvent **/ Bool_t ReadEvent(FairPrimaryGenerator*); void SetParameters(char*); void Print(); //! - + virtual Bool_t Init(); //! - + void SetMom(Double_t mom) { fMom = mom; }; void SetId(Double_t id) { fId = id; }; void SetHNLId(Int_t id) { fHNL = id; }; @@ -77,12 +77,12 @@ class Pythia8Generator : public FairGenerator void GetPythiaInstance(int); private: - + Pythia fPythia; //! RndmEngine* fRandomEngine; //! - + protected: - + Double_t fMom; // proton momentum Int_t fHNL; // HNL ID Int_t fId; // target type