IAP GITLAB

Commit b5fb9cba authored by Ralf Ulrich's avatar Ralf Ulrich Committed by Ralf Ulrich

final adaptions of pythia8 pathes

parent 658934f8
......@@ -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
......
......@@ -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
......
......@@ -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@")
#++++++++++++++++++++++++++++++
......
### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE:
@PACKAGE_INIT@
#
# 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 ()
......@@ -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)
......
......@@ -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>
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)
......
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)
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment