From 39c1247ea824f05327e462bf660ec70cd0c33c08 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Thu, 7 Mar 2019 13:23:24 +0100 Subject: [PATCH 01/15] Add license badge Find out which package version was installed --- CMakeLists.txt | 129 ++++++++++++++----- README.md | 2 +- cmake/modules/FairMacros.cmake | 138 +++++++++++++++++---- cmake/modules/FindPythia6.cmake | 9 +- cmake/modules/FindROOT.cmake | 32 ++--- cmake/modules_old/FindGEANT3.cmake | 68 ++++++---- cmake/modules_old/FindGEANT4.cmake | 15 +-- cmake/modules_old/FindGEANT4VMC.cmake | 52 +++++--- doxygen/CMakeLists.txt | 12 +- examples/advanced/Tutorial3/CMakeLists.txt | 3 - 10 files changed, 322 insertions(+), 138 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3307213ad9..8c9217a828 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,13 +15,13 @@ # 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. +### CMP0025 ### CMP0042 MACOSX_RPATH is enabled by default. foreach(p - CMP0025 # CMake 3.0 + CMP0025 # Compiler id for Apple Clang is now AppleClang. CMP0028 # double colon for imported and alias targets - CMP0042 # CMake 3.0 + CMP0042 # MACOSX_RPATH is enabled by default. CMP0054 # Only interpret ``if()`` arguments as variables or keywords when unquoted. ) if(POLICY ${p}) @@ -161,17 +161,22 @@ 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 + 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}/..) @@ -187,16 +192,16 @@ if(FAIRROOT_MODULAR_BUILD) Message(Status "Looking for GEANT3... - Not found ") EndIf() Message(STATUS "Looking for GEANT4...") - Find_Package(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 +209,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 +220,10 @@ 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}/..") @@ -229,28 +234,28 @@ if(FAIRROOT_MODULAR_BUILD) 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_package(CLHEP) + find_package2(PUBLIC GEANT3) + find_package2(PUBLIC GEANT4) + find_package2(PUBLIC GEANT4DATA) + find_package2(PUBLIC GEANT4VMC) + find_package2(PUBLIC CLHEP) endif(FAIRROOT_MODULAR_BUILD) -find_package(CUDA) -find_package(IWYU) +find_package2(PUBLIC CUDA) +find_package2(PUBLIC IWYU) if(NOT DISABLE_GO) - find_package(Go 1.7) + find_package2(PUBLIC Go VERSION 1.7) 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) @@ -276,7 +281,7 @@ 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 COMPONENTS ${FairRoot_Boost_COMPONENTS}) If (Boost_FOUND) Set(Boost_Avail 1) Set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${Boost_LIBRARY_DIR}) @@ -423,7 +428,7 @@ Install(DIRECTORY cmake DESTINATION share/fairbase PATTERN ".svn" EXCLUDE) -Find_Package(Git) +find_package2(PUBLIC Git) If(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git") Execute_Process(COMMAND ${GIT_EXECUTABLE} describe --tags @@ -453,3 +458,67 @@ if(NOT FAIRROOT_MINIMAL) else(NOT FAIRROOT_MINIMAL) WRITE_MINIMAL_CONFIG_FILE(config.sh) endif(NOT FAIRROOT_MINIMAL) + + + +# 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 ${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() + message(STATUS " ${BWhite}${dep_padded}${CR}${version_padded}") + unset(version_str) + unset(version_padded) + unset(version_req_str) + endforeach() +endif() +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/cmake/modules/FairMacros.cmake b/cmake/modules/FairMacros.cmake index aac4c562f6..5355d9c1ec 100644 --- a/cmake/modules/FairMacros.cmake +++ b/cmake/modules/FairMacros.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" # ################################################################################ ########################################### @@ -20,17 +20,49 @@ # Ex: CHANGE_FILE_EXTENSION(*.cxx *.h TRD_HEADERS "${TRD_SRCS}") # ################################################################ + # 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() + + 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() + 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}) @@ -39,7 +71,7 @@ MACRO (CHANGE_FILE_EXTENSION FILE_EXT1 FILE_EXT2 OUTVAR LIST) SET (BLA ${BLA} ${test}) endforeach (_current_FILE ${ARGN}) - + SET (${OUTVAR} ${BLA}) @@ -47,7 +79,7 @@ MACRO (CHANGE_FILE_EXTENSION FILE_EXT1 FILE_EXT2 OUTVAR LIST) 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 @@ -58,9 +90,9 @@ ENDMACRO (CHANGE_FILE_EXTENSION) # deleted from the list. Returns the list of pathes # (entries) wich survives the loop. # - # PATH: colon separated string of pathes or other + # PATH: colon separated string of pathes or other # input entries - # LIST_OF_KEYWORDS: list of the keywords which + # 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 @@ -74,7 +106,7 @@ MACRO (CLEAN_PATH_LIST PATH LIST_OF_KEYWORDS OUTVAR) STRING(REGEX MATCHALL "[^:]+" PATH1 ${PATH}) FOREACH(_current_PATH ${PATH1}) - + SET(KEYWORD_FOUND FALSE) FOREACH(_current_KEYWORD ${LIST_OF_KEYWORDS}) @@ -84,10 +116,10 @@ MACRO (CLEAN_PATH_LIST PATH LIST_OF_KEYWORDS OUTVAR) 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}) @@ -110,7 +142,7 @@ MACRO (CHECK_OUT_OF_SOURCE_BUILD) 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) @@ -160,7 +192,7 @@ ENDMACRO(UNIQUE) ################################################### -# Creates a variable which stores the intersection +# Creates a variable which stores the intersection # between two lists #################################################### @@ -186,7 +218,7 @@ MACRO(REMOVE_FROM_LIST var_name list1 list2) 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) @@ -219,12 +251,12 @@ MACRO (GENERATE_TEST_SCRIPT SCRIPT_FULL_NAME) ENDIF(FAIRROOT_FOUND) - + EXEC_PROGRAM(/bin/chmod ARGS "u+x ${new_path}/${shell_script_name}") ENDMACRO (GENERATE_TEST_SCRIPT) -Macro(Generate_Exe_Script _Path _ExeName) +Macro(Generate_Exe_Script _Path _ExeName) Message("PATH: ${_Path}") @@ -248,12 +280,12 @@ 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 @@ -261,9 +293,9 @@ IF(FAIRROOT_FOUND) 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 ) @@ -274,7 +306,7 @@ 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 +337,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,7 +352,7 @@ ENDIF(FAIRROOT_FOUND) Set(BASE_LINK_DIRECTORIES ${ROOT_LIBRARY_DIR} ${Boost_LIBRARY_DIRS} -) +) IF(FAIRROOT_FOUND) @@ -329,10 +361,64 @@ IF(FAIRROOT_FOUND) 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}) + if(ARGS_COMPONENTS) + find_package(${pkgname} ${ARGS_VERSION} QUIET COMPONENTS ${ARGS_COMPONENTS} ${ARGS_UNPARSED_ARGUMENTS}) + else() + find_package(${pkgname} ${ARGS_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 ${ARGS_VERSION}) + set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) + set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname}) + elseif(${qualifier} STREQUAL PUBLIC) + set(PROJECT_${pkgname}_VERSION ${ARGS_VERSION}) + set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) + set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname}) + set(PROJECT_INTERFACE_${pkgname}_VERSION ${ARGS_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 ${ARGS_VERSION}) + set(PROJECT_INTERFACE_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) + set(PROJECT_INTERFACE_PACKAGE_DEPENDENCIES ${PROJECT_INTERFACE_PACKAGE_DEPENDENCIES} ${pkgname}) + endif() + endif() +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() diff --git a/cmake/modules/FindPythia6.cmake b/cmake/modules/FindPythia6.cmake index 3d69898c05..6669d901d3 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 @@ -29,13 +29,14 @@ if (Pythia6_LIBRARY_DIR) endif(Pythia6_LIBRARY_DIR) if (Pythia6_FOUND) - if (NOT Pythia6_FIND_QUIETLY) + SET(Pythia6_VERSION "6.4") + 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/FindROOT.cmake b/cmake/modules/FindROOT.cmake index 5f061d9893..dd69591f44 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,7 +35,7 @@ # 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. @@ -49,19 +49,19 @@ 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 @@ -70,10 +70,9 @@ If(ROOT_CONFIG_EXECUTABLE) String(STRIP ${ROOT_VERSION_STRING} ROOT_VERSION_STRING) 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 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 +86,7 @@ If(ROOT_CONFIG_EXECUTABLE) Set(ROOT_Version ${found_vers}) Set(ROOT_VERSION_NUMBER ${found_vers}) + Set(ROOT_VERSION ${ROOT_VERSION_STRING}) If(found_vers LESS req_vers) Set(ROOT_FOUND FALSE) @@ -138,8 +138,8 @@ If(ROOT_FOUND) ####################################### # - # Check the executables of ROOT - # ( rootcint ) + # Check the executables of ROOT + # ( rootcint ) # ####################################### diff --git a/cmake/modules_old/FindGEANT3.cmake b/cmake/modules_old/FindGEANT3.cmake index 492b9e7dad..839d0047dd 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) @@ -104,6 +110,19 @@ 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}) + endif() +ENDFOREACH() + + FIND_LIBRARY(GEANT3_LIB NAMES geant321 PATHS ${GEANT3_PATH}/lib ${SIMPATH}/lib @@ -133,4 +152,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..6ad18426ef 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 @@ -32,9 +32,11 @@ 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 + ) EndIf(GEANT4_DIR) - FIND_PATH(GEANT4_INCLUDE_DIR NAMES G4Event.hh PATHS ${SIMPATH}/transport/geant4/include ${SIMPATH}/transport/geant4/include/geant4 @@ -47,8 +49,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 +59,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 ) @@ -81,4 +83,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/FindGEANT4VMC.cmake b/cmake/modules_old/FindGEANT4VMC.cmake index 1162b04bb4..fbfd0f6866 100644 --- a/cmake/modules_old/FindGEANT4VMC.cmake +++ b/cmake/modules_old/FindGEANT4VMC.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 GEANT4VMC @@ -31,22 +31,22 @@ FIND_PATH(GEANT4VMC_INCLUDE_DIR NAMES TG4G3Units.h PATHS ) #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/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 #) @@ -70,6 +70,19 @@ 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}) + 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 @@ -116,7 +129,6 @@ if (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR AND VGM_LIBRARY_DIR) 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/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} From 757fcd0edc568f3541739a700aff2d217be26108 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Sat, 9 Mar 2019 19:59:22 +0100 Subject: [PATCH 02/15] print out package versions and prefix --- CMakeLists.txt | 51 +++++++++++---------------- cmake/modules/FindIWYU.cmake | 27 +++++++++----- cmake/modules/FindPLUTO.cmake | 6 ++-- cmake/modules/FindPythia6.cmake | 1 + cmake/modules/FindROOT.cmake | 1 + cmake/modules_old/FindGEANT3.cmake | 1 + cmake/modules_old/FindGEANT4.cmake | 2 ++ cmake/modules_old/FindGEANT4VMC.cmake | 1 + 8 files changed, 47 insertions(+), 43 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c9217a828..f74b88c19d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ endforeach() # Set project version SET(FAIRROOT_MAJOR_VERSION 18) SET(FAIRROOT_MINOR_VERSION 0) -SET(FAIRROOT_PATCH_VERSION 1) +SET(FAIRROOT_PATCH_VERSION 3) # Set name of our project to "FAIRROOT". # Has to be done after check of cmake version @@ -161,8 +161,8 @@ if(SIMPATH) endif() # FairRoot only supports ROOT6, so check which version is available -find_package2(PUBLIC ROOT VERSION 6.10.00 REQUIRED) -find_package2(PUBLIC FairLogger VERSION 1.2.0 REQUIRED) +find_package2(PUBLIC ROOT QUIET VERSION 6.10.00 REQUIRED) +find_package2(PUBLIC FairLogger QUIET VERSION 1.2.0 REQUIRED) find_package2(PUBLIC Pythia6) find_package2(PUBLIC Pythia8) @@ -238,11 +238,11 @@ else(FAIRROOT_MODULAR_BUILD) find_package2(PUBLIC GEANT4) find_package2(PUBLIC GEANT4DATA) find_package2(PUBLIC GEANT4VMC) - find_package2(PUBLIC CLHEP) + find_package(CLHEP) endif(FAIRROOT_MODULAR_BUILD) -find_package2(PUBLIC CUDA) -find_package2(PUBLIC IWYU) +find_package(CUDA) +find_package(IWYU) if(NOT DISABLE_GO) find_package2(PUBLIC Go VERSION 1.7) endif() @@ -406,29 +406,8 @@ Install(FILES ${CMAKE_BINARY_DIR}/config.sh_install DESTINATION bin RENAME FairRootConfig.sh ) - -Install(FILES ${CMAKE_BINARY_DIR}/check_system.sh - DESTINATION bin - ) - -Install(FILES ${CMAKE_BINARY_DIR}/FairVersion.h - DESTINATION include - ) - -Install(FILES ${CMAKE_BINARY_DIR}/config.csh_install - DESTINATION bin - RENAME FairRootConfig.csh - ) - -Install(FILES ${CMAKE_BINARY_DIR}/check_system.csh - DESTINATION bin - ) - -Install(DIRECTORY cmake - DESTINATION share/fairbase - PATTERN ".svn" EXCLUDE) - 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 @@ -489,7 +468,7 @@ endif() ################################################################################ if(PROJECT_PACKAGE_DEPENDENCIES) message(STATUS " ") - message(STATUS " ${Cyan}DEPENDENCY FOUND VERSION ${CR}") + message(STATUS " ${Cyan}DEPENDENCY FOUND VERSION PREFIX${CR}") foreach(dep IN LISTS PROJECT_PACKAGE_DEPENDENCIES) if(${dep}_VERSION) if(${dep} STREQUAL DDS) @@ -514,7 +493,19 @@ if(PROJECT_PACKAGE_DEPENDENCIES) else() pad("${version_str}${version_req_str}" 25 " " version_padded COLOR 1) endif() - message(STATUS " ${BWhite}${dep_padded}${CR}${version_padded}") + 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() + + message(STATUS " ${BWhite}${dep_padded}${CR}${version_padded}${prefix}") + unset(version_str) unset(version_padded) unset(version_req_str) diff --git a/cmake/modules/FindIWYU.cmake b/cmake/modules/FindIWYU.cmake index e1810e76f7..94115ac387 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 @@ -17,10 +17,19 @@ 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(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}") @@ -40,26 +49,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 +76,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 6669d901d3..26483ea524 100644 --- a/cmake/modules/FindPythia6.cmake +++ b/cmake/modules/FindPythia6.cmake @@ -30,6 +30,7 @@ endif(Pythia6_LIBRARY_DIR) if (Pythia6_FOUND) 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}) diff --git a/cmake/modules/FindROOT.cmake b/cmake/modules/FindROOT.cmake index dd69591f44..8a9ece82e4 100644 --- a/cmake/modules/FindROOT.cmake +++ b/cmake/modules/FindROOT.cmake @@ -87,6 +87,7 @@ 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) diff --git a/cmake/modules_old/FindGEANT3.cmake b/cmake/modules_old/FindGEANT3.cmake index 839d0047dd..89149122cc 100644 --- a/cmake/modules_old/FindGEANT3.cmake +++ b/cmake/modules_old/FindGEANT3.cmake @@ -119,6 +119,7 @@ FOREACH(subdir ${SUBDIRS}) 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() diff --git a/cmake/modules_old/FindGEANT4.cmake b/cmake/modules_old/FindGEANT4.cmake index 6ad18426ef..2c191cd3c0 100644 --- a/cmake/modules_old/FindGEANT4.cmake +++ b/cmake/modules_old/FindGEANT4.cmake @@ -35,6 +35,8 @@ If(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 diff --git a/cmake/modules_old/FindGEANT4VMC.cmake b/cmake/modules_old/FindGEANT4VMC.cmake index fbfd0f6866..ee10470526 100644 --- a/cmake/modules_old/FindGEANT4VMC.cmake +++ b/cmake/modules_old/FindGEANT4VMC.cmake @@ -79,6 +79,7 @@ FOREACH(subdir ${SUBDIRS}) 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() From c45a2340bf1a46dce618c149e53b9db893a3c7df Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Mon, 11 Mar 2019 09:11:06 +0100 Subject: [PATCH 03/15] minor fixes --- CMakeLists.txt | 24 ++-- base/CMakeLists.txt | 4 +- cmake/modules/FairMacros.cmake | 211 ++++++++++++++------------------- 3 files changed, 98 insertions(+), 141 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f74b88c19d..b9ff969bd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,19 +15,6 @@ # Check if cmake has the required version CMAKE_MINIMUM_REQUIRED(VERSION 3.11.0 FATAL_ERROR) -### CMP0025 -### CMP0042 MACOSX_RPATH is enabled by default. - -foreach(p - CMP0025 # Compiler id for Apple Clang is now AppleClang. - CMP0028 # double colon for imported and alias targets - CMP0042 # MACOSX_RPATH is enabled by default. - CMP0054 # Only interpret ``if()`` arguments as variables or keywords when unquoted. - ) - if(POLICY ${p}) - cmake_policy(SET ${p} NEW) - endif() -endforeach() # Set project version SET(FAIRROOT_MAJOR_VERSION 18) @@ -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,10 +152,11 @@ if(SIMPATH) endif() # FairRoot only supports ROOT6, so check which version is available -find_package2(PUBLIC ROOT QUIET VERSION 6.10.00 REQUIRED) -find_package2(PUBLIC FairLogger QUIET VERSION 1.2.0 REQUIRED) +find_package2(PUBLIC ROOT VERSION 6.10.00 QUIET REQUIRED) +find_package2(PUBLIC FairLogger VERSION 1.2.0 QUIET REQUIRED) find_package2(PUBLIC Pythia6) -find_package2(PUBLIC Pythia8) + +find_package2(PUBLIC Pythia8 QUIET) find_package2(PUBLIC Protobuf) find_package2(PUBLIC msgpack) 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/modules/FairMacros.cmake b/cmake/modules/FairMacros.cmake index 5355d9c1ec..4cc71c084d 100644 --- a/cmake/modules/FairMacros.cmake +++ b/cmake/modules/FairMacros.cmake @@ -1,26 +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, # - # 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}") - # - ################################################################ - # Defines some variables with console color escape sequences +################################################################################ +# 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") @@ -41,7 +27,25 @@ set(BWhite "${Esc}[1;37m") endif() - MACRO(SUBDIRLIST result curdir) +################################################################################ +#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}) @@ -50,94 +54,79 @@ ENDIF() ENDFOREACH() SET(${result} ${dirlist}) - ENDMACRO() - - +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}) ENDIF (${FILE_EXT1} MATCHES "^[*][.]+.*$") - IF (${FILE_EXT2} MATCHES "^[*][.]+.*$") 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) - 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) @@ -147,38 +136,33 @@ MACRO (CHECK_OUT_OF_SOURCE_BUILD) 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}) @@ -189,12 +173,10 @@ MACRO(UNIQUE var_name list) ENDFOREACH(l) SET(${var_name} ${unique_tmp}) ENDMACRO(UNIQUE) - - -################################################### +################################################################################ # 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. @@ -206,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 "") @@ -217,7 +199,7 @@ 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) get_filename_component(path_name ${SCRIPT_FULL_NAME} PATH) @@ -232,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}) @@ -249,16 +227,12 @@ 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}") - ENDMACRO (GENERATE_TEST_SCRIPT) +################################################################################ Macro(Generate_Exe_Script _Path _ExeName) - Message("PATH: ${_Path}") Message("ExeName: ${_ExeName}") set(shell_script_name "${_ExeName}.sh") @@ -277,6 +251,7 @@ Macro(Generate_Exe_Script _Path _ExeName) EXEC_PROGRAM(/bin/chmod ARGS "u+x ${new_path}/${shell_script_name}") EndMacro(Generate_Exe_Script) +################################################################################ Macro (Generate_Version_Info) IF(FAIRROOT_FOUND) @@ -292,7 +267,6 @@ IF(FAIRROOT_FOUND) ) ELSE(FAIRROOT_FOUND) Add_Custom_Target(svnheader ALL) - Add_Custom_Command(TARGET svnheader COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} -DBINARY_DIR=${CMAKE_BINARY_DIR} @@ -302,9 +276,9 @@ ELSE(FAIRROOT_FOUND) ENDIF(FAIRROOT_FOUND) EndMacro (Generate_Version_Info) +################################################################################ Macro (SetBasicVariables) - IF(FAIRROOT_FOUND) Set(BASE_INCLUDE_DIRECTORIES ${FAIRROOT_INCLUDE_DIR} @@ -355,22 +329,13 @@ Set(BASE_LINK_DIRECTORIES ) 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}) @@ -405,8 +370,7 @@ macro(find_package2 qualifier pkgname) endif() endmacro() - - +################################################################################ function(pad str width char out) cmake_parse_arguments(ARGS "" "COLOR" "" ${ARGN}) string(LENGTH ${str} length) @@ -422,3 +386,4 @@ function(pad str width char out) endif() set(${out} ${str} PARENT_SCOPE) endfunction() +################################################################################ From f8915ca2383b4ab0e61b7060c6a4c727ad92ba4e Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Mon, 11 Mar 2019 11:00:47 +0100 Subject: [PATCH 04/15] Improve findPythia8 and add accedently removed statment --- CMakeLists.txt | 28 +++++++- cmake/modules/FairMacros.cmake | 12 ++-- cmake/modules/FindPythia8.cmake | 112 +++++++++++++++++--------------- cmake/modules/ROOTMacros.cmake | 7 +- 4 files changed, 96 insertions(+), 63 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9ff969bd3..f92e7d204c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,12 +5,12 @@ # 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) @@ -156,7 +156,7 @@ find_package2(PUBLIC ROOT VERSION 6.10.00 QUIET REQUIRED) find_package2(PUBLIC FairLogger VERSION 1.2.0 QUIET REQUIRED) find_package2(PUBLIC Pythia6) -find_package2(PUBLIC Pythia8 QUIET) +find_package2(PUBLIC Pythia8) find_package2(PUBLIC Protobuf) find_package2(PUBLIC msgpack) @@ -398,6 +398,25 @@ Install(FILES ${CMAKE_BINARY_DIR}/config.sh_install DESTINATION bin RENAME FairRootConfig.sh ) + + +Install(FILES ${CMAKE_BINARY_DIR}/check_system.sh + DESTINATION bin + ) +Install(FILES ${CMAKE_BINARY_DIR}/FairVersion.h + DESTINATION include + ) +Install(FILES ${CMAKE_BINARY_DIR}/config.csh_install + DESTINATION bin + RENAME FairRootConfig.csh + ) +Install(FILES ${CMAKE_BINARY_DIR}/check_system.csh + DESTINATION bin + ) + Install(DIRECTORY cmake + DESTINATION share/fairbase + PATTERN ".svn" EXCLUDE) + find_package2(PUBLIC Git) set (Git_VERSION ${GIT_VERSION_STRING}) @@ -495,6 +514,9 @@ if(PROJECT_PACKAGE_DEPENDENCIES) if(${dep} STREQUAL msgpack) set(prefix ${Protobuf_INCLUDE_DIRS}) endif() + if(${dep} STREQUAL Pythia8) + set(prefix ${PYTHIA8_LIBRARY}) + endif() message(STATUS " ${BWhite}${dep_padded}${CR}${version_padded}${prefix}") diff --git a/cmake/modules/FairMacros.cmake b/cmake/modules/FairMacros.cmake index 4cc71c084d..29ded8a6f3 100644 --- a/cmake/modules/FairMacros.cmake +++ b/cmake/modules/FairMacros.cmake @@ -227,7 +227,7 @@ 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) ################################################################################ @@ -248,7 +248,7 @@ 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) ################################################################################ @@ -338,9 +338,9 @@ 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}) + Message(STATUS "Looking for ---------------------------------${pkgname} 1") + set(old_CPP ${CMAKE_PREFIX_PATH}) set(CMAKE_PREFIX_PATH ${${pkgname_upper}_ROOT} $ENV{${pkgname_upper}_ROOT} ${CMAKE_PREFIX_PATH}) if(ARGS_COMPONENTS) find_package(${pkgname} ${ARGS_VERSION} QUIET COMPONENTS ${ARGS_COMPONENTS} ${ARGS_UNPARSED_ARGUMENTS}) @@ -349,13 +349,15 @@ macro(find_package2 qualifier pkgname) endif() set(CMAKE_PREFIX_PATH ${old_CPP}) unset(old_CPP) - + Message(STATUS "Found #########----######### ${pkgname}-------- 2") if(${pkgname}_FOUND) + Message(STATUS "Found ################## ${pkgname}-------- 3 ") if(${qualifier} STREQUAL PRIVATE) set(PROJECT_${pkgname}_VERSION ${ARGS_VERSION}) set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname}) elseif(${qualifier} STREQUAL PUBLIC) + Message(STATUS "Found Public----------------------------${pkgname}-------- 4") set(PROJECT_${pkgname}_VERSION ${ARGS_VERSION}) set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname}) diff --git a/cmake/modules/FindPythia8.cmake b/cmake/modules/FindPythia8.cmake index 20abb0a624..4e86803c33 100644 --- a/cmake/modules/FindPythia8.cmake +++ b/cmake/modules/FindPythia8.cmake @@ -1,59 +1,69 @@ ################################################################################ # 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 + 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_library(PYTHIA8_hepmcinterface_LIBRARY + NAMES hepmcinterface pythia8tohepmc + HINTS ${_pythia8dirs} + PATH_SUFFIXES lib) + +find_library(PYTHIA8_lhapdfdummy_LIBRARY + NAMES lhapdfdummy + HINTS ${_pythia8dirs} + PATH_SUFFIXES lib) + +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/ROOTMacros.cmake b/cmake/modules/ROOTMacros.cmake index 6268514346..f8b41e58c8 100644 --- a/cmake/modules/ROOTMacros.cmake +++ b/cmake/modules/ROOTMacros.cmake @@ -210,7 +210,7 @@ MACRO (GENERATE_ROOT_TEST_SCRIPT SCRIPT_FULL_NAME) ) ENDIF(FAIRROOTPATH) - 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_ROOT_TEST_SCRIPT) @@ -311,13 +311,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 +364,3 @@ Macro(GENERATE_EXECUTABLE) Set(DEPENDENCIES) EndMacro(GENERATE_EXECUTABLE) - From ff2e40cc1ea1170c415f299f52c3d106ca4dea4f Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Mon, 11 Mar 2019 13:02:11 +0100 Subject: [PATCH 05/15] Add FindVGM --- CMakeLists.txt | 4 +- cmake/modules/FairMacros.cmake | 6 +-- cmake/modules/FindVGM.cmake | 54 +++++++++++++++++++++++++++ cmake/modules_old/FindGEANT4VMC.cmake | 50 ++----------------------- 4 files changed, 62 insertions(+), 52 deletions(-) create mode 100644 cmake/modules/FindVGM.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f92e7d204c..111096f8b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,8 +214,9 @@ if(FAIRROOT_MODULAR_BUILD) Set(GEANT4VMC_FOUND TRUE) # Message(STATUS "Looking for GEANT4VMC... - found ${GEANT4VMC_LIBRARY_DIR}") EndIf() - Message(STATUS "Looking for VGM...") + Find_Package2(PUBLIC VGM) + If(VGM_DIR) Set(VGM_INCLUDE_DIR ${VGM_INCLUDE_DIRS}) Set(VGM_LIBRARY_DIR "${VGM_DIR}/..") @@ -229,6 +230,7 @@ else(FAIRROOT_MODULAR_BUILD) 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) diff --git a/cmake/modules/FairMacros.cmake b/cmake/modules/FairMacros.cmake index 29ded8a6f3..86fe07c444 100644 --- a/cmake/modules/FairMacros.cmake +++ b/cmake/modules/FairMacros.cmake @@ -339,8 +339,7 @@ EndMacro (SetBasicVariables) macro(find_package2 qualifier pkgname) cmake_parse_arguments(ARGS "" "VERSION" "COMPONENTS" ${ARGN}) string(TOUPPER ${pkgname} pkgname_upper) - Message(STATUS "Looking for ---------------------------------${pkgname} 1") - set(old_CPP ${CMAKE_PREFIX_PATH}) + set(old_CPP ${CMAKE_PREFIX_PATH}) set(CMAKE_PREFIX_PATH ${${pkgname_upper}_ROOT} $ENV{${pkgname_upper}_ROOT} ${CMAKE_PREFIX_PATH}) if(ARGS_COMPONENTS) find_package(${pkgname} ${ARGS_VERSION} QUIET COMPONENTS ${ARGS_COMPONENTS} ${ARGS_UNPARSED_ARGUMENTS}) @@ -349,15 +348,12 @@ macro(find_package2 qualifier pkgname) endif() set(CMAKE_PREFIX_PATH ${old_CPP}) unset(old_CPP) - Message(STATUS "Found #########----######### ${pkgname}-------- 2") if(${pkgname}_FOUND) - Message(STATUS "Found ################## ${pkgname}-------- 3 ") if(${qualifier} STREQUAL PRIVATE) set(PROJECT_${pkgname}_VERSION ${ARGS_VERSION}) set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname}) elseif(${qualifier} STREQUAL PUBLIC) - Message(STATUS "Found Public----------------------------${pkgname}-------- 4") set(PROJECT_${pkgname}_VERSION ${ARGS_VERSION}) set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname}) diff --git a/cmake/modules/FindVGM.cmake b/cmake/modules/FindVGM.cmake new file mode 100644 index 0000000000..06158f01bd --- /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_old/FindGEANT4VMC.cmake b/cmake/modules_old/FindGEANT4VMC.cmake index ee10470526..90343ef345 100644 --- a/cmake/modules_old/FindGEANT4VMC.cmake +++ b/cmake/modules_old/FindGEANT4VMC.cmake @@ -8,10 +8,10 @@ # - 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) @@ -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 @@ -102,28 +82,6 @@ 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) From bd303d718fcee03b68ff0d3f35222c8a8dce8696 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Mon, 11 Mar 2019 16:00:56 +0100 Subject: [PATCH 06/15] Add print out for components and improve find_pythia8 --- CMakeLists.txt | 29 ++++++++++++++++++++++++++++- cmake/modules/FindPythia8.cmake | 20 +++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 111096f8b3..700084a375 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -517,7 +517,7 @@ if(PROJECT_PACKAGE_DEPENDENCIES) set(prefix ${Protobuf_INCLUDE_DIRS}) endif() if(${dep} STREQUAL Pythia8) - set(prefix ${PYTHIA8_LIBRARY}) + set(prefix ${PYTHIA8_LIB_DIR}) endif() message(STATUS " ${BWhite}${dep_padded}${CR}${version_padded}${prefix}") @@ -527,5 +527,32 @@ if(PROJECT_PACKAGE_DEPENDENCIES) 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}") + + + + message(STATUS " ") ################################################################################ diff --git a/cmake/modules/FindPythia8.cmake b/cmake/modules/FindPythia8.cmake index 4e86803c33..4c6e60a336 100644 --- a/cmake/modules/FindPythia8.cmake +++ b/cmake/modules/FindPythia8.cmake @@ -28,7 +28,7 @@ set(_pythia8dirs /opt/pythia8) find_path(PYTHIA8_INCLUDE_DIR - NAMES Pythia8/Pythia.h + 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.") @@ -39,6 +39,15 @@ find_library(PYTHIA8_LIBRARY 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} @@ -49,6 +58,15 @@ find_library(PYTHIA8_lhapdfdummy_LIBRARY 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}}) From ebdd689ea42df6bf54c29536da47089001bf1ec1 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Tue, 12 Mar 2019 10:52:08 +0100 Subject: [PATCH 07/15] Improve CMake output -Find report only on errors, the out put of find is summarized at the end -Improve the Compiler check --- CMakeLists.txt | 13 +-- cmake/modules/CheckCompiler.cmake | 29 +++++-- cmake/modules/FairMacros.cmake | 30 +++++-- cmake/modules/FindFlatBuffers.cmake | 3 +- cmake/modules/FindIWYU.cmake | 2 +- cmake/modules/FindROOT.cmake | 5 +- cmake/modules_old/FindCLHEP.cmake | 15 ++-- cmake/modules_old/FindGEANT4DATA.cmake | 105 ++++++++----------------- 8 files changed, 96 insertions(+), 106 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 700084a375..e13ac789f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ # Check if cmake has the required version CMAKE_MINIMUM_REQUIRED(VERSION 3.11.0 FATAL_ERROR) - +set(CMAKE_INSTALL_MESSAGE LAZY) # Set project version SET(FAIRROOT_MAJOR_VERSION 18) SET(FAIRROOT_MINOR_VERSION 0) @@ -272,10 +272,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_package2(PUBLIC Boost VERSION 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}) diff --git a/cmake/modules/CheckCompiler.cmake b/cmake/modules/CheckCompiler.cmake index 629b4deba8..28618c7fc8 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,7 +38,7 @@ 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}) @@ -52,7 +52,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} STREQUAL ${FAIRROOT_C_COMPILER}) OR NOT (${FAIRSOFT_CXX_COMPILER} STREQUAL ${FAIRROOT_CXX_COMPILER})) + 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 +83,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}") @@ -220,12 +235,12 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin) 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") diff --git a/cmake/modules/FairMacros.cmake b/cmake/modules/FairMacros.cmake index 86fe07c444..70c6a2bd80 100644 --- a/cmake/modules/FairMacros.cmake +++ b/cmake/modules/FairMacros.cmake @@ -335,37 +335,53 @@ ELSE(FAIRROOT_FOUND) 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}) + 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) - find_package(${pkgname} ${ARGS_VERSION} QUIET COMPONENTS ${ARGS_COMPONENTS} ${ARGS_UNPARSED_ARGUMENTS}) + list(REMOVE_DUPLICATES ARGS_COMPONENTS) + find_package(${pkgname} ${__version__} QUIET COMPONENTS ${ARGS_COMPONENTS} ${ARGS_UNPARSED_ARGUMENTS}) else() - find_package(${pkgname} ${ARGS_VERSION} QUIET ${ARGS_UNPARSED_ARGUMENTS}) + 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 ${ARGS_VERSION}) + 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 ${ARGS_VERSION}) + set(PROJECT_${pkgname}_VERSION ${__version__}) set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS}) set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname}) - set(PROJECT_INTERFACE_${pkgname}_VERSION ${ARGS_VERSION}) + 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 ${ARGS_VERSION}) + 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() ################################################################################ diff --git a/cmake/modules/FindFlatBuffers.cmake b/cmake/modules/FindFlatBuffers.cmake index 95ff066798..b9ba7ae83a 100644 --- a/cmake/modules/FindFlatBuffers.cmake +++ b/cmake/modules/FindFlatBuffers.cmake @@ -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/FindIWYU.cmake b/cmake/modules/FindIWYU.cmake index 94115ac387..8593348466 100644 --- a/cmake/modules/FindIWYU.cmake +++ b/cmake/modules/FindIWYU.cmake @@ -32,7 +32,7 @@ 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) diff --git a/cmake/modules/FindROOT.cmake b/cmake/modules/FindROOT.cmake index 8a9ece82e4..09dc57878f 100644 --- a/cmake/modules/FindROOT.cmake +++ b/cmake/modules/FindROOT.cmake @@ -70,8 +70,9 @@ If(ROOT_CONFIG_EXECUTABLE) String(STRIP ${ROOT_VERSION_STRING} ROOT_VERSION_STRING) 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 diff --git a/cmake/modules_old/FindCLHEP.cmake b/cmake/modules_old/FindCLHEP.cmake index 2e4a1da256..1f45fe33e8 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 @@ -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/FindGEANT4DATA.cmake b/cmake/modules_old/FindGEANT4DATA.cmake index 118ad33b8f..44403f2b20 100644 --- a/cmake/modules_old/FindGEANT4DATA.cmake +++ b/cmake/modules_old/FindGEANT4DATA.cmake @@ -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) From 5511bc7f2a8fe0d0eda309131c42d9fa270ee3b4 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Tue, 12 Mar 2019 11:00:45 +0100 Subject: [PATCH 08/15] STRIP the string before comparing --- cmake/modules/CheckCompiler.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/modules/CheckCompiler.cmake b/cmake/modules/CheckCompiler.cmake index 28618c7fc8..e1af70d799 100644 --- a/cmake/modules/CheckCompiler.cmake +++ b/cmake/modules/CheckCompiler.cmake @@ -52,20 +52,24 @@ If(FAIRSOFT_CONFIG) Get_Filename_Component(FAIRROOT_C_COMPILER ${FAIRROOT_C_COMPILER} REALPATH) Get_Filename_Component(FAIRROOT_CXX_COMPILER ${FAIRROOT_CXX_COMPILER} REALPATH) - 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 ) - + String(STRIP ${FAIRSOFT_C_COMPILER_STRING} FAIRSOFT_C_COMPILER_STRING) + String(STRIP ${FAIRSOFT_CXX_COMPILER_STRING} FAIRSOFT_CXX_COMPILER_STRING) + String(STRIP ${FAIRROOT_C_COMPILER_STRING} FAIRROOT_C_COMPILER_STRING) + String(STRIP ${FAIRROOT_CXX_COMPILER_STRING} FAIRROOT_CXX_COMPILER_STRING) #If(NOT (${FAIRSOFT_C_COMPILER} STREQUAL ${FAIRROOT_C_COMPILER}) OR NOT (${FAIRSOFT_CXX_COMPILER} STREQUAL ${FAIRROOT_CXX_COMPILER})) 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) From 09e9aacdf5fe5b62581dd7696a7671688568490f Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Tue, 12 Mar 2019 14:08:58 +0100 Subject: [PATCH 09/15] correct compiler comparison on linux --- cmake/modules/CheckCompiler.cmake | 10 ++++------ cmake/modules/FairMacros.cmake | 17 +++++++++++++++++ cmake/modules_old/FindGEANT4.cmake | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/cmake/modules/CheckCompiler.cmake b/cmake/modules/CheckCompiler.cmake index e1af70d799..bca95faa91 100644 --- a/cmake/modules/CheckCompiler.cmake +++ b/cmake/modules/CheckCompiler.cmake @@ -42,8 +42,10 @@ If(FAIRSOFT_CONFIG) 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) @@ -66,12 +68,8 @@ If(FAIRSOFT_CONFIG) Execute_Process(COMMAND ${FAIRROOT_CXX_COMPILER} --version OUTPUT_VARIABLE FAIRROOT_CXX_COMPILER_STRING ) - String(STRIP ${FAIRSOFT_C_COMPILER_STRING} FAIRSOFT_C_COMPILER_STRING) - String(STRIP ${FAIRSOFT_CXX_COMPILER_STRING} FAIRSOFT_CXX_COMPILER_STRING) - String(STRIP ${FAIRROOT_C_COMPILER_STRING} FAIRROOT_C_COMPILER_STRING) - String(STRIP ${FAIRROOT_CXX_COMPILER_STRING} FAIRROOT_CXX_COMPILER_STRING) - #If(NOT (${FAIRSOFT_C_COMPILER} STREQUAL ${FAIRROOT_C_COMPILER}) OR NOT (${FAIRSOFT_CXX_COMPILER} STREQUAL ${FAIRROOT_CXX_COMPILER})) - If(NOT (${FAIRSOFT_C_COMPILER_STRING} STREQUAL ${FAIRROOT_C_COMPILER_STRING}) OR NOT (${FAIRSOFT_CXX_COMPILER_STRING} STREQUAL ${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}") diff --git a/cmake/modules/FairMacros.cmake b/cmake/modules/FairMacros.cmake index 70c6a2bd80..8980069bea 100644 --- a/cmake/modules/FairMacros.cmake +++ b/cmake/modules/FairMacros.cmake @@ -401,3 +401,20 @@ function(pad str width char out) 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_old/FindGEANT4.cmake b/cmake/modules_old/FindGEANT4.cmake index 2c191cd3c0..ee6e1885d3 100644 --- a/cmake/modules_old/FindGEANT4.cmake +++ b/cmake/modules_old/FindGEANT4.cmake @@ -76,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}) From 2039c991c9128392faac24e03e70391ecd5a20dc Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Tue, 12 Mar 2019 16:30:02 +0100 Subject: [PATCH 10/15] reduce the cmake output and add print more options --- CMakeLists.txt | 51 ++++++++++++------------- cmake/cuda/FindCUDA.cmake | 12 +++--- cmake/modules/FairMacros.cmake | 2 - cmake/modules/FindFlatBuffers.cmake | 2 +- cmake/modules/FindGo.cmake | 2 +- cmake/modules/FindHEPMC.cmake | 7 ++-- cmake/modules/FindIWYU.cmake | 3 +- cmake/modules/FindPythia6.cmake | 2 +- cmake/modules/FindROOT.cmake | 2 +- cmake/modules/FindSQLITE.cmake | 4 +- cmake/modules/FindTBB.cmake | 12 +++--- cmake/modules/FindVGM.cmake | 2 +- cmake/modules/Findglpk.cmake | 11 +++--- cmake/modules/WriteConfigFile.cmake | 52 +++++++++++++------------- cmake/modules_old/FindCLHEP.cmake | 2 +- cmake/modules_old/FindGEANT3.cmake | 2 +- cmake/modules_old/FindGEANT4.cmake | 2 +- cmake/modules_old/FindGEANT4DATA.cmake | 4 +- cmake/modules_old/FindGEANT4VMC.cmake | 2 +- cmake/modules_old/FindGENERATORS.cmake | 5 +-- 20 files changed, 89 insertions(+), 92 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e13ac789f9..b4bb0fccfb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,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 @@ -152,12 +152,10 @@ if(SIMPATH) endif() # FairRoot only supports ROOT6, so check which version is available -find_package2(PUBLIC ROOT VERSION 6.10.00 QUIET REQUIRED) -find_package2(PUBLIC FairLogger VERSION 1.2.0 QUIET REQUIRED) +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) @@ -225,7 +223,6 @@ 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_package2(PUBLIC GEANT3) find_package2(PUBLIC GEANT4) @@ -235,15 +232,22 @@ else(FAIRROOT_MODULAR_BUILD) find_package(CLHEP) endif(FAIRROOT_MODULAR_BUILD) -find_package(CUDA) -find_package(IWYU) -if(NOT DISABLE_GO) +#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_package2(PUBLIC GSL) if(NOT DEFINED GTEST_ROOT) set(GTEST_ROOT ${SIMPATH}) endif() + find_package2(PUBLIC FairMQ VERSION 1.2.3) If(WITH_DBASE) @@ -264,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. @@ -440,21 +444,6 @@ Install(PROGRAMS ${CMAKE_BINARY_DIR}/fairroot-config DESTINATION bin ) -if(NOT FAIRROOT_MINIMAL) - - 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) - -else(NOT FAIRROOT_MINIMAL) - WRITE_MINIMAL_CONFIG_FILE(config.sh) -endif(NOT FAIRROOT_MINIMAL) - - # Summary ###################################################################### if(CMAKE_CXX_FLAGS) @@ -554,7 +543,19 @@ else() 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}") message(STATUS " ") 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/FairMacros.cmake b/cmake/modules/FairMacros.cmake index 8980069bea..6fb94f3edc 100644 --- a/cmake/modules/FairMacros.cmake +++ b/cmake/modules/FairMacros.cmake @@ -339,7 +339,6 @@ 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}) @@ -361,7 +360,6 @@ macro(find_package2 qualifier pkgname) endif() set(CMAKE_PREFIX_PATH ${old_CPP}) unset(old_CPP) - if(${pkgname}_FOUND) if(${qualifier} STREQUAL PRIVATE) set(PROJECT_${pkgname}_VERSION ${__version__}) diff --git a/cmake/modules/FindFlatBuffers.cmake b/cmake/modules/FindFlatBuffers.cmake index b9ba7ae83a..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 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 8593348466..0a9b34f76a 100644 --- a/cmake/modules/FindIWYU.cmake +++ b/cmake/modules/FindIWYU.cmake @@ -13,7 +13,7 @@ # # 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) @@ -23,6 +23,7 @@ If(IWYU_BINARY) 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}") diff --git a/cmake/modules/FindPythia6.cmake b/cmake/modules/FindPythia6.cmake index 26483ea524..e967844470 100644 --- a/cmake/modules/FindPythia6.cmake +++ b/cmake/modules/FindPythia6.cmake @@ -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 diff --git a/cmake/modules/FindROOT.cmake b/cmake/modules/FindROOT.cmake index 09dc57878f..471c3f0c11 100644 --- a/cmake/modules/FindROOT.cmake +++ b/cmake/modules/FindROOT.cmake @@ -42,7 +42,7 @@ # # RLIBMAP_EXECUTABLE The rlibmap executable. -Message(STATUS "Looking for Root...") +#Message(STATUS "Looking for Root...") Set(ROOT_FOUND FALSE) Set(ROOT_DEFINITIONS "") 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 index 06158f01bd..c9dd966768 100644 --- a/cmake/modules/FindVGM.cmake +++ b/cmake/modules/FindVGM.cmake @@ -14,7 +14,7 @@ # VGM_DEFINITIONS - Compiler switches required for using VGM -MESSAGE(STATUS "Looking for VGM...") +#MESSAGE(STATUS "Looking for VGM...") FIND_PATH(VGM_LIBRARY_DIR NAMES libBaseVGM.so libBaseVGM.dylib PATHS ${SIMPATH}/transport/vgm/lib/Linux-g++ 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/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 1f45fe33e8..2cf3825c8a 100644 --- a/cmake/modules_old/FindCLHEP.cmake +++ b/cmake/modules_old/FindCLHEP.cmake @@ -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 diff --git a/cmake/modules_old/FindGEANT3.cmake b/cmake/modules_old/FindGEANT3.cmake index 89149122cc..f080454844 100644 --- a/cmake/modules_old/FindGEANT3.cmake +++ b/cmake/modules_old/FindGEANT3.cmake @@ -84,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 diff --git a/cmake/modules_old/FindGEANT4.cmake b/cmake/modules_old/FindGEANT4.cmake index ee6e1885d3..eefd67089a 100644 --- a/cmake/modules_old/FindGEANT4.cmake +++ b/cmake/modules_old/FindGEANT4.cmake @@ -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 diff --git a/cmake/modules_old/FindGEANT4DATA.cmake b/cmake/modules_old/FindGEANT4DATA.cmake index 44403f2b20..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 diff --git a/cmake/modules_old/FindGEANT4VMC.cmake b/cmake/modules_old/FindGEANT4VMC.cmake index 90343ef345..299c3aeb2c 100644 --- a/cmake/modules_old/FindGEANT4VMC.cmake +++ b/cmake/modules_old/FindGEANT4VMC.cmake @@ -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 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) - From fe43822c4dacbc85dd9729007ec1f1a671278801 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Tue, 12 Mar 2019 20:03:40 +0100 Subject: [PATCH 11/15] add build type table to cmake output --- CMakeLists.txt | 8 +-- cmake/modules/CheckCompiler.cmake | 114 ++++++++++++++---------------- 2 files changed, 55 insertions(+), 67 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4bb0fccfb..337ba58eba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,7 +163,7 @@ find_package2(PUBLIC FlatBuffers) if(FAIRROOT_MODULAR_BUILD) # Geant3, Geant4 installed via cmake - Message(STATUS "Looking for GEANT3...") + #Message(STATUS "Looking for GEANT3...") Find_Package2(PUBLIC Geant3) If(Geant3_DIR) list(APPEND PROJECT_PACKAGE_COMPONENTS Geant3) @@ -181,7 +181,7 @@ if(FAIRROOT_MODULAR_BUILD) Set(GEANT3_FOUND FALSE) Message(Status "Looking for GEANT3... - Not found ") EndIf() - Message(STATUS "Looking for GEANT4...") + #Message(STATUS "Looking for GEANT4...") find_package2(PUBLIC Geant4) If(Geant4_DIR) Set(GEANT4_INCLUDE_DIR ${Geant4_INCLUDE_DIRS}) @@ -383,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) diff --git a/cmake/modules/CheckCompiler.cmake b/cmake/modules/CheckCompiler.cmake index bca95faa91..d4355ca649 100644 --- a/cmake/modules/CheckCompiler.cmake +++ b/cmake/modules/CheckCompiler.cmake @@ -111,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) @@ -182,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) @@ -218,19 +207,21 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin) Execute_Process(COMMAND gfortran -print-file-name=libgfortran.dylib OUTPUT_VARIABLE FORTRAN_LIBDIR ) - Get_Filename_Component(FORTRAN_LIBDIR ${FORTRAN_LIBDIR} + 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") @@ -249,13 +240,12 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin) 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 ) From 701006b5f50f150a9d71a7ab6f34dbdd439cbb47 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Wed, 13 Mar 2019 10:33:19 +0100 Subject: [PATCH 12/15] add accedently removed lines --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 337ba58eba..19a40be833 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -443,6 +443,13 @@ Install(PROGRAMS ${CMAKE_BINARY_DIR}/fairroot-config ) +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 " ") From fab6d5cf2d3354db92966811757418b069cafb46 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Wed, 13 Mar 2019 13:23:59 +0100 Subject: [PATCH 13/15] Correct patch number, use execute_process instead of deprecated EXEC_PROGRAM --- CMakeLists.txt | 4 ++-- cmake/modules/CheckCompiler.cmake | 2 +- cmake/modules/ROOTMacros.cmake | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19a40be833..b2ccdc6660 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ set(CMAKE_INSTALL_MESSAGE LAZY) # Set project version SET(FAIRROOT_MAJOR_VERSION 18) SET(FAIRROOT_MINOR_VERSION 0) -SET(FAIRROOT_PATCH_VERSION 3) +SET(FAIRROOT_PATCH_VERSION 7) # Set name of our project to "FAIRROOT". # Has to be done after check of cmake version @@ -443,7 +443,7 @@ Install(PROGRAMS ${CMAKE_BINARY_DIR}/fairroot-config ) -WRITE_CONFIG_FILE(config.sh) +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) diff --git a/cmake/modules/CheckCompiler.cmake b/cmake/modules/CheckCompiler.cmake index d4355ca649..15565e61df 100644 --- a/cmake/modules/CheckCompiler.cmake +++ b/cmake/modules/CheckCompiler.cmake @@ -207,7 +207,7 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin) Execute_Process(COMMAND gfortran -print-file-name=libgfortran.dylib OUTPUT_VARIABLE FORTRAN_LIBDIR ) - Get_Filename_Component(--FORTRAN_LIBDIR ${FORTRAN_LIBDIR} + Get_Filename_Component(FORTRAN_LIBDIR ${FORTRAN_LIBDIR} PATH ) Message("-- Fortran libraries found in ${FORTRAN_LIBDIR}") diff --git a/cmake/modules/ROOTMacros.cmake b/cmake/modules/ROOTMacros.cmake index f8b41e58c8..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}" OUTPUT_VARIABLE tmp) + execute_process(COMMAND /bin/chmod u+x ${new_path}/${shell_script_name} OUTPUT_QUIET) ENDMACRO (GENERATE_ROOT_TEST_SCRIPT) From 5b3ec96f9ca86acc1cc53e12bb1d33ec51e95f63 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Thu, 14 Mar 2019 08:30:10 +0100 Subject: [PATCH 14/15] adapt the projects templates to the CMAKE changes --- .../project_root_containers/CMakeLists.txt | 106 ++++++++++-------- .../MyProjGenerators/Pythia8Generator.h | 26 ++--- .../project_stl_containers/CMakeLists.txt | 106 ++++++++++-------- .../MyProjGenerators/Pythia8Generator.h | 26 ++--- 4 files changed, 148 insertions(+), 116 deletions(-) diff --git a/templates/project_root_containers/CMakeLists.txt b/templates/project_root_containers/CMakeLists.txt index bc17b29d60..4ae5e0333e 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) + +ind_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..4ae5e0333e 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) + +ind_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 From 7fd2eb6c24c8429c0bbd62b068f2e473b3e54a90 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Thu, 14 Mar 2019 08:36:26 +0100 Subject: [PATCH 15/15] adapt the projects templates to the CMAKE changes-typo in cmake --- templates/project_root_containers/CMakeLists.txt | 2 +- templates/project_stl_containers/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/project_root_containers/CMakeLists.txt b/templates/project_root_containers/CMakeLists.txt index 4ae5e0333e..a30ae2882c 100644 --- a/templates/project_root_containers/CMakeLists.txt +++ b/templates/project_root_containers/CMakeLists.txt @@ -93,7 +93,7 @@ CHECK_EXTERNAL_PACKAGE_INSTALL_DIR() # mandatory -ind_package2(PUBLIC ROOT VERSION 6.10.00 REQUIRED) +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) diff --git a/templates/project_stl_containers/CMakeLists.txt b/templates/project_stl_containers/CMakeLists.txt index 4ae5e0333e..a30ae2882c 100644 --- a/templates/project_stl_containers/CMakeLists.txt +++ b/templates/project_stl_containers/CMakeLists.txt @@ -93,7 +93,7 @@ CHECK_EXTERNAL_PACKAGE_INSTALL_DIR() # mandatory -ind_package2(PUBLIC ROOT VERSION 6.10.00 REQUIRED) +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)