diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3a6b182225bb6790c312868c4d2d66a7a1746907..72845f390ccb28948b2f7838f5cce731c07ff4d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -92,7 +92,7 @@ check-clang-format: script: - mkdir -p build - cd build - - cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Debug -DUSE_PYTHIA8_C8=C8 + - cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8 rules: - if: $CI_MERGE_REQUEST_ID - if: $CI_COMMIT_TAG @@ -453,7 +453,7 @@ install-clang-8: - corsika script: - cd build - - cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_PYTHIA8_C8=C8 + - cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_Pythia8_C8=C8 - cmake --build . -- -j4 - set -o pipefail - ctest -j4 @@ -519,7 +519,7 @@ coverage: - corsika script: - cd build - - cmake .. -DCMAKE_BUILD_TYPE=Coverage -DUSE_PYTHIA8_C8=C8 + - cmake .. -DCMAKE_BUILD_TYPE=Coverage -DUSE_Pythia8_C8=C8 - cmake --build . -- -j4 - ctest -j4 - cmake --build . --target coverage diff --git a/CMakeLists.txt b/CMakeLists.txt index df6ac5f8c0746e3e5bb131e23843b2ff95e4ff41..1a466cfd9cf5a3d097face6935fd0aced9fcea98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -252,7 +252,7 @@ add_subdirectory (documentation) # set (CORSIKA_DATA_WITH_TEST ON) # we want to run the corsika-data unit test add_subdirectory (modules/data) # this is corsika-data (submodule) -add_subdirectory (modules/pythia) +add_subdirectory (modules/pythia8) add_subdirectory (modules/sibyll) add_subdirectory (modules/qgsjetII) add_subdirectory (modules/urqmd) @@ -296,6 +296,14 @@ write_basic_package_version_file ( COMPATIBILITY SameMajorVersion ) +# export targets in build tree +export ( + EXPORT CORSIKA8PublicTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/CORSIKA8Targets.cmake" + NAMESPACE CORSIKA8:: + ) + +# export targets in install tree install ( EXPORT CORSIKA8PublicTargets FILE CORSIKA8Targets.cmake diff --git a/cmake/CORSIKA8Config.cmake.in b/cmake/CORSIKA8Config.cmake.in index 460b64fc3559cb6847c33dd366240a0a2adcfcc2..becf7f35f89145a84e0854446920955db37a2261 100644 --- a/cmake/CORSIKA8Config.cmake.in +++ b/cmake/CORSIKA8Config.cmake.in @@ -26,10 +26,10 @@ set_target_properties ( C8::ext::pythia8 PROPERTIES IMPORTED_LOCATION @Pythia8_LIBRARY@/libpythia8.a IMPORTED_LINK_INTERFACE_LIBRARIES dl - INTERFACE_INCLUDE_DIRECTORIES @Pythia8_INCLUDE_DIR@ + INTERFACE_INCLUDE_DIRECTORIES @Pythia8_INCLUDE_DIRS@ ) set (Pythia8_FOUND @Pythia8_FOUND@) -message ("Pythia8 lib: @Pythia8_LIBRARY@, inc: @Pythia8_INCLUDE_DIR@") +message (STATUS "Pythia8 lib: @Pythia8_LIBRARY@, inc: @Pythia8_INCLUDE_DIRS@") #++++++++++++++++++++++++++++++ diff --git a/cmake/CORSIKAConfig.cmake.in b/cmake/CORSIKAConfig.cmake.in deleted file mode 100644 index 90a3e35832a812a674ae02dc038750c33a2266a7..0000000000000000000000000000000000000000 --- a/cmake/CORSIKAConfig.cmake.in +++ /dev/null @@ -1,2 +0,0 @@ -### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE: -@PACKAGE_INIT@ diff --git a/cmake/CorsikaDefines.cmake b/cmake/CorsikaDefines.cmake index f2b08a67b68f9b92a0a809e01cf38ab5496611b0..30b8fe33cf83982d8769696af86092f371ad3747 100644 --- a/cmake/CorsikaDefines.cmake +++ b/cmake/CorsikaDefines.cmake @@ -1,11 +1,11 @@ # # Floating point exception support - select implementation to use # -include(CheckIncludeFileCXX) -CHECK_INCLUDE_FILE_CXX("fenv.h" HAS_FEENABLEEXCEPT) +include (CheckIncludeFileCXX) +CHECK_INCLUDE_FILE_CXX ("fenv.h" HAS_FEENABLEEXCEPT) if (HAS_FEENABLEEXCEPT) # FLOATING_POINT_ENVIRONMENT set (CORSIKA_HAS_FEENABLEEXCEPT 1) - set_property(DIRECTORY ${CMAKE_HOME_DIRECTORY} APPEND PROPERTY COMPILE_DEFINITIONS "HAS_FEENABLEEXCEPT") + set_property (DIRECTORY ${CMAKE_HOME_DIRECTORY} APPEND PROPERTY COMPILE_DEFINITIONS "HAS_FEENABLEEXCEPT") endif () @@ -13,12 +13,12 @@ endif () # General OS Detection # if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(CORSIKA_OS_WINDOWS TRUE) + set (CORSIKA_OS_WINDOWS TRUE) set (CORSIKA_OS "Windows") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(CORSIKA_OS_LINUX TRUE) + set (CORSIKA_OS_LINUX TRUE) set (CORSIKA_OS "Linux") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(CORSIKA_OS_MAC TRUE) + set (CORSIKA_OS_MAC TRUE) set (CORSIKA_OS "Mac") -endif() \ No newline at end of file +endif () diff --git a/cmake/FindPythia8.cmake b/cmake/FindPythia8.cmake index 0818c4f1be66834cade34eb4e6e146f269d76c0d..cbd3e75eed41ff3c8dbeae4ceeab55241f111abe 100644 --- a/cmake/FindPythia8.cmake +++ b/cmake/FindPythia8.cmake @@ -68,6 +68,11 @@ find_file (Pythia8_Pythia_h_LOC PATH_SUFFIXES include/Pythia8 DOC "The location of the Pythia8/Pythia.h script" REQUIRED) + +if ("${Pythia8_Pythia_h_LOC}" STREQUAL "Pythia8_Pythia_h_LOC-NOTFOUND") + message (FATAL_ERROR "Did not find SYSTEM-level Pythia8 in: \"${_SEARCH_Pythia8_}\"") +endif () + string (REPLACE "/include/Pythia8/Pythia.h" "" Pythia8_DIR ${Pythia8_Pythia_h_LOC}) set (Pythia8_CONFIG ${Pythia8_DIR}/bin/pythia-config) diff --git a/corsika/modules/pythia8/Pythia8.hpp b/corsika/modules/pythia8/Pythia8.hpp index 6e8f80e8955b813d3c9bfc30c80a781b9dba625d..c74aa8d0dd2f16b9a2fd566b27fb74a2503cb089 100644 --- a/corsika/modules/pythia8/Pythia8.hpp +++ b/corsika/modules/pythia8/Pythia8.hpp @@ -9,7 +9,7 @@ #pragma once // the location of the "xmldoc" pythia directory (data files, config) -#include <Pythia8ConfigurationDirectory.hpp> +#include <corsika/modules/pythia8/Pythia8ConfigurationDirectory.hpp> // the main pythia include #include <Pythia8/Pythia.h> diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index acaeaf5b124ac49604956fceeb9e09a38d2c077e..94b98ac46b65fc1a557caac9c3a1c6bb4c0a01c4 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required (VERSION 3.9) project (CORSIKA8_examples) +set (CMAKE_VERBOSE_MAKEFILE OFF) # this can be changed with `make VERBOSE=1` # this is enough to use CORSIKA8 find_package (CORSIKA8 CONFIG REQUIRED) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt deleted file mode 100644 index ed2ead3f69b33185506f3cd720e30820f7c551f1..0000000000000000000000000000000000000000 --- a/modules/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required (VERSION 3.9) - -project ( - corsika_modules - VERSION 8.0.0 - DESCRIPTION "CORSIKA modules" - LANGUAGES CXX - ) - -include (FeatureSummary) - -# as long as there still are modules using it: -enable_language (Fortran) - -set (CMAKE_CXX_STANDARD 17) -set (CMAKE_CXX_EXTENSIONS OFF) - -# enable warnings and disallow non-standard language -# configure the various build types here, too -# FYI: optimizer flags: -O2 would not trade speed for size, neither O2/3 use fast-math -# debug: O0, relwithdebinfo: 02, release: O3, minsizerel: Os (all defaults) -set (CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wno-ignored-qualifiers") -set (CMAKE_Fortran_FLAGS "-std=legacy -Wfunction-elimination") - -# clang produces a lot of unecessary warnings without this: -add_compile_options ("$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wno-nonportable-include-path>") - -# order of subdirectories -add_subdirectory (Sibyll) -#add_subdirectory (Pythia) -add_subdirectory (QGSJetII) -add_subdirectory (UrQMD) diff --git a/modules/pythia/CMakeLists.txt b/modules/pythia8/CMakeLists.txt similarity index 63% rename from modules/pythia/CMakeLists.txt rename to modules/pythia8/CMakeLists.txt index e575496fbb219ccb41cf8c48abdee9abf3439692..a6e37f763f4358b8152711a7a3847439022b2b77 100644 --- a/modules/pythia/CMakeLists.txt +++ b/modules/pythia8/CMakeLists.txt @@ -10,47 +10,45 @@ mark_as_advanced (ThirdPartyChoiceValues) message (STATUS "***** Configuring Pythia8 version") -set (USE_PYTHIA8_C8 "C8" CACHE STRING +set (USE_Pythia8_C8 "C8" CACHE STRING "Selection of pythia8 package. Can be \'C8\' or \'SYSTEM\'. Default: \'C8\'.") -set_property (CACHE USE_PYTHIA8_C8 PROPERTY STRINGS ${ThirdPartyChoiceValues}) -if (NOT (${USE_PYTHIA8_C8} IN_LIST ThirdPartyChoiceValues)) - message (SEND_ERROR "Illegal USE_PYTHIA8_C8=\"${USE_PYTHIA8_C8}\" can only be one of: ${ThirdPartyChoiceValues}") -endif (NOT (${USE_PYTHIA8_C8} IN_LIST ThirdPartyChoiceValues)) -message (STATUS "USE_PYTHIA8_C8='${USE_PYTHIA8_C8}'") +set_property (CACHE USE_Pythia8_C8 PROPERTY STRINGS ${ThirdPartyChoiceValues}) +if (NOT (${USE_Pythia8_C8} IN_LIST ThirdPartyChoiceValues)) + message (SEND_ERROR "Illegal USE_Pythia8_C8=\"${USE_Pythia8_C8}\" can only be one of: ${ThirdPartyChoiceValues}") +endif (NOT (${USE_Pythia8_C8} IN_LIST ThirdPartyChoiceValues)) +message (STATUS "USE_Pythia8_C8='${USE_Pythia8_C8}'") + +set (CORSIKA_Pythia8_MODULE_DIR ${PROJECT_BINARY_DIR}/corsika/modules/pythia8) +file (MAKE_DIRECTORY ${CORSIKA_Pythia8_MODULE_DIR}) add_library (C8::ext::pythia8 STATIC IMPORTED GLOBAL) -if ("x_${USE_PYTHIA8_C8}" STREQUAL "x_SYSTEM") +if ("x_${USE_Pythia8_C8}" STREQUAL "x_SYSTEM") find_package (Pythia8 8245 EXACT REQUIRED) message (STATUS "Using system-level Pythia8 version ${Pythia8_VERSION} at ${Pythia8_PREFIX}") - set (Pythia8_INCLUDE_DIRS_CMAKE ${Pythia8_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + set (Pythia8_INCLUDE_DIRS ${Pythia8_INCLUDE_DIR}) set_target_properties ( C8::ext::pythia8 PROPERTIES IMPORTED_LOCATION ${Pythia8_LIBRARY}/libpythia8.a IMPORTED_LINK_INTERFACE_LIBRARIES dl - INTERFACE_INCLUDE_DIRECTORIES "${Pythia8_INCLUDE_DIRS_CMAKE}" + INTERFACE_INCLUDE_DIRECTORIES "${Pythia8_INCLUDE_DIRS}" ) -<<<<<<< HEAD set (Pythia8_FOUND 1 PARENT_SCOPE) set (CORSIKA_Pythia8_LOCATION ${Pythia8_PREFIX}) # build and install location, pythia8 is external - configure_file (Pythia8ConfigurationDirectory.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/Pythia8ConfigurationDirectory.hpp @ONLY) + configure_file (Pythia8ConfigurationDirectory.hpp.in ${CORSIKA_Pythia8_MODULE_DIR}/Pythia8ConfigurationDirectory.hpp @ONLY) configure_file (Pythia8ConfigurationDirectory.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/Pythia8ConfigurationDirectory_install.hpp @ONLY) message (STATUS "Pythia8 (system) at ${Pythia8_PREFIX}") -======= - message ("Pythia8 lib:${Pythia8_LIBRARY}, inc:${Pythia8_INCLUDE_DIR}") ->>>>>>> first full export of CORSIKA8 as cmake library else () set (_C8_Pythia8_VERSION "8245") message (STATUS "Building modules/pythia8 using pythia${_C8_Pythia8_VERSION}-stripped.tar.bz2") message (STATUS "This will take a bit.....") - # this is not a full PYTHIA8 install, it is a bit simplified, e.g. no pythia8-config + # this is not a full Pythia8 install, it is a bit simplified, e.g. no pythia8-config ExternalProject_Add (pythia8 URL ${CMAKE_CURRENT_SOURCE_DIR}/pythia${_C8_Pythia8_VERSION}-stripped.tar.bz2 -<<<<<<< HEAD URL_MD5 d3e951a2f101e8cfec26405cb61db83b SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/pythia8/source" INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/pythia8/install" @@ -62,53 +60,31 @@ else () set (Pythia8_FOUND 1 PARENT_SCOPE) ExternalProject_Get_Property (pythia8 INSTALL_DIR) # this is "make" set (Pythia8_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/externals/pythia8) # this is "make install" -======= - URL_MD5 83132880c0594b808bd7fd37fb642606 - SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pythia8/source - INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/external/pythia8 - CONFIGURE_COMMAND ./configure --cxx-common=-Wno-deprecated-copy --prefix=${CMAKE_INSTALL_PREFIX}/external/pythia8 - BUILD_IN_SOURCE ON - EXCLUDE_FROM_ALL TRUE - ) - ExternalProject_Get_Property (pythia8 INSTALL_DIR) ->>>>>>> first full export of CORSIKA8 as cmake library set (Pythia8_VERSION ${_C8_Pythia8_VERSION} CACHE STRING "Version of Pythia8") set (Pythia8_PREFIX ${INSTALL_DIR}) set (Pythia8_INCLUDE_DIR ${Pythia8_PREFIX}/include) set (Pythia8_LIBRARY ${Pythia8_PREFIX}/lib) add_dependencies (C8::ext::pythia8 pythia8) -<<<<<<< HEAD set (Pythia8_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/externals/pythia8) set (CORSIKA_Pythia8_LOCATION ${Pythia8_PREFIX}) # build location - configure_file (Pythia8ConfigurationDirectory.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/Pythia8ConfigurationDirectory.hpp @ONLY) + configure_file (Pythia8ConfigurationDirectory.hpp.in ${CORSIKA_Pythia8_MODULE_DIR}/Pythia8ConfigurationDirectory.hpp @ONLY) set (CORSIKA_Pythia8_LOCATION ${Pythia8_INSTALL_DIR}) # install location configure_file (Pythia8ConfigurationDirectory.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/Pythia8ConfigurationDirectory_install.hpp @ONLY) install (DIRECTORY ${INSTALL_DIR}/ DESTINATION ${Pythia8_INSTALL_DIR}) - set (Pythia8_INCLUDE_DIRS_CMAKE ${Pythia8_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + set (Pythia8_INCLUDE_DIRS ${Pythia8_INCLUDE_DIR}) set_target_properties ( C8::ext::pythia8 PROPERTIES IMPORTED_LOCATION ${Pythia8_LIBRARY} -======= - # create include directory at config time - # file (MAKE_DIRECTORY ${Pythia8_INCLUDE_DIR}) - - # set (Pythia8_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/externals/pythia8) - # install (DIRECTORY ${INSTALL_DIR}/ DESTINATION ${Pythia8_INSTALL_DIR}) - - set_target_properties ( - C8::ext::pythia8 PROPERTIES - IMPORTED_LOCATION ${Pythia8_LIBRARY}/libpythia8.a ->>>>>>> first full export of CORSIKA8 as cmake library IMPORTED_LINK_INTERFACE_LIBRARIES dl - INTERFACE_INCLUDE_DIRECTORIES "${Pythia8_INCLUDE_DIRS_CMAKE}" + INTERFACE_INCLUDE_DIRECTORIES "${Pythia8_INCLUDE_DIRS}" ) - message (STATUS "Pythia8 build at: ${INSTALL_DIR}, final install to: ${Pythia8_INSTALL_DIR}, include dirs: ${Pythia8_INCLUDE_DIRS_CMAKE}") + message (STATUS "Pythia8 build at: ${INSTALL_DIR}, final install to: ${Pythia8_INSTALL_DIR}, include dirs: ${Pythia8_INCLUDE_DIRS}") endif () # the install location of Pythia8 @@ -122,11 +98,8 @@ install ( add_dependencies (CORSIKA8 C8::ext::pythia8) target_link_libraries (CORSIKA8 INTERFACE C8::ext::pythia8) -<<<<<<< HEAD -======= # we need those for exporting targets and dependencies: set (Pythia8_FOUND 1 PARENT_SCOPE) set (Pythia8_PREFIX ${Pythia8_PREFIX} PARENT_SCOPE) -set (Pythia8_INCLUDE_DIR ${Pythia8_INCLUDE_DIR} PARENT_SCOPE) +set (Pythia8_INCLUDE_DIRS ${Pythia8_INCLUDE_DIRS} PARENT_SCOPE) set (Pythia8_LIBRARY ${Pythia8_LIBRARY} PARENT_SCOPE) ->>>>>>> first full export of CORSIKA8 as cmake library diff --git a/modules/pythia/Pythia8ConfigurationDirectory.hpp.in b/modules/pythia8/Pythia8ConfigurationDirectory.hpp.in similarity index 100% rename from modules/pythia/Pythia8ConfigurationDirectory.hpp.in rename to modules/pythia8/Pythia8ConfigurationDirectory.hpp.in diff --git a/modules/pythia/pythia8245-stripped.tar.bz2 b/modules/pythia8/pythia8245-stripped.tar.bz2 similarity index 100% rename from modules/pythia/pythia8245-stripped.tar.bz2 rename to modules/pythia8/pythia8245-stripped.tar.bz2 diff --git a/modules/pythia/strip-pythia8-package.py b/modules/pythia8/strip-pythia8-package.py similarity index 100% rename from modules/pythia/strip-pythia8-package.py rename to modules/pythia8/strip-pythia8-package.py