# The name of our project is "PANDAROOT". CMakeLists files in this project can # refer to the root source directory of the project as ${PANDAROOT_SOURCE_DIR} # or as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as # ${PANDAROOT_BINARY_DIR} or ${CMAKE_BINARY_DIR}. # This difference is important for the base classes which are in FAIRROOT # and PANDAROOT. # Check if cmake has the required version CMAKE_MINIMUM_REQUIRED(VERSION 2.8.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 CMP0042 # CMake 3.0 ) if(POLICY ${p}) cmake_policy(SET ${p} NEW) endif() endforeach() # Set name of our project to "PANDAROOT". Has to be done # after check of cmake version since this is a new feature project(PANDAROOT) ENABLE_LANGUAGE(Fortran) Option(PANDAROOT_MODULAR_BUILD "Modular build without environment variables" OFF) If(PANDAROOT_MODULAR_BUILD) If(FAIR_ROOT_PATH) Set(ENV{FAIRROOTPATH} ${FAIR_ROOT_PATH}) Set(FAIRROOTPATH ${FAIR_ROOT_PATH}) Set(FAIRROOT_FOUND TRUE) MESSAGE(STATUS "Took FAIRROOTPATH from command line: >>${FAIRROOTPATH}<<.") EndIf(FAIR_ROOT_PATH) Else(PANDAROOT_MODULAR_BUILD) FIND_PATH(FAIRBASE NAMES FairRun.h PATHS ${CMAKE_SOURCE_DIR}/base/steer NO_DEFAULT_PATH ) If (FAIRBASE) Message(STATUS "Found FAIRBASE") SET(FAIRBASE ${FAIRBASE}) Else (FAIRBASE) Message(STATUS "NOT Found FAIRBASE") IF(NOT DEFINED ENV{FAIRROOTPATH}) MESSAGE(FATAL_ERROR "You did not define the environment variable FAIRROOTPATH which is needed to find FairRoot. Please set this variable and execute cmake again.") ENDIF(NOT DEFINED ENV{FAIRROOTPATH}) SET(FAIRROOTPATH $ENV{FAIRROOTPATH}) EndIf (FAIRBASE) EndIf(PANDAROOT_MODULAR_BUILD) # 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 "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH}) If(NOT PANDAROOT_MODULAR_BUILD) set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old" ${CMAKE_MODULE_PATH}) EndIf(NOT PANDAROOT_MODULAR_BUILD) IF(FAIRROOTPATH) Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks") ELSE(FAIRROOTPATH) Set(CheckSrcDir "${CMAKE_SOURCE_DIR}/cmake/checks") ENDIF(FAIRROOTPATH) if(FAIRROOTPATH) find_package(FairRoot) endif(FAIRROOTPATH) # Load some basic macros which are needed later on include(FairMacros) include(WriteConfigFile) include(CTest) include(CheckCompiler) include(CheckFortran) Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow -Wall -Wextra -Wnon-virtual-dtor") #Check the compiler and set the compile and link flags If(NOT CMAKE_BUILD_TYPE) Message("Set BuildType DEBUG") set(CMAKE_BUILD_TYPE Debug) EndIf(NOT CMAKE_BUILD_TYPE) Check_Compiler() set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib") set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") set(INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include") If(PANDAROOT_MODULAR_BUILD) Set(VMCWORKDIR ${CMAKE_BINARY_DIR}/vmcworkdir) Else(PANDAROOT_MODULAR_BUILD) Set(VMCWORKDIR ${PANDAROOT_SOURCE_DIR}) EndIf(PANDAROOT_MODULAR_BUILD) Option(USE_PATH_INFO "Information from PATH and LD_LIBRARY_PATH are used." OFF) If(USE_PATH_INFO) Set(PATH "$PATH") If (APPLE) Set(LD_LIBRARY_PATH $ENV{DYLD_LIBRARY_PATH}) Else (APPLE) Set(LD_LIBRARY_PATH $ENV{LD_LIBRARY_PATH}) EndIf (APPLE) Else(USE_PATH_INFO) STRING(REGEX MATCHALL "[^:]+" PATH $ENV{PATH}) EndIf(USE_PATH_INFO) # Check if the user wants to build the project in the source # directory CHECK_OUT_OF_SOURCE_BUILD() # Check if we are on an UNIX system. If not stop with an error # 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) if(PANDAROOT_MODULAR_BUILD) Set(ENV{ROOTSYS} "${ROOTSYS}") find_package(ROOT 5.32.00 REQUIRED) find_package(Pythia8) # Geant3, Geant4 installed via cmake Message(STATUS "Looking for GEANT3...") set(GEANT3_PATH "${Geant3_DIR}") Find_Package(Geant3) # Fill the variables needed to create the config script If(Geant3_DIR) Set(GEANT3_INCLUDE_DIR ${Geant3_INCLUDE_DIRS}) Set(GEANT3_LIBRARIES ${Geant3_LIBRARIES}) Set(GEANT3_LIBRARY_DIR ${Geant3_DIR}/..) SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${GEANT3_LIBRARY_DIR}) FIND_PATH(GEANT3_SYSTEM_DIR NAMES data PATHS ${Geant3_DIR}/../../share/geant3 NO_DEFAULT_PATH ) Set(GEANT3_FOUND TRUE) Message(STATUS "!!!! Looking for GEANT3... - found ${GEANT3_LIBRARIES}") Else() Set(GEANT3_FOUND FALSE) Message(FATAL_ERROR "Looking for GEANT3... - Not found ") EndIf() Message(STATUS "Looking for GEANT4...") Find_Package(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... - includes ${GEANT4_INCLUDE_DIR}") Message(STATUS "Looking for GEANT4... - libraries ${GEANT4_LIBRARY_DIR}") Message(STATUS "Looking for GEANT4... - share ${GEANT4_SHARE_DIR}") Message(STATUS "looking for Geant4 data module in ${FAIRROOTPATH}/share/fairbase/cmake/modules_old") Set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old" ${CMAKE_MODULE_PATH}) Find_Package(GEANT4DATA) Else() Set(GEANT4_FOUND FALSE) Message(Status "Looking for GEANT4... - Not found ") EndIf() # 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) If(Geant4VMC_DIR) Set(GEANT4VMC_INCLUDE_DIR ${Geant4VMC_INCLUDE_DIRS}) Set(GEANT4VMC_LIBRARY_DIR "${Geant4VMC_DIR}/..") Set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${GEANT4VMC_LIBRARY_DIR}) Set(GEANT4VMC_SHARE_DIR "${Geant4VMC_DIR}/../../share") Find_Path(GEANT4VMC_MACRO_DIR NAMES g4libs.C PATHS ${GEANT4VMC_SHARE_DIR}/Geant4VMC-3.3.0/examples/macro NO_DEFAULT_PATH ) Set(GEANT4VMC_FOUND TRUE) Message(STATUS "Looking for GEANT4VMC... - found ${GEANT4VMC_LIBRARY_DIR}") EndIf() Message(STATUS "Looking for VGM...") Find_Package(VGM) If(VGM_DIR) Set(VGM_INCLUDE_DIR ${VGM_INCLUDE_DIRS}) Set(VGM_LIBRARY_DIR "${VGM_DIR}/..") Set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${VGM_LIBRARY_DIR}) Set(VGM_FOUND TRUE) Message(STATUS "Looking for VGM... - found ${VGM_LIBRARY_DIR}") EndIf() Message(STATUS "Looking for HEPMC...") find_package(HEPMC) Else(PANDAROOT_MODULAR_BUILD) # Check if we are at GSI # If we are GSI set some variables 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.") ENDIF(NOT DEFINED ENV{SIMPATH}) SET(SIMPATH $ENV{SIMPATH}) find_package(ROOT 5.32.00 REQUIRED) #find_package(PLUTO REQUIRED) #find_package(glpk REQUIRED) find_package(Pythia8 REQUIRED) find_package(GENERATORS REQUIRED) find_package(GEANT3 REQUIRED) find_package(GEANT4) find_package(GEANT4DATA) find_package(GEANT4VMC) find_package(CLHEP) find_package(CERNLIB) find_package(HEPMC) EndIf(PANDAROOT_MODULAR_BUILD) SET (PYTHIA8_INCLUDE_DIR ${PYTHIA8_INCLUDE_DIR} ${PYTHIA8_INCLUDE_DIR}/../ ) If(WITH_DBASE) find_package(MYSQL) find_package(PGSQL) find_package(SQLITE) EndIf(WITH_DBASE) # Check if the external packages are installed into a separate install # directory CHECK_EXTERNAL_PACKAGE_INSTALL_DIR() # Set the build type. Possibilities are None, Debug, Release, # RelWithDebInfo and MinSizeRel #SET(CMAKE_BUILD_TYPE Debug) # searches for needed packages # REQUIRED means that cmake will stop if this packages are not found # For example the framework can run without GEANT4, but ROOT is # mandatory Set(Boost_NO_SYSTEM_PATHS TRUE) Set(Boost_NO_BOOST_CMAKE TRUE) If(${ROOT_LIBRARY_DIR} MATCHES /lib/root) Set(BOOST_ROOT ${SIMPATH}) Else(${ROOT_LIBRARY_DIR} MATCHES /lib/root) Set(BOOST_ROOT ${SIMPATH}/basics/boost) 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.48) # COMPONENTS program_options thread system timer # serialization regex) SetBasicVariables() Message("SYSTEM_DIR1: ${SYSTEM_INCLUDE_DIRECTORIES}") # Set the library version in the main CMakeLists.txt SET(FAIRROOT_MAJOR_VERSION 0) SET(FAIRROOT_MINOR_VERSION 0) SET(FAIRROOT_PATCH_VERSION 0) SET(FAIRROOT_VERSION "${FAIRROOT_MAJOR_VERSION}.${FAIRROOT_MINOR_VERSION}.${FAIRROOT_PATCH_VERSION}") If(NOT DEFINED ROOT_FOUND_VERSION) SET(ROOT_FOUND_VERSION "${found_vers}") EndIf() MESSAGE("ROOT_FOUND_VERSION = ${ROOT_FOUND_VERSION}") If(ROOT_FOUND_VERSION LESS 59999) SET(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES} VERSION "${FAIRROOT_VERSION}" SOVERSION "${FAIRROOT_MAJOR_VERSION}" SUFFIX ".so" ) Else() SET(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES} VERSION "${FAIRROOT_VERSION}" SOVERSION "${FAIRROOT_MAJOR_VERSION}" ) EndIf() Generate_Version_Info() SET(CBMLIBDIR ${CMAKE_BINARY_DIR}/lib) SET(LD_LIBRARY_PATH ${CBMLIBDIR} ${LD_LIBRARY_PATH}) #IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # SET(CMAKE_INSTALL_PREFIX "./install" CACHE PATH "FOO install prefix" FORCE) # Message("Set default install path ...") #ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) install(DIRECTORY geometry DESTINATION pnd_install PATTERN ".svn" EXCLUDE ) # Check if the compiler support specific C++11 features # Up to now this is only a check since the code does not use # any of the features of the new standard IF(FAIRROOT_FOUND) Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks") ELSE(FAIRROOT_FOUND) Set(CheckSrcDir "${CMAKE_SOURCE_DIR}/cmake/checks") ENDIF(FAIRROOT_FOUND) include(CheckCXX11Features) IF(HAS_CXX11_SHAREDPOINTER) Add_Definitions(-DHAS_SHAREDPOINTER) ENDIF(HAS_CXX11_SHAREDPOINTER) string(FIND " ${CMAKE_CXX_FLAGS} " "-std=c++11" POS_C++11) if(POS_C++11) Message(STATUS "C++11 support found.") else() Message(STATUS "C++11 not supported.") endif() #Test if FairMultiLinkData has the old (2015) version #of Print(), or is the new (2016->) PrintLinkInfo implemented Message(STATUS "Checking for FairMultiLinkedData::PrintLinkInfo() function") Execute_process(COMMAND ${CMAKE_CXX_COMPILER} -c ${CMAKE_SOURCE_DIR}/PndTools/test/testFairMultiLinkedData.cpp -I${ROOT_INCLUDE_DIR} -I${FAIRROOTPATH}/include WORKING_DIRECTORY ${CMAKE_BINARY_DIR} RESULT_VARIABLE NO_PrintLinkInfo ERROR_QUIET ) If(NO_PrintLinkInfo) Message(STATUS "FairMultiLinkedData has Print()") Else(NO_PrintLinkInfo) Add_Definitions(-D_HavePrintLinkInfo) Set(DEFINITIONS ${DEFINITIONS} _HavePrintLinkInfo) Message(STATUS "FairMultiLinkedData has PrintLinkInfo()") EndIf(NO_PrintLinkInfo) # Recurse into the given subdirectories. This does not actually # cause another cmake executable to run. The same process will walk through # the project's entire directory structure. add_subdirectory(external) IF(NOT FAIRROOT_FOUND) add_subdirectory (fairtools) add_subdirectory (base) add_subdirectory (geobase) add_subdirectory (parbase) add_subdirectory (dbase) add_subdirectory (MbsAPI) add_subdirectory (trackbase) add_subdirectory (geane) add_subdirectory (generators) ENDIF (NOT FAIRROOT_FOUND) add_subdirectory (PndTools/generalTools) add_subdirectory (PndTools/buffers) #add_subdirectory (PndTools/PndTrkMerge) add_subdirectory (pnddata) add_subdirectory (passive) add_subdirectory (field) add_subdirectory (pgenerators) add_subdirectory (pgenerators/DpmEvtGen) add_subdirectory (pgenerators/FtfEvtGen) add_subdirectory (pgenerators/Direct) add_subdirectory (pgenerators/EvtGen) #add_subdirectory (pgenerators/PndFlukaGen) #add_subdirectory (pgenerators/EMFFgenerators) add_subdirectory (stt) add_subdirectory (sds) add_subdirectory (mvd) add_subdirectory (mdt) add_subdirectory (emc) add_subdirectory (drc) #add_subdirectory (drc/drcprop) add_subdirectory (fts) add_subdirectory (hyp) add_subdirectory (genfit) add_subdirectory (genfit2) add_subdirectory (scitil) add_subdirectory (ftof) add_subdirectory (rich) add_subdirectory (gem) add_subdirectory (macro) add_subdirectory (GenfitTools) #add_subdirectory(hypGe) add_subdirectory (fsim) add_subdirectory (rho) add_subdirectory (PndTools/AnalysisTools) add_subdirectory (PndTools/PndParticleFitters) add_subdirectory (PndTools/master) add_subdirectory (PndTools/TimeBasedTools) add_subdirectory (PndTrackers/sttmvdtracking) add_subdirectory (PndTrackers/CentralTracking) add_subdirectory (PndTrackers/SecondariesTracking) add_subdirectory (PndTrackers/SttCellTrackFinder) add_subdirectory (PndTrackers/catracking) add_subdirectory (PndTrackers/TrackingQA) add_subdirectory (PndTrackers/PndForwardTrackFinder) add_subdirectory (PndTrackers/PndIdealTrackFinder) add_subdirectory (PndTrackers/PndTrackingTools) add_subdirectory (PndTrackers/PndBarrelTrackFinder) add_subdirectory (PndTrackers/PndMvdGemTrackFinderOnHits) #add_subdirectory(online) #add_subdirectory(tracking/online/CircleHough) #add_subdirectory(PndTools/MQ) #add_subdirectory(mvd/MvdOfflineTBAnalysis_Topix4) #add_subdirectory(mvd/MvdOfflineTBAnalysis_Topix4/MQ) #add_subdirectory(mvd/MvdMQ) FIND_PATH(TEvePath NAMES TEveEventManager.h PATHS ${SIMPATH}/tools/root/include ${SIMPATH}/include/root NO_DEFAULT_PATH ) If(TEvePath) #find_package(OpenGL) #If (OPENGL_FOUND AND OPENGL_GLU_FOUND) Message("Found TEve, so the eventdisplay will be compiled.") IF(NOT FAIRROOT_FOUND) add_subdirectory (eventdisplay) ENDIF(NOT FAIRROOT_FOUND) add_subdirectory(PndEventdisplay) #EndIf (OPENGL_FOUND AND OPENGL_GLU_FOUND) EndIf(TEvePath) add_subdirectory (dsk) add_subdirectory (disc) add_subdirectory (PndTrackers/riemannfit) add_subdirectory (PndTools/MVA) add_subdirectory (PndPropagators/HelixPropagator) add_subdirectory (lmd) add_subdirectory (pid) add_subdirectory (PndMCMatchNewLinks) add_subdirectory (global) add_subdirectory (softrig) #add_subdirectory (kfparticle) if(RULE_CHECKER_FOUND) ADD_CUSTOM_TARGET(RULES COMMAND ${RULE_CHECKER_SCRIPT1} ${CMAKE_BINARY_DIR} viol > violations.html DEPENDS $ENV{ALL_RULES}) endif(RULE_CHECKER_FOUND) WRITE_CONFIG_FILE(config.sh) configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake )