diff --git a/CMakeLists.txt b/CMakeLists.txt index c013267..3f88bca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,72 +1,73 @@ # 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.8.0) # Project setup if(${CMAKE_VERSION} VERSION_LESS 3.9.0) project(EvtGen VERSION 2.0.0 ) elseif(${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(InstallPaths) # 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) message(STATUS "EvtGen: Linking with Pythia8 ${EVTGEN_PYTHIA}") message(STATUS "EvtGen: Linking with Photos++ ${EVTGEN_PHOTOS}") message(STATUS "EvtGen: Linking with Tauola++ ${EVTGEN_TAUOLA}") 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) -# Build the executables in the validation directory +# Build the executables in the test and validation directories +add_subdirectory(test) add_subdirectory(validation) # Install the include directories install(DIRECTORY EvtGen DESTINATION ${CMAKE_INSTALL_PREFIX}) install(DIRECTORY EvtGenBase DESTINATION ${CMAKE_INSTALL_PREFIX}) install(DIRECTORY EvtGenExternal DESTINATION ${CMAKE_INSTALL_PREFIX}) install(DIRECTORY EvtGenModels DESTINATION ${CMAKE_INSTALL_PREFIX}) # Install the particle properties and decay tables install(FILES DECAY.DEC DECAY.XML evt.pdl DESTINATION ${CMAKE_INSTALL_PREFIX}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..e149173 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,25 @@ + +# the test executables require ROOT for histogramming etc. +find_package(ROOT REQUIRED) +include(${ROOT_USE_FILE}) + +# build each of the executables +foreach( test_exe evt_dalitz evtgenlhc_test1 example1 exampleWriteHepMC ) + add_executable(${test_exe} ${test_exe}.cc) + target_link_libraries(${test_exe} PRIVATE EvtGen ${ROOT_LIBRARIES}) + if( ${EVTGEN_PYTHIA} OR ${EVTGEN_PHOTOS} OR ${EVTGEN_TAUOLA} ) + target_compile_definitions(${test_exe} PRIVATE EVTGEN_EXTERNAL) + target_link_libraries(${test_exe} PRIVATE EvtGenExternal) + endif() +endforeach() + +# install the executables +install(TARGETS evt_dalitz evtgenlhc_test1 example1 exampleWriteHepMC + RUNTIME DESTINATION test + ) + +# install the decay files, macros, scripts, etc. +install(DIRECTORY exampleFiles DESTINATION ${CMAKE_INSTALL_PREFIX}/test) +install(FILES do_tests + DESTINATION ${CMAKE_INSTALL_PREFIX}/test + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) diff --git a/validation/CMakeLists.txt b/validation/CMakeLists.txt index 7b918bb..750267d 100644 --- a/validation/CMakeLists.txt +++ b/validation/CMakeLists.txt @@ -1,30 +1,55 @@ # the validation executables require ROOT for histogramming etc. find_package(ROOT REQUIRED) include(${ROOT_USE_FILE}) # build each of the executables -add_executable(testCPVDecays testCPVDecays.cc) -target_link_libraries(testCPVDecays PRIVATE EvtGen ${ROOT_LIBRARIES}) -if( ${EVTGEN_PYTHIA} OR ${EVTGEN_PHOTOS} OR ${EVTGEN_TAUOLA} ) - target_compile_definitions(testCPVDecays PRIVATE EVTGEN_EXTERNAL) - target_link_libraries(testCPVDecays PRIVATE EvtGenExternal) -endif() - -# make sure that any decay files, etc. are also copied -file(GLOB CPV_DECAY_FILES - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/CPVDecayFiles/*.dec - ) -foreach(decfile ${CPV_DECAY_FILES}) - configure_file(${decfile} ${CMAKE_CURRENT_BINARY_DIR}/${decfile} COPYONLY) +foreach( validation_exe compareRootFiles genExampleRootFiles genRootDecayChain testCPVDecays ) + add_executable(${validation_exe} ${validation_exe}.cc) + target_link_libraries(${validation_exe} PRIVATE EvtGen ${ROOT_LIBRARIES}) + if( ${EVTGEN_PYTHIA} OR ${EVTGEN_PHOTOS} OR ${EVTGEN_TAUOLA} ) + target_compile_definitions(${validation_exe} PRIVATE EVTGEN_EXTERNAL) + target_link_libraries(${validation_exe} PRIVATE EvtGenExternal) + endif() endforeach() # install the executables -install(TARGETS testCPVDecays +install(TARGETS compareRootFiles genExampleRootFiles genRootDecayChain testCPVDecays RUNTIME DESTINATION validation ) -# install the decay files, etc. -install(FILES ${CPV_DECAY_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/validation/CPVDecayFiles) - +# install the decay files, macros, scripts, etc. +install(DIRECTORY B0Files DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(DIRECTORY CPVDecayFiles DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(DIRECTORY UpsilonFiles DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(DIRECTORY TauolaFiles DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(DIRECTORY Bs0Files DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(DIRECTORY tauFiles DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(DIRECTORY rootFiles DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(DIRECTORY PHSPFiles DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(DIRECTORY BpFiles DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(DIRECTORY gifFiles DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(DIRECTORY DalitzFiles DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(FILES BKstarGamma.dec BuDst0rhop.dec Kspimumu.dec photosTest.dec DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(FILES compareDalitz.C PhaseSpacePlots.C photosPlots.C plotBKstarGamma.C PlotKspimumu.C DESTINATION ${CMAKE_INSTALL_PREFIX}/validation) +install(FILES compareAllDecays.sh + compareB0PythiaDecays.sh + compareBpPythiaDecays.sh + compareBs0PythiaDecays.sh + compareTauolaDecays.sh + compareTauPythiaDecays.sh + compareUpsilonPythiaDecays.sh + genAllDecayExamples.sh + genB0PythiaDecays.sh + genBpPythiaDecays.sh + genBs0PythiaDecays.sh + genDalitzDecays.sh + genDDalitzModes.sh + genPHSP.sh + genTauolaDecays.sh + genTauPythiaDecays.sh + genUpsilonPythiaDecays.sh + runKspimumu.sh + runPhotosTest.sh + DESTINATION ${CMAKE_INSTALL_PREFIX}/validation + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)