IAP GITLAB

CMakeLists.txt 5.04 KB
Newer Older
1 2 3
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT (crmc)

4 5
######################################ONLY EDIT THIS######################################
SET (CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR})
6

7
# Enable/Disable models to be built
8 9 10 11 12 13
OPTION (__QGSJET01__ "Build with model" ON)
OPTION (__GHEISHA__  "Build with model" OFF)
OPTION (__PYTHIA__   "Build with model" OFF)
OPTION (__HIJING__   "Build with model" OFF)
OPTION (__SIBYLL__   "Build with model" ON)
OPTION (__QGSJETII__ "Build with model" ON)
14 15
# TODO want to disable epos, too
# TODO better support for model versions
16 17 18 19
######################################ONLY EDIT THIS######################################

# The version number
SET (CRMC_VERSION_MAJOR 0)
20
SET (CRMC_VERSION_MINOR 2)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

# hotfix for lxbatch not sure why he selects wrong compiler
#SET (CMAKE_Fortran_COMPILER gfortran)

# comprehensible compiler languages (default c cxx)
ENABLE_LANGUAGE (Fortran)

## RPATH (where to find library)
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH  FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")
46 47 48

## find packages
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules" CACHE PATH "Module Path" FORCE)
49
# TODO ROOT NOT REQUIRED
50
FIND_PACKAGE (Root REQUIRED)
51
FIND_PACKAGE (Boost 1.35 REQUIRED COMPONENTS filesystem iostreams system program_options)
52
# TODO HepMC NOT REQUIRED
53 54 55 56
FIND_PACKAGE (HepMC REQUIRED COMPONENTS HepMC HepMCfio)

## configure a header file to pass some of the CMake settings to the source code
CONFIGURE_FILE (
Ralf Ulrich's avatar
Ralf Ulrich committed
57 58
  "${PROJECT_SOURCE_DIR}/src/CRMCconfig.h.in"
  "${PROJECT_BINARY_DIR}/src/CRMCconfig.h"
59 60 61 62 63 64
  )

#add epos (must!)
INCLUDE_DIRECTORIES ("${PROJECT_SOURCE_DIR}/src")
ADD_SUBDIRECTORY (src/epos)
SET (EXTRA_MODELS ${EXTRA_MODELS} Epos)
65
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D __EPOS__")
66 67 68 69

IF (__QGSJET01__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/qgsjet")
SET (EXTRA_MODELS ${EXTRA_MODELS} Qgsjet01)
70
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D __QGSJET01__")
71 72 73 74 75 76

ENDIF (__QGSJET01__)

IF (__GHEISHA__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/gheisha")
SET (EXTRA_MODELS ${EXTRA_MODELS} Gheisha)
77
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D __GHEISHA__")
78 79 80 81 82
ENDIF (__GHEISHA__)

IF (__PYTHIA__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/pythia")
SET (EXTRA_MODELS ${EXTRA_MODELS} Pythia)
83
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D __PYTHIA__")
84 85 86 87 88
ENDIF (__PYTHIA__)

IF (__HIJING__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/hijing")
SET (EXTRA_MODELS ${EXTRA_MODELS} Hijing)
89
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D __HIJING__")
90 91 92 93 94
ENDIF (__HIJING__)

IF (__SIBYLL__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/sibyll")
SET (EXTRA_MODELS ${EXTRA_MODELS} Sibyll)
95
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D __SIBYLL__")
96 97 98 99 100
ENDIF (__SIBYLL__)

IF (__QGSJETII__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/qgsjetII")
SET (EXTRA_MODELS ${EXTRA_MODELS} QgsjetII)
101
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D __QGSJETII__")
102 103
ENDIF (__QGSJETII__)

104

105 106 107 108 109
# add the executable
INCLUDE_DIRECTORIES ("${PROJECT_BINARY_DIR}/src") #cmake config file
INCLUDE_DIRECTORIES ("${HepMC_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES ("${Boost_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES ("${ROOT_INCLUDE_DIR}")
Ralf Ulrich's avatar
Ralf Ulrich committed
110
ADD_EXECUTABLE(crmc src/crmc.cc src/CRMC.cc src/CRMCinterface.cc src/CRMCoptions.cc src/OutputPolicyROOT.cc src/OutputPolicyHepMC.cc src/CRMCtrapfpe.c src/crmc-aaa.f src/models.F)
111

112
# linking of modules
113 114 115 116
TARGET_LINK_LIBRARIES (crmc ${HepMC_LIBRARIES})
TARGET_LINK_LIBRARIES (crmc ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES (crmc ${ROOT_LIBRARIES})
TARGET_LINK_LIBRARIES (crmc ${EXTRA_MODELS})
117 118 119 120 121 122 123 124 125 126 127 128

## installation
# configure the parameter file
install(CODE "SET (CRMCROOT \"${PROJECT_BINARY_DIR}\")")
install(CODE "CONFIGURE_FILE (\"${PROJECT_SOURCE_DIR}/src/crmc.param.in\" \"${PROJECT_BINARY_DIR}/crmc.param\" @ONLY IMMEDIATE)")

# install tabs
if(CMAKE_HOST_UNIX)
    install(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${PROJECT_SOURCE_DIR}/tabs ${PROJECT_BINARY_DIR}/tabs)")
endif(CMAKE_HOST_UNIX)

# install executable
Ralf Ulrich's avatar
Ralf Ulrich committed
129
INSTALL (PROGRAMS ${PROJECT_BINARY_DIR}/crmc DESTINATION bin)
130 131 132

# enable dashboard scripting
include (CTest)
133 134 135 136
ADD_TEST (crmcRuns bin/crmc -o hepmc -p3500 -P-3500 -i1 -I1 -s 123 -x ctest)
ADD_TEST (crmcCheckFile md5sum "ctest_eposlhc_123_pp_3500.hepmc")
SET_TESTS_PROPERTIES (crmcCheckFile PROPERTIES PASS_REGULAR_EXPRESSION ".*777cb7e60b7c8104393a4fb22b137538  ctest_eposlhc_123_pp_3500.hepmc")
ADD_TEST (crmcRemoveFile rm "ctest_eposlhc_123_pp_3500.hepmc")
137