IAP GITLAB

Commit b539ea66 authored by Tanguy Pierog's avatar Tanguy Pierog

update README


git-svn-id: https://devel-ik.fzk.de/svn/mc/crmc/tags/crmc.v1.5.4@4858 c7a5e08c-de06-0410-9364-b41cf42a0b17
parent 78e11388
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT (crmc)
######################################ONLY EDIT THIS######################################
# Enable/Disable models to be built
OPTION (__CRMCSTATIC__ "Build with static library" OFF) #if ON should not combined DPMJET/PHOJET/PYTHIA because they use different version of pythia (for dynamic library no problem)
OPTION (__QGSJET01__ "Build with model" OFF)
OPTION (__GHEISHA__ "Build with model" OFF)
OPTION (__PYTHIA__ "Build with model" OFF)
OPTION (__HIJING__ "Build with model" OFF)
OPTION (__SIBYLL__ "Build with model" OFF)
OPTION (__PHOJET__ "Build with model" OFF)
OPTION (__DPMJET__ "Build with model" OFF)
OPTION (__QGSJETII03__ "Build with model" OFF)
OPTION (__QGSJETII04__ "Build with model" OFF)
######################################ONLY EDIT THIS######################################
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX $ENV{PWD} CACHE PATH "default install path" FORCE )
endif()
SET(PROJECT_BINARY_DIR ${CMAKE_INSTALL_PREFIX})
MESSAGE(STATUS "source ${PROJECT_SOURCE_DIR}")
MESSAGE(STATUS "binary ${PROJECT_BINARY_DIR}")
MESSAGE(STATUS "build ${CMAKE_BINARY_DIR}")
## The version number. Only nummeric PLEASE!
SET (CRMC_VERSION_MAJOR 1)
SET (CRMC_VERSION_MINOR 5)
SET (CRMC_VERSION_PATCH 3)
##Compiler options
# hotfix for lxbatch not sure why he selects wrong compiler
#SET (CMAKE_Fortran_COMPILER gfortran)
#SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lgfortran")
# comprehensible compiler languages (default c cxx)
ENABLE_LANGUAGE (Fortran)
#add some warning to the compiler flags
FOREACH(lang C CXX Fortran)
IF(CMAKE_${lang}_COMPILER_ID STREQUAL GNU)
SET (CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wunused")
SET (CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -O -Wuninitialized")
#SET (CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wall")
ENDIF()
ENDFOREACH()
## 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 TRUE)
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")
## find packages
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules" CACHE PATH "Module Path" FORCE)
SET (CRMC_SOURCES src/crmcMain.cc src/CRMC.cc src/CRMCinterface.cc src/CRMCoptions.cc src/OutputPolicyLHE.cc src/OutputPolicyNone.cc src/CRMCtrapfpe.c)
FIND_PACKAGE (Root)
if (Root_FOUND)
INCLUDE_DIRECTORIES ("${ROOT_INCLUDE_DIR}")
LIST(APPEND CRMC_SOURCES src/OutputPolicyROOT.cc)
add_definitions(-DWITH_ROOT)
MESSAGE("Build ROOT Output Interface")
else (Root_FOUND)
MESSAGE("Cannot Build ROOT Output Interface")
endif (Root_FOUND)
# SET(Boost_DEBUG TRUE)
FIND_PACKAGE (Boost 1.35 REQUIRED COMPONENTS filesystem iostreams system program_options)
FIND_PACKAGE (HepMC REQUIRED COMPONENTS HepMC HepMCfio)
INCLUDE_DIRECTORIES ("${HepMC_INCLUDE_DIRS}")
LIST(APPEND CRMC_SOURCES src/OutputPolicyHepMC.cc)
add_definitions(-DWITH_HEPMC)
MESSAGE("Build HEPMC Output Interface")
FIND_PACKAGE (Fastjet)
if (FASTJET_FOUND)
include_directories("${Fastjet_INCLUDE_DIRS}")
add_definitions(-DWITH_FASTJET)
MESSAGE("Include fastjet filter")
endif (FASTJET_FOUND)
# prepare crmc to use same size HEPMC common block than HepMC was compiled with
STRING ( STRIP ${HepMC_HEPEVT_SIZE} Replace_String )
FILE(READ ${PROJECT_SOURCE_DIR}/src/epos.inc-HEPMC-TEMPLATE template)
STRING( REGEX REPLACE "HEPEVT_SIZE_REPLACE" "${Replace_String}" template2 "${template}")
FILE(WRITE ${PROJECT_SOURCE_DIR}/src/epos.inc "${template2}")
FILE(READ ${PROJECT_SOURCE_DIR}/src/CRMCinterface.h-HEPMC-TEMPLATE template3)
STRING( REGEX REPLACE "HEPEVT_SIZE_REPLACE" "${Replace_String}" template4 "${template3}")
FILE(WRITE ${PROJECT_SOURCE_DIR}/src/CRMCinterface.h "${template4}")
FILE(READ ${PROJECT_SOURCE_DIR}/src/pythia/pythia6115.f-HEPMC-TEMPLATE template5)
STRING( REGEX REPLACE "HEPEVT_SIZE_REPLACE" "${Replace_String}" template6 "${template5}")
FILE(WRITE ${PROJECT_SOURCE_DIR}/src/pythia/pythia6115.f "${template6}")
FILE(READ ${PROJECT_SOURCE_DIR}/src/pythia/pythia6215.f-HEPMC-TEMPLATE template7)
STRING( REGEX REPLACE "HEPEVT_SIZE_REPLACE" "${Replace_String}" template8 "${template7}")
FILE(WRITE ${PROJECT_SOURCE_DIR}/src/pythia/pythia6215.f "${template8}")
FILE(READ ${PROJECT_SOURCE_DIR}/src/pythia/pythia-6.4.28.f-HEPMC-TEMPLATE template9)
STRING( REGEX REPLACE "HEPEVT_SIZE_REPLACE" "${Replace_String}" template10 "${template9}")
FILE(WRITE ${PROJECT_SOURCE_DIR}/src/pythia/pythia-6.4.28.f "${template10}")
FILE(READ ${PROJECT_SOURCE_DIR}/src/hijing/hipyset1.35.f-HEPMC-TEMPLATE template11)
STRING( REGEX REPLACE "HEPEVT_SIZE_REPLACE" "${Replace_String}" template12 "${template11}")
FILE(WRITE ${PROJECT_SOURCE_DIR}/src/hijing/hipyset1.35.f "${template12}")
FILE(READ ${PROJECT_SOURCE_DIR}/src/dpmjet/3.0-6/pythia6115dpm3v1.f-HEPMCTEMPLATE template13)
STRING( REGEX REPLACE "HEPEVT_SIZE_REPLACE" "${Replace_String}" template14 "${template13}")
FILE(WRITE ${PROJECT_SOURCE_DIR}/src/dpmjet/3.0-6/pythia6115dpm3v1.f "${template14}")
## configure a header file to pass some of the CMake settings to the source code
CONFIGURE_FILE (
"${PROJECT_SOURCE_DIR}/src/CRMCconfig.h.in"
"${PROJECT_BINARY_DIR}/src/CRMCconfig.h"
)
INCLUDE_DIRECTORIES ("${PROJECT_SOURCE_DIR}/src")
#add epos (must!)
ADD_SUBDIRECTORY (src/epos)
SET (TABS "")
# data tables for epos
LIST(APPEND TABS epos.inics)
LIST(APPEND TABS epos.inics.lhc)
LIST(APPEND TABS epos.inidi)
LIST(APPEND TABS epos.iniev)
LIST(APPEND TABS epos.inirj)
LIST(APPEND TABS epos.inirj.lhc)
LIST(APPEND TABS epos.initl)
IF (__QGSJET01__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/qgsjet")
LIST(APPEND TABS qgsjet.dat)
LIST(APPEND TABS qgsjet.ncs)
SET(STATIC_LIBS ${STATIC_LIBS} Qgsjet01)
get_property(HELPER SOURCE src/models.F PROPERTY COMPILE_FLAGS)
set_property(SOURCE src/models.F PROPERTY COMPILE_FLAGS "${HELPER} -D __QGSJET01__") #set properties APPEND has a bug
ENDIF (__QGSJET01__)
IF (__GHEISHA__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/gheisha")
SET(STATIC_LIBS ${STATIC_LIBS} Gheisha)
get_property(HELPER SOURCE src/models.F PROPERTY COMPILE_FLAGS)
set_property(SOURCE src/models.F PROPERTY COMPILE_FLAGS "${HELPER} -D __GHEISHA__")
ENDIF (__GHEISHA__)
IF (__PYTHIA__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/pythia")
SET(STATIC_LIBS ${STATIC_LIBS} Pythia)
get_property(HELPER SOURCE src/models.F PROPERTY COMPILE_FLAGS)
set_property(SOURCE src/models.F PROPERTY COMPILE_FLAGS "${HELPER} -D __PYTHIA__")
ENDIF (__PYTHIA__)
IF (__HIJING__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/hijing")
SET(STATIC_LIBS ${STATIC_LIBS} Hijing)
get_property(HELPER SOURCE src/models.F PROPERTY COMPILE_FLAGS)
set_property(SOURCE src/models.F PROPERTY COMPILE_FLAGS "${HELPER} -D __HIJING__")
ENDIF (__HIJING__)
IF (__SIBYLL__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/sibyll")
SET(STATIC_LIBS ${STATIC_LIBS} Sibyll)
get_property(HELPER SOURCE src/models.F PROPERTY COMPILE_FLAGS)
set_property(SOURCE src/models.F PROPERTY COMPILE_FLAGS "${HELPER} -D __SIBYLL__")
ENDIF (__SIBYLL__)
IF (__PHOJET__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/phojet")
SET(STATIC_LIBS ${STATIC_LIBS} Phojet)
get_property(HELPER SOURCE src/models.F PROPERTY COMPILE_FLAGS)
set_property(SOURCE src/models.F PROPERTY COMPILE_FLAGS "${HELPER} -D __PHOJET__")
ENDIF (__PHOJET__)
IF (__DPMJET__)
LIST(APPEND TABS dpmjet.dat)
LIST(APPEND TABS phojet_fitpar.dat)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/dpmjet/3.0-6")
SET(STATIC_LIBS ${STATIC_LIBS} Dpmjet)
get_property(HELPER SOURCE src/models.F PROPERTY COMPILE_FLAGS)
set_property(SOURCE src/models.F PROPERTY COMPILE_FLAGS "${HELPER} -D __DPMJET__")
ENDIF (__DPMJET__)
#put definition outside "if" because it is always is crmc.param file
SET (QGSJETII_TABS "03")
IF (__QGSJETII03__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/qgsjetII")
SET(STATIC_LIBS ${STATIC_LIBS} QgsjetII03)
get_property(HELPER SOURCE src/models.F PROPERTY COMPILE_FLAGS)
set_property(SOURCE src/models.F PROPERTY COMPILE_FLAGS "${HELPER} -D __QGSJETII03__")
LIST(APPEND TABS qgsdat-II-03.lzma)
LIST(APPEND TABS sectnu-II-03)
ENDIF (__QGSJETII03__)
IF (__QGSJETII04__)
ADD_SUBDIRECTORY ("${PROJECT_SOURCE_DIR}/src/qgsjetII-04")
SET(STATIC_LIBS ${STATIC_LIBS} QgsjetII04)
get_property(HELPER SOURCE src/models.F PROPERTY COMPILE_FLAGS)
set_property(SOURCE src/models.F PROPERTY COMPILE_FLAGS "${HELPER} -D __QGSJETII04__")
SET (QGSJETII_TABS "04")
LIST(APPEND TABS qgsdat-II-04.lzma)
LIST(APPEND TABS sectnu-II-04)
ENDIF (__QGSJETII04__)
IF (__CRMCSTATIC__)
#has to be after all other models since variables must be set for fortran precompiler
add_library(CrmcFortranStatic STATIC src/crmc-aaa.f src/models.F)
INSTALL (TARGETS CrmcFortranStatic
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
)
TARGET_LINK_LIBRARIES (CrmcFortranStatic ${STATIC_LIBS})
ELSE (__CRMCSTATIC__)
#Dummy library which includes epos.inc file so HEPMC will find the symbol for hepevt_
#with fPIC linker option it should always point to right symbol also for other libs
add_library(HepEvtDummy SHARED src/dummy.f)
INSTALL (TARGETS HepEvtDummy
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
)
ENDIF (__CRMCSTATIC__)
#include directories for headers
INCLUDE_DIRECTORIES ("${PROJECT_BINARY_DIR}/src")
INCLUDE_DIRECTORIES ("${Boost_INCLUDE_DIRS}")
# the executable
ADD_EXECUTABLE(crmc ${CRMC_SOURCES})
# linking of modules
TARGET_LINK_LIBRARIES (crmc ${CMAKE_DL_LIBS})
TARGET_LINK_LIBRARIES (crmc ${HepMC_LIBRARIES})
TARGET_LINK_LIBRARIES (crmc ${Boost_LIBRARIES})
if (Root_FOUND)
TARGET_LINK_LIBRARIES (crmc ${ROOT_LIBRARIES})
endif (Root_FOUND)
IF (__CRMCSTATIC__)
TARGET_LINK_LIBRARIES (crmc CrmcBasic)
TARGET_LINK_LIBRARIES (crmc CrmcFortranStatic)
ELSE (__CRMCSTATIC__)
TARGET_LINK_LIBRARIES (crmc HepEvtDummy)
ENDIF (__CRMCSTATIC__)
## installation
# configure the parameter file
install(CODE "SET (CRMCROOT \"${PROJECT_BINARY_DIR}\")")
install(CODE "SET (QIITAB \"${QGSJETII_TABS}\")")
install(CODE "
IF(NOT EXISTS ${PROJECT_BINARY_DIR}/crmc.param)
MESSAGE (STATUS \"(Re)creating crmc.param\")
CONFIGURE_FILE (\"${PROJECT_SOURCE_DIR}/src/crmc.param.in\" \"${PROJECT_BINARY_DIR}/crmc.param\" @ONLY IMMEDIATE)
ENDIF(NOT EXISTS ${PROJECT_BINARY_DIR}/crmc.param)
")
# install tabs
SET (TABSDIR "")
foreach(theTab ${TABS})
list(APPEND TABSDIR ${PROJECT_SOURCE_DIR}/tabs/${theTab} )
endforeach()
INSTALL (FILES ${TABSDIR} DESTINATION ${PROJECT_BINARY_DIR}/tabs)
# install(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/tabs ${PROJECT_BINARY_DIR}/tabs)")
# install executable
INSTALL (PROGRAMS ${CMAKE_BINARY_DIR}/crmc DESTINATION bin)
# enable dashboard scripting
include (CTest)
ADD_TEST (crmcRuns bin/crmc -o hepmc -f ctest.hepmc -T 1)
#ADD_TEST (crmcCheckFile md5sum "ctest.hepmc")
#SET_TESTS_PROPERTIES (crmcCheckFile PROPERTIES PASS_REGULAR_EXPRESSION ".*777cb7e60b7c8104393a4fb22b137538 ctest.hepmc")
ADD_TEST (crmcRemoveFile rm "ctest.hepmc")
##################################################################
# This module tries to find the HepMC installation on your system.
# Usage:
# FIND_PACKAGE( HepMC [REQUIRED] [COMPONENTS HepMCfio ...] )
#
# It sets the following variables:
# ${HEPMC_FOUND}
# ${HepMC_INCLUDE_DIRS}
# ${HepMC_LIBRARY_DIRS}
# ${HepMC_LIBRARIES}
#
# ${HepMC_HEPEVT_SIZE}
#
##################################################################
MESSAGE(STATUS "Looking for HepMC...")
# default hepmc common block size:
Set( HepMC_HEPEVT_SIZE 99990 )
## try to find each HepMC components in user defined path
FOREACH (COMPONENT ${HepMC_FIND_COMPONENTS})
FIND_LIBRARY(${COMPONENT}_PATH
NAMES
${COMPONENT}
PATHS
/usr
/usr/local
${HEPMC_PREFIX}
${HEPMC_ROOT}
${HEPMC_ROOT_DIR}
${HEP_ROOT}
$ENV{HEPMC_PREFIX}
$ENV{HEPMC_ROOT}
$ENV{HEPMC_ROOT_DIR}
$ENV{HEP_ROOT}
PATH_SUFFIXES
lib
lib64
)
# set found flag
IF ({${${COMPONENT}_PATH} MATCHES "${COMPONENT}_PATH-NOTFOUND")
SET(HEPMC_FOUND FALSE)
ELSE ({${${COMPONENT}_PATH} MATCHES "${COMPONENT}_PATH-NOTFOUND")
MESSAGE (STATUS "HepMC ${COMPONENT} library path found: ${${COMPONENT}_PATH}")
ENDIF ({${${COMPONENT}_PATH} MATCHES "${COMPONENT}_PATH-NOTFOUND")
ENDFOREACH (COMPONENT HepMC_FIND_COMPONENTS)
## search for include path
FIND_PATH(HepMC_INCLUDE_DIRS
NAMES
HepMC/GenEvent.h
PATHS
/usr
/usr/local
${HEPMC_PREFIX}
${HEPMC_ROOT}
${HEPMC_ROOT_DIR}
${HEP_ROOT}
$ENV{HEPMC_PREFIX}
$ENV{HEPMC_ROOT}
$ENV{HEPMC_ROOT_DIR}
$ENV{HEP_ROOT}
PATH_SUFFIXES
include
)
# set found flag
IF (${HepMC_INCLUDE_DIRS} MATCHES "HepMC_INCLUDE_DIRS-NOTFOUND")
SET(HEPMC_FOUND FALSE)
ELSE (${HepMC_INCLUDE_DIRS} MATCHES "HepMC_INCLUDE_DIRS-NOTFOUND")
MESSAGE(STATUS "HepMC include path found: " ${HepMC_INCLUDE_DIRS} )
ENDIF (${HepMC_INCLUDE_DIRS} MATCHES "HepMC_INCLUDE_DIRS-NOTFOUND")
## final printout
# if not found
IF(${HEPMC_FOUND} MATCHES "FALSE")
IF (HepMC_FIND_REQUIRED)
MESSAGE( FATAL_ERROR
"HepMC shared library or includes not found\n"
"Please install HepMC and/or set HEPMC_PREFIX environment\n"
)
ELSE (HepMC_FIND_REQUIRED)
MESSAGE( WARNING
"HepMC shared library or includes not found\n"
"Please install HepMC and/or set HEPMC_PREFIX environment\n"
)
ENDIF (HepMC_FIND_REQUIRED)
# end if not found
# if found :
ELSE(${HEPMC_FOUND} MATCHES "FALSE")
SET(HEPMC_FOUND TRUE)
# find length of hepmc common block pre-defined and use this for epos
EXECUTE_PROCESS (COMMAND cat ${HepMC_INCLUDE_DIRS}/HepMC/HEPEVT_Wrapper.h
COMMAND grep "#define HEPEVT_EntriesAllocation"
COMMAND awk "{print $3}"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE HepMC_HEPEVT_SIZE
)
MESSAGE( INFO "-HepMC: HEPEVT_EntriesAllocation in file \"${HepMC_INCLUDE_DIRS}/HepMC/HEPEVT_Wrapper.h\" is \"${HepMC_HEPEVT_SIZE}\"" )
MESSAGE( INFO "-HepMC: This limits the maximum number of particles per event you can have. " )
MESSAGE( INFO "-HepMC: Change you HepMC library if you run into limitation! " )
#set HepMC_LIBRARY_DIRS (extract from first component)
list(GET HepMC_FIND_COMPONENTS 0 TMP)
#extract the path from variable component_path and put in hepmc_library_dirs
GET_FILENAME_COMPONENT(HepMC_LIBRARY_DIRS ${TMP}_PATH PATH)
#set HepMC_LIBRARIES
FOREACH(COMPONENT ${HepMC_FIND_COMPONENTS})
list(APPEND HepMC_LIBRARIES ${${COMPONENT}_PATH})
ENDFOREACH(COMPONENT ${HepMC_FIND_COMPONENTS})
ENDIF(${HEPMC_FOUND} MATCHES "FALSE")
#This code is adapted from FindRoot used in Offline (http://arxiv.org/abs/0707.1652)
################################################################################
# Module to find Root #
# #
# This sets the following variables: #
# - Root_FOUND #
# - ROOT_LIBRARIES #
# - ROOT_GUI_LIBRARIES #
# - ROOT_INCLUDE_DIR #
# - ROOT_BIN_DIR #
# - ROOTSYS #
# - ROOTCINT #
# - ROOT_CPPFLAGS #
# - ROOT_LDFLAGS #
# - ROOT_VERSION #
# #
# And these might be needed as well... we'll see: #
# - ROOT_LIBS #
# - ROOT_GLIBS #
# - ROOT_LIBDIR #
################################################################################
# If root was found already, don't find it again.
# This works because Root_FOUND is not cached
IF (NOT Root_FOUND)
# Minimum ROOT requirements.
SET (ROOT_MIN_REQUIRED_VERSION "5.16.00")
# the following disables all default paths (either from cmake, from environment)
FIND_PATH (ROOT_BIN_DIR root-config
PATHS
${ROOTSYS}/bin
$ENV{ROOTSYS}/bin
$ENV{AUGER_BASE}/External/ROOT/pro/bin
NO_DEFAULT_PATH
)
# now defaults are allowed but if nothing is found it is not overwritten
# (because it is cached)
FIND_PATH (ROOT_BIN_DIR root-config)
GET_FILENAME_COMPONENT (ROOTSYS ${ROOT_BIN_DIR} PATH)
IF (NOT ENV{ROOTSYS})
SET (ENV{ROOTSYS} ${ROOTSYS})
ENDIF (NOT ENV{ROOTSYS})
IF (ROOTSYS)
# ----------------------------------------------------------------------------
# Get ROOT version, re-express in form XX.YY.ZZ, compare to requirements.
# ----------------------------------------------------------------------------
EXECUTE_PROCESS (COMMAND ${ROOT_BIN_DIR}/root-config --version
OUTPUT_VARIABLE ROOT_VERSION
)
STRING (REGEX REPLACE "[ \t\r\n]+" "" ROOT_VERSION "${ROOT_VERSION}")
STRING (REGEX REPLACE "/" "." ROOT_VERSION "${ROOT_VERSION}")
# Note: letters sometimes appended to ROOT patches (e.g., 5.14/00e) will be
# ignored in the version comparison.
IF ("${ROOT_VERSION}" VERSION_GREATER ${ROOT_MIN_REQUIRED_VERSION})
SET(_have_MIN_ROOT_VER 1)
ENDIF ("${ROOT_VERSION}" VERSION_GREATER ${ROOT_MIN_REQUIRED_VERSION})
IF (${_have_MIN_ROOT_VER} GREATER 0 OR ${_have_MIN_ROOT_VER} EQUAL 0)
# --------------------------------------------------------------------------
# Set ROOT compilation flags.
# --------------------------------------------------------------------------
SET (Root_FOUND TRUE)
SET (HAVE_ROOT 1)
EXECUTE_PROCESS (COMMAND ${ROOT_BIN_DIR}/root-config --noldflags --libs
OUTPUT_VARIABLE ROOT_LIBS
)
STRING (REGEX REPLACE "[ \t\r\n]+" " " ROOT_LIBS "${ROOT_LIBS}")
# Check if ROOT has Minuit2
EXECUTE_PROCESS (COMMAND ${ROOT_BIN_DIR}/root-config --has-minuit2
OUTPUT_VARIABLE HAVE_MINUIT2)
IF (${HAVE_MINUIT2} STREQUAL "yes\n")
SET (ROOT_LIBS "${ROOT_LIBS} -lMinuit2")
SET (ROOT_MINUIT2_FOUND TRUE)
ENDIF (${HAVE_MINUIT2} STREQUAL "yes\n")
EXECUTE_PROCESS (COMMAND ${ROOT_BIN_DIR}/root-config --libs
OUTPUT_VARIABLE ROOT_LDFLAGS
)
STRING (REGEX REPLACE "[ \t\r\n]+" " " ROOT_LDFLAGS "${ROOT_LDFLAGS}")
EXECUTE_PROCESS (COMMAND ${ROOT_BIN_DIR}/root-config --glibs
OUTPUT_VARIABLE ROOT_GLIBS
)
STRING (REGEX REPLACE "[ \t\r\n]+" "" ROOT_GLIBS "${ROOT_GLIBS}")
EXECUTE_PROCESS (COMMAND ${ROOT_BIN_DIR}/root-config --libdir
OUTPUT_VARIABLE _ROOT_LIBDIR
)
STRING (REGEX REPLACE "[ \t\r\n]+" "" ROOT_LIBDIR "${_ROOT_LIBDIR}")
EXECUTE_PROCESS (COMMAND ${ROOT_BIN_DIR}/root-config --incdir
OUTPUT_VARIABLE ROOT_INCLUDE_DIR
)
STRING (REGEX REPLACE "[ \t\r\n]+" "" ROOT_INCLUDE_DIR "${ROOT_INCLUDE_DIR}")
EXECUTE_PROCESS (COMMAND ${ROOT_BIN_DIR}/root-config --cflags
OUTPUT_VARIABLE ROOT_CPPFLAGS
)
STRING (REGEX REPLACE "[ \t\r\n]+" " " ROOT_CPPFLAGS "${ROOT_CPPFLAGS}")
SET (ROOTCINT ${ROOT_BIN_DIR}/rootcint)
# --------------------------------------------------------------------------
# Find ROOT libraries.
# --------------------------------------------------------------------------
STRING (REGEX REPLACE "-l" " " CRAP "${ROOT_LIBS}")
STRING (REGEX REPLACE "-" " " CRAP "${CRAP}")
SEPARATE_ARGUMENTS (CRAP)
FOREACH (_file ${CRAP})
FIND_LIBRARY (_LIBY${_file} ${_file} ${ROOT_LIBDIR} NO_DEFAULT_PATH)
IF (_LIBY${_file})
LIST (APPEND ROOT_LIBRARIES ${_LIBY${_file}})
ENDIF (_LIBY${_file})
SET (_LIBY${_file} ${_LIBY${_file}} CACHE INTERNAL "" FORCE)
ENDFOREACH (_file)
STRING (REGEX REPLACE "-l" " " CRAP "${ROOT_GLIBS}")
STRING (REGEX REPLACE "-" " " CRAP "${CRAP}")
SEPARATE_ARGUMENTS (CRAP)
FOREACH (_file ${CRAP})
FIND_LIBRARY (_LIBY${_file} ${_file} ${ROOT_LIBDIR} NO_DEFAULT_PATH)
IF (_LIBY${_file})
LIST (APPEND ROOT_GUI_LIBRARIES ${_LIBY${_file}})
ENDIF (_LIBY${_file})
SET (_LIBY${_file} ${_LIBY${_file}} CACHE INTERNAL "" FORCE)
ENDFOREACH (_file)
FIND_LIBRARY (_ROOT_GQT_LIBRARY GQt ${ROOT_LIBDIR} NO_DEFAULT_PATH)
FIND_LIBRARY (_ROOT_QTROOT_LIBRARY QtRoot ${ROOT_LIBDIR} NO_DEFAULT_PATH)
IF (_ROOT_GQT_LIBRARY AND _ROOT_QTROOT_LIBRARY)
SET (ROOT_QTROOT_LIBRARIES ${_ROOT_GQT_LIBRARY} ${_ROOT_QTROOT_LIBRARY} ${ROOT_GUI_LIBRARIES})
ENDIF (_ROOT_GQT_LIBRARY AND _ROOT_QTROOT_LIBRARY)
ELSE (${_have_MIN_ROOT_VER} GREATER 0 OR ${_have_MIN_ROOT_VER} EQUAL 0)
SET (Root_FOUND FALSE)
SET (HAVE_ROOT 0)
IF (NOT Root_FIND_QUIETLY)
MESSAGE (STATUS
"Compatible version of ROOT not found. "
"Minimum required version: ${ROOT_MIN_REQUIRED_VERSION}")
ENDIF (NOT Root_FIND_QUIETLY)
ENDIF (${_have_MIN_ROOT_VER} GREATER 0 OR ${_have_MIN_ROOT_VER} EQUAL 0)
ENDIF (ROOTSYS)
SET (_DIRECTORIES)