diff --git a/CMakeLists.txt b/CMakeLists.txt index e2c33b7..fa53212 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,121 +1,121 @@ # Top level CMakeLists.txt for EvtGen # Enforce an out-of-source build. # Should be the first action in the top level CMakeLists.txt if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(STATUS "EvtGen requires an out-of-source build.") message(STATUS "Please remove the following files from ${CMAKE_BINARY_DIR}:") message(STATUS " CMakeCache.txt") message(STATUS " CMakeFiles") message(STATUS "Once these files are removed, create a separate directory") message(STATUS "and run CMake from there, pointing it to:") message(STATUS " ${CMAKE_SOURCE_DIR}") message(FATAL_ERROR "in-source build detected") endif() # Also require a minimum version of CMake cmake_minimum_required(VERSION 3.11.0) # Project setup if(${CMAKE_VERSION} VERSION_LESS 3.12.0) project(EvtGen VERSION 2.0.0 DESCRIPTION "Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons." ) else() project(EvtGen VERSION 2.0.0 DESCRIPTION "Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons." HOMEPAGE_URL "https://evtgen.hepforge.org" ) endif() # Prepend this project's custom module path(s) to CMAKE_MODULE_PATH set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules ${CMAKE_MODULE_PATH}) # Include needed modules to perform any custom setup # Install paths include(GNUInstallDirs) # Compilation/linking flags and related settings include(CompilerFlags) # EvtGen external dependencies option(EVTGEN_PYTHIA "Enable/disable linking with Pythia8" OFF) option(EVTGEN_PHOTOS "Enable/disable linking with Photos++" OFF) option(EVTGEN_TAUOLA "Enable/disable linking with Tauola++" OFF) option(EVTGEN_HEPMC3 "Enable/disable linking with HepMC3" ON) if (EVTGEN_HEPMC3) message(STATUS "EvtGen: Linking with HepMC3") else() message(STATUS "EvtGen: Linking with HepMC2") endif() message(STATUS "EvtGen: Optional linking with Pythia8 EVTGEN_PYTHIA ${EVTGEN_PYTHIA}") message(STATUS "EvtGen: Optional linking with Photos++ EVTGEN_PHOTOS ${EVTGEN_PHOTOS}") message(STATUS "EvtGen: Optional linking with Tauola++ EVTGEN_TAUOLA ${EVTGEN_TAUOLA}") message(STATUS "EvtGen: Optional linking with HepMC3 EVTGEN_HEPMC3 ${EVTGEN_HEPMC3}") include(ExternalDependencies) # Now build the library add_subdirectory(src) # Copy the particle property and decay tables configure_file(DECAY.DEC ${CMAKE_CURRENT_BINARY_DIR}/DECAY.DEC COPYONLY) configure_file(DECAY.XML ${CMAKE_CURRENT_BINARY_DIR}/DECAY.XML COPYONLY) configure_file(evt.pdl ${CMAKE_CURRENT_BINARY_DIR}/evt.pdl COPYONLY) # Copy the older particle property and decay tables configure_file(DECAY_2009.DEC ${CMAKE_CURRENT_BINARY_DIR}/DECAY_2009.DEC COPYONLY) configure_file(DECAY_2009.XML ${CMAKE_CURRENT_BINARY_DIR}/DECAY_2009.XML COPYONLY) configure_file(DECAY_2010.DEC ${CMAKE_CURRENT_BINARY_DIR}/DECAY_2010.DEC COPYONLY) configure_file(DECAY_2010.XML ${CMAKE_CURRENT_BINARY_DIR}/DECAY_2010.XML COPYONLY) # Build the executables in the test and validation directories option(EVTGEN_BUILD_DOC "Enable/disable building of documentation in 'doc' directory" OFF) option(EVTGEN_BUILD_TESTS "Enable/disable building of executables in 'test' directory" OFF) option(EVTGEN_BUILD_VALIDATIONS "Enable/disable building of executables in 'validation' directory" OFF) message(STATUS "EvtGen: Building of documentation in 'doc' directory EVTGEN_BUILD_DOC ${EVTGEN_BUILD_DOC}") message(STATUS "EvtGen: Building of executables in 'test' directory EVTGEN_BUILD_TESTS ${EVTGEN_BUILD_TESTS}") message(STATUS "EvtGen: Building of executables in 'validation' directory EVTGEN_BUILD_VALIDATIONS ${EVTGEN_BUILD_VALIDATIONS}") if(${EVTGEN_BUILD_DOC}) add_subdirectory(doc) endif() if(${EVTGEN_BUILD_TESTS}) add_subdirectory(test) endif() if(${EVTGEN_BUILD_VALIDATIONS}) add_subdirectory(validation) endif() # Install the include directories install(DIRECTORY EvtGen DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(DIRECTORY EvtGenBase DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(DIRECTORY EvtGenExternal DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(DIRECTORY EvtGenModels DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) # Install the particle properties and decay tables install(FILES DECAY.DEC DECAY.XML evt.pdl DECAY_2010.XML DECAY_2010.DEC DECAY_2009.XML DECAY_2009.DEC DESTINATION ${CMAKE_INSTALL_DATADIR}/EvtGen) # Generate CMake config files, which can be used by other projects include(CMakePackageConfigHelpers) set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}) set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) configure_package_config_file(cmake/Templates/EvtGenConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/EvtGenConfig.cmake - INSTALL_DESTINATION cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/EvtGen/cmake PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR ) write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/EvtGenConfigVersion.cmake COMPATIBILITY AnyNewerVersion ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/EvtGenConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/EvtGenConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/EvtGen/cmake ) install( EXPORT "EvtGenTargets" NAMESPACE "EvtGen::" DESTINATION ${CMAKE_INSTALL_DATADIR}/EvtGen/cmake ) diff --git a/setupEvtGen.sh b/setupEvtGen.sh index 1581855..e8618e4 100644 --- a/setupEvtGen.sh +++ b/setupEvtGen.sh @@ -1,172 +1,165 @@ #!/bin/bash # This script installs EvtGen with all external dependencies. The variable VERSION specifies the # tag of EvtGen you want to use. The list of available tags can be found by either going to the url # https://phab.hepforge.org/source/evtgen/tags/master # or issuing the command (without the need to clone the git repository) # git ls-remote --tags http://phab.hepforge.org/source/evtgen.git | cut -d '/' -f3 # Note that some earlier EvtGen versions will not be compatible with all external dependency # versions given below, owing to C++ interface differences; see the specific tagged version of # the EvtGen/README file for guidance. # To obtain this script use the "Download File" option on the right of the webpage: # https://phab.hepforge.org/source/evtgen/browse/master/setupEvtGen.sh?view=raw # Version or tag number. No extra spaces on this line! -VERSION=smallerissuesav2 +VERSION=smallerissuesav3 # Pythia version number with no decimal points, e.g. 8230 corresponds to version 8.230. This # follows the naming convention of Pythia install tar files. Again, no extra spaces allowed PYTHIAVER=8243 PYTHIAPKG="pythia"$PYTHIAVER PYTHIATAR=$PYTHIAPKG".tgz" echo Pythia version set to $PYTHIAVER, package tar name $PYTHIATAR HEPMCMAJORVERSION="3" #This is for systems with cmake and cmake3 if command -v cmake3; then CMAKE=cmake3 else CMAKE=cmake fi mkdir -p EvtGen cd EvtGen INSTALL_BASE=`pwd` echo Will setup EvtGen $VERSION in $INSTALL_BASE echo Downloading EvtGen from GIT git clone https://phab.hepforge.org/source/evtgen.git evtgen.git cd evtgen.git #git checkout -b $VERSION $VERSION git checkout $VERSION cd $INSTALL_BASE # Replace the above lines with the following one for the "head" version #git clone http://phab.hepforge.org/source/evtgen.git evtgen.git osArch=`uname` echo Downloading external dependencies mkdir -p external cd external # Recommended versions of the external packages. HepMC is mandatory. # Later versions should be OK as well, assuming their C++ interfaces do not change curl -O http://hepmc.web.cern.ch/hepmc/releases/hepmc2.06.10.tgz curl -O http://hepmc.web.cern.ch/hepmc/releases/HepMC3-3.2.0.tar.gz curl -O http://home.thep.lu.se/~torbjorn/pythia8/$PYTHIATAR curl -O http://photospp.web.cern.ch/photospp/resources/PHOTOS.3.64/PHOTOS.3.64.tar.gz curl -O http://tauolapp.web.cern.ch/tauolapp/resources/TAUOLA.1.1.8/TAUOLA.1.1.8.tar.gz echo Extracting external dependencies tar -xzf hepmc2.06.10.tgz tar -xzf HepMC3-3.2.0.tar.gz tar -xzf $PYTHIATAR tar -xzf PHOTOS.3.64.tar.gz tar -xzf TAUOLA.1.1.8.tar.gz # Patch TAUOLA and PHOTOS on Darwin (Mac) if [ "$osArch" == "Darwin" ] then patch -p0 < $INSTALL_BASE/evtgen.git/platform/tauola_Darwin.patch patch -p0 < $INSTALL_BASE/evtgen.git/platform/photos_Darwin.patch fi if [ "$HEPMCMAJORVERSION" -lt "3" ] then echo Installing HepMC in $INSTALL_BASE/external/HepMC mkdir -p HepMC mkdir -p HepMC.build cd HepMC.build $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_BASE/external/HepMC $INSTALL_BASE/external/HepMC-2.06.10 -Dmomentum:STRING=GEV -Dlength:STRING=MM make make install echo Installing pythia8 in $INSTALL_BASE/external/$PYTHIAPKG cd ../$PYTHIAPKG -if [ "$PYTHIAVER" -lt "8300" ] -then - ./configure --enable-shared --prefix=$INSTALL_BASE/external/$PYTHIAPKG -fi -if [ "$PYTHIAVER" -ge "8300" ] -then - ./configure --enable-shared --prefix=$INSTALL_BASE/external/$PYTHIAPKG -fi +./configure --prefix=$INSTALL_BASE/external/$PYTHIAPKG make make install echo Installing PHOTOS in $INSTALL_BASE/external/PHOTOS cd ../PHOTOS ./configure --with-hepmc3= --with-hepmc=$INSTALL_BASE/external/HepMC --prefix=$INSTALL_BASE/external/PHOTOS make make install echo Installing TAUOLA in $INSTALL_BASE/external/TAUOLA cd ../TAUOLA ./configure --without-hepmc3 --with-hepmc=$INSTALL_BASE/external/HepMC --prefix=$INSTALL_BASE/external/TAUOLA make make install else echo Installing HepMC3 in $INSTALL_BASE/external/HepMC3 mkdir -p HepMC3 mkdir -p HepMC3.build cd HepMC3.build $CMAKE -DHEPMC3_ENABLE_ROOTIO=OFF -DHEPMC3_ENABLE_PYTHON=OFF -DCMAKE_INSTALL_PREFIX=$INSTALL_BASE/external/HepMC3 $INSTALL_BASE/external/HepMC3-3.2.0 make make install echo Installing pythia8 in $INSTALL_BASE/external/$PYTHIAPKG cd ../$PYTHIAPKG -if [ "$PYTHIAVER" -lt "8300" ] -then - ./configure --enable-shared --prefix=$INSTALL_BASE/external/$PYTHIAPKG -fi -if [ "$PYTHIAVER" -ge "8300" ] -then - ./configure --prefix=$INSTALL_BASE/external/$PYTHIAPKG -fi - +./configure --prefix=$INSTALL_BASE/external/$PYTHIAPKG make +make install echo Installing PHOTOS in $INSTALL_BASE/external/PHOTOS cd ../PHOTOS -./configure --with-hepmc3=$INSTALL_BASE/external/HepMC3 --prefix=$INSTALL_BASE/external/PHOTOS +./configure --without-hepmc --with-hepmc3=$INSTALL_BASE/external/HepMC3 --prefix=$INSTALL_BASE/external/PHOTOS make make install echo Installing TAUOLA in $INSTALL_BASE/external/TAUOLA cd ../TAUOLA -./configure --with-hepmc3=$INSTALL_BASE/external/HepMC3 --prefix=$INSTALL_BASE/external/TAUOLA +./configure --without-hepmc --with-hepmc3=$INSTALL_BASE/external/HepMC3 --prefix=$INSTALL_BASE/external/TAUOLA make make install fi echo Building EvtGen cd $INSTALL_BASE mkdir -p evtgen.build mkdir -p evtgen cd evtgen.build if [ "$HEPMCMAJORVERSION" -lt "3" ] then -$CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_BASE/evtgen $INSTALL_BASE/evtgen.git -DEVTGEN_BUILD_TESTS=ON -DEVTGEN_PYTHIA=ON -DEVTGEN_PHOTOS=ON -DEVTGEN_TAUOLA=ON -DEVTGEN_HEPMC3=OFF +$CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_BASE/evtgen $INSTALL_BASE/evtgen.git -DEVTGEN_PYTHIA=ON -DEVTGEN_PHOTOS=ON -DEVTGEN_TAUOLA=ON -DEVTGEN_HEPMC3=OFF \ +-DHEPMC2_ROOT_DIR=$INSTALL_BASE/external/HepMC \ +-DPYTHIA8_ROOT_DIR=$INSTALL_BASE/external/$PYTHIAPKG \ +-DPHOTOSPP_ROOT_DIR=$INSTALL_BASE/external/PHOTOS \ +-DTAUOLAPP_ROOT_DIR=$INSTALL_BASE/external/TAUOLA else -$CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_BASE/evtgen $INSTALL_BASE/evtgen.git -DEVTGEN_BUILD_TESTS=ON -DEVTGEN_PYTHIA=ON -DEVTGEN_PHOTOS=ON -DEVTGEN_TAUOLA=ON -DEVTGEN_HEPMC3=ON -DHepMC3_DIR=$INSTALL_BASE/external/HepMC3/share/HepMC3/cmake/ +$CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_BASE/evtgen $INSTALL_BASE/evtgen.git -DEVTGEN_PYTHIA=ON -DEVTGEN_PHOTOS=ON -DEVTGEN_TAUOLA=ON -DEVTGEN_HEPMC3=ON \ +-DHepMC3_DIR=$INSTALL_BASE/external/HepMC3/share/HepMC3/cmake/ \ +-DPYTHIA8_ROOT_DIR=$INSTALL_BASE/external/$PYTHIAPKG \ +-DPHOTOSPP_ROOT_DIR=$INSTALL_BASE/external/PHOTOS \ +-DTAUOLAPP_ROOT_DIR=$INSTALL_BASE/external/TAUOLA fi make make install -ctest . cd $INSTALL_BASE/evtgen echo Setup done. echo To complete, set the Pythia8 data path: if [ "$PYTHIAVER" -lt "8200" ] then echo PYTHIA8DATA=$INSTALL_BASE/external/$PYTHIAPKG/xmldoc else echo PYTHIA8DATA=$INSTALL_BASE/external/$PYTHIAPKG/share/Pythia8/xmldoc fi