IAP GITLAB

Commit e845cfd7 authored by Ralf Ulrich's avatar Ralf Ulrich

Merge branch '360-export-cmake-targets-for-corsika8-as-framework' into 'master'

Resolve "Export cmake targets for CORSIKA8 as framework"

Closes #360

See merge request !306
parents 5c9ea67a ca319868
Pipeline #3486 passed with stages
in 25 minutes and 45 seconds
...@@ -12,6 +12,7 @@ variables: ...@@ -12,6 +12,7 @@ variables:
ASAN_OPTIONS: "detect_leaks=0:detect_stack_use_after_return=1" ASAN_OPTIONS: "detect_leaks=0:detect_stack_use_after_return=1"
# location of AirShowerPhysics/corsika-data # location of AirShowerPhysics/corsika-data
CORSIKA_DATA: "${CI_PROJECT_DIR}/modules/data" # the git submodule CORSIKA_DATA: "${CI_PROJECT_DIR}/modules/data" # the git submodule
corsika_DIR: "${CI_PROJECT_DIR}/build/install" # for cmake to find corsikaConfig.cmake
# _alternatively_ corsika-data can be downloaded as submodule: # _alternatively_ corsika-data can be downloaded as submodule:
GIT_SUBMODULE_STRATEGY: normal # none: we get the submodules in before_script, GIT_SUBMODULE_STRATEGY: normal # none: we get the submodules in before_script,
# normal: get submodules automatically # normal: get submodules automatically
...@@ -92,7 +93,7 @@ check-clang-format: ...@@ -92,7 +93,7 @@ check-clang-format:
script: script:
- mkdir -p build - mkdir -p build
- cd build - cd build
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DUSE_PYTHIA8_C8=C8 - cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8
rules: rules:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
...@@ -279,56 +280,6 @@ build_test-clang-8: ...@@ -279,56 +280,6 @@ build_test-clang-8:
####### EXAMPLE (only manual) ##############
##########################################################
# generic example template job
# normal pipeline for each commit
.example:
stage: example
tags:
- corsika
script:
- cd build
- set -o pipefail
- make -j4 run_examples | gzip -v -9 > examples.log.gz
rules:
- if: $CI_MERGE_REQUEST_ID
when: manual
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH
when: manual
allow_failure: true
artifacts:
when: always
expire_in: 3 days
paths:
- ${CI_PROJECT_DIR}/build/examples.log.gz
cache:
paths:
- ${CI_PROJECT_DIR}/build/
untracked: true
policy: pull
# example for gcc
example-u-18_04:
extends: .example
image: corsika/devel:u-18.04
dependencies:
- build-u-18_04
cache:
key: "${CI_COMMIT_REF_SLUG}-gcc"
# example for clang
example-clang-8:
extends: .example
image: corsika/devel:clang-8
dependencies:
- build-clang-8
cache:
key: "${CI_COMMIT_REF_SLUG}-clang"
####### BUILD-TEST-EXAMPLE (only non-Draft) ############## ####### BUILD-TEST-EXAMPLE (only non-Draft) ##############
...@@ -344,7 +295,12 @@ example-clang-8: ...@@ -344,7 +295,12 @@ example-clang-8:
- cd build - cd build
- cmake --build . -- -j4 - cmake --build . -- -j4
- set -o pipefail - set -o pipefail
- ctest -j4 - ctest -j4
- make install
- mkdir -p build_examples
- cd build_examples
- cmake ../install/share/corsika/examples
- make -j4
- make -j4 run_examples | gzip -v -9 > examples.log.gz - make -j4 run_examples | gzip -v -9 > examples.log.gz
rules: rules:
- if: '$CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/' - if: '$CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/'
...@@ -362,7 +318,7 @@ example-clang-8: ...@@ -362,7 +318,7 @@ example-clang-8:
junit: junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
paths: paths:
- ${CI_PROJECT_DIR}/build/examples.log.gz - ${CI_PROJECT_DIR}/build/build_examples/examples.log.gz
cache: cache:
paths: paths:
- ${CI_PROJECT_DIR}/build/ - ${CI_PROJECT_DIR}/build/
...@@ -450,10 +406,15 @@ install-clang-8: ...@@ -450,10 +406,15 @@ install-clang-8:
- corsika - corsika
script: script:
- cd build - cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_PYTHIA8_C8=C8 - cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_Pythia8_C8=C8
- cmake --build . -- -j4 - cmake --build . -- -j4
- set -o pipefail - set -o pipefail
- ctest -j4 - ctest -j4
- make install
- mkdir -p build_examples
- cd build_examples
- cmake ../install/share/corsika/examples
- make -j4
- make -j4 run_examples | gzip -v -9 > examples.log.gz - make -j4 run_examples | gzip -v -9 > examples.log.gz
rules: rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set - if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
...@@ -478,7 +439,7 @@ install-clang-8: ...@@ -478,7 +439,7 @@ install-clang-8:
junit: junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
paths: paths:
- ${CI_PROJECT_DIR}/build/examples.log.gz - ${CI_PROJECT_DIR}/build/build_examples/examples.log.gz
# release for gcc # release for gcc
release-full-u-18_04: release-full-u-18_04:
...@@ -513,7 +474,7 @@ coverage: ...@@ -513,7 +474,7 @@ coverage:
- corsika - corsika
script: script:
- cd build - cd build
- cmake .. -DCMAKE_BUILD_TYPE=Coverage -DUSE_PYTHIA8_C8=C8 - cmake .. -DCMAKE_BUILD_TYPE=Coverage -DUSE_Pythia8_C8=C8
- cmake --build . -- -j4 - cmake --build . -- -j4
- ctest -j4 - ctest -j4
- cmake --build . --target coverage - cmake --build . --target coverage
...@@ -575,5 +536,3 @@ sanity: ...@@ -575,5 +536,3 @@ sanity:
untracked: true untracked: true
policy: pull policy: pull
key: "${CI_COMMIT_REF_SLUG}-gcc" key: "${CI_COMMIT_REF_SLUG}-gcc"
cmake_minimum_required (VERSION 3.9) cmake_minimum_required (VERSION 3.9)
#+++++++++++++++++++++++++++++
# project name
#
set (c8_version 8.0.0)
project (
corsika
VERSION ${c8_version}
DESCRIPTION "CORSIKA C++ project (alpha status)"
LANGUAGES CXX
)
#+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++
# prevent in-source builds and give warning message # prevent in-source builds and give warning message
# #
...@@ -10,15 +21,16 @@ if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") ...@@ -10,15 +21,16 @@ if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
You must delete them, or cmake will refuse to work.") You must delete them, or cmake will refuse to work.")
endif () endif ()
#+++++++++++++++++++++++++++++ #++++++++++++++++++++++++++++
# project name # cmake version-specific settings
# #
project ( # https://cmake.org/cmake/help/latest/policy/CMP0079.html
corsika if (${CMAKE_VERSION} VERSION_GREATER "3.13.0")
VERSION 8.0.0 cmake_policy (SET CMP0079 NEW)
DESCRIPTION "CORSIKA C++ project (alpha status)" endif ()
LANGUAGES CXX if (POLICY CMP0079)
) cmake_policy (SET CMP0079 NEW)
endif ()
#+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++
# as long as there still are modules using it: # as long as there still are modules using it:
...@@ -37,7 +49,7 @@ endif () ...@@ -37,7 +49,7 @@ endif ()
# cmake path dir, and cmake config # cmake path dir, and cmake config
# #
set (CORSIKA8_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake") set (CORSIKA8_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
set (CMAKE_MODULE_PATH "${CORSIKA8_CMAKE_DIR}" ${CMAKE_MODULE_PATH}) set (CMAKE_MODULE_PATH "${CORSIKA8_CMAKE_DIR}" ${CMAKE_MODULE_PATH})
include (CorsikaUtilities) # extra cmake function include (CorsikaUtilities) # extra cmake function
set (CMAKE_VERBOSE_MAKEFILE OFF) # this can be done with `make VERBOSE=1` set (CMAKE_VERBOSE_MAKEFILE OFF) # this can be done with `make VERBOSE=1`
# ignore many irrelevant Up-to-date messages during install # ignore many irrelevant Up-to-date messages during install
...@@ -46,7 +58,7 @@ set (CMAKE_INSTALL_MESSAGE LAZY) ...@@ -46,7 +58,7 @@ set (CMAKE_INSTALL_MESSAGE LAZY)
#+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++
# Setup hardware and infrastructure dependent defines # Setup hardware and infrastructure dependent defines
# #
include(CorsikaDefines) include (CorsikaDefines)
#+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++
# check if compiler is C++17 compliant # check if compiler is C++17 compliant
...@@ -68,7 +80,6 @@ set (CMAKE_CXX_EXTENSIONS OFF) ...@@ -68,7 +80,6 @@ set (CMAKE_CXX_EXTENSIONS OFF)
# FYI: optimizer flags: -O2 would not trade speed for size, neither O2/3 use fast-math # 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) # debug: O0, relwithdebinfo: 02, release: O3, minsizerel: Os (all defaults)
set (CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wno-ignored-qualifiers") set (CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wno-ignored-qualifiers")
set (CMAKE_Fortran_FLAGS "-std=legacy -Wfunction-elimination")
set (DEFAULT_BUILD_TYPE "Release") set (DEFAULT_BUILD_TYPE "Release")
# clang produces a lot of unecessary warnings without this: # clang produces a lot of unecessary warnings without this:
...@@ -149,7 +160,7 @@ if (CMAKE_BUILD_TYPE STREQUAL Coverage) ...@@ -149,7 +160,7 @@ if (CMAKE_BUILD_TYPE STREQUAL Coverage)
add_custom_command ( add_custom_command (
OUTPUT coverage.info OUTPUT coverage.info
COMMAND ${LCOV_BIN_DIR}/lcov -q --remove raw-coverage.info "*/usr/*" "/usr/*" --output-file coverage2.info COMMAND ${LCOV_BIN_DIR}/lcov -q --remove raw-coverage.info "*/usr/*" "/usr/*" --output-file coverage2.info
COMMAND ${LCOV_BIN_DIR}/lcov --remove coverage2.info "*/externals/*" "*/tests/*" "*/sibyll2.3d.cpp" "*/.conan/*" "*/include/Pythia8/*" "${CMAKE_CURRENT_SOURCE_DIR}/modules/*" "${CMAKE_CURRENT_BINARY_DIR}/modules/*" --output-file coverage.info COMMAND ${LCOV_BIN_DIR}/lcov --remove coverage2.info "*/externals/*" "*/tests/*" "*/sibyll2.3d.cpp" "*/.conan/*" "*/include/Pythia8/*" "${CMAKE_SOURCE_DIR}/modules/*" "${CMAKE_BINARY_DIR}/modules/*" --output-file coverage.info
COMMAND ${CMAKE_COMMAND} -E remove coverage2.info COMMAND ${CMAKE_COMMAND} -E remove coverage2.info
DEPENDS raw-coverage.info DEPENDS raw-coverage.info
) )
...@@ -175,7 +186,7 @@ set (CTEST_CUSTOM_COVERAGE_EXCLUDE "./tests/" "./examples/" "./modules/" "test*. ...@@ -175,7 +186,7 @@ set (CTEST_CUSTOM_COVERAGE_EXCLUDE "./tests/" "./examples/" "./modules/" "test*.
# include this test only if NOT run on gitlab-ci; On CI this is a dedicated job: # include this test only if NOT run on gitlab-ci; On CI this is a dedicated job:
if (NOT DEFINED ENV{CI}) if (NOT DEFINED ENV{CI})
# add call to ./do-copyright.py to run as unit-test-case # add call to ./do-copyright.py to run as unit-test-case
add_test (NAME copyright_notices COMMAND ./do-copyright.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) add_test (NAME copyright_notices COMMAND ./do-copyright.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif (NOT DEFINED ENV{CI}) endif (NOT DEFINED ENV{CI})
#+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++
...@@ -190,18 +201,34 @@ option (WITH_HISTORY "Flag to switch on/off HISTORY" ON) ...@@ -190,18 +201,34 @@ option (WITH_HISTORY "Flag to switch on/off HISTORY" ON)
set (Python_ADDITIONAL_VERSIONS 3) set (Python_ADDITIONAL_VERSIONS 3)
find_package (PythonInterp 3 REQUIRED) find_package (PythonInterp 3 REQUIRED)
#+++++++++++++++++++++++++++++++
# exporting of CMake targets
#
include (CMakePackageConfigHelpers)
# list of targets that will be INSTALLed and EXPORTed
# Important: all those targets must be individually INSTALLed with "EXPORT CORSIKA8PublicTargets"
set (public_CORSIKA8_targets CORSIKA8)
#+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++
# CORSIKA8 # CORSIKA8
# #
add_library (CORSIKA8 INTERFACE) add_library (CORSIKA8 INTERFACE)
set_target_properties (
CORSIKA8
PROPERTIES
INTERFACE_CORSIKA8_MAJOR_VERSION 0
COMPATIBLE_INTERFACE_STRING CORSIKA8_MAJOR_VERSION
)
#
target_include_directories ( target_include_directories (
CORSIKA8 CORSIKA8
INTERFACE INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}> $<INSTALL_INTERFACE:include>
) )
# since CORSIKA8 is a header only library we must specify all link dependencies here: # since CORSIKA8 is a header only library we must specify all link dependencies here:
target_link_libraries ( target_link_libraries (
CORSIKA8 CORSIKA8
...@@ -217,22 +244,21 @@ add_subdirectory (src) ...@@ -217,22 +244,21 @@ add_subdirectory (src)
add_subdirectory (documentation) add_subdirectory (documentation)
#+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++
# =~~~~~~~~~~~~~~~~~~~~~~~~~=
# = Add of subdirectories = # = Add of subdirectories =
# =~~~~~~~~~~~~~~~~~~~~~~~~~= #
#+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++
# modules # modules
# #
set (CORSIKA_DATA_WITH_TEST ON) # we want to run the corsika-data unit test 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/data) # this is corsika-data (submodule)
add_subdirectory (modules/pythia) add_subdirectory (modules/pythia8)
add_subdirectory (modules/sibyll) add_subdirectory (modules/sibyll)
add_subdirectory (modules/qgsjetII) add_subdirectory (modules/qgsjetII)
add_subdirectory (modules/urqmd) add_subdirectory (modules/urqmd)
add_subdirectory (modules/conex) add_subdirectory (modules/conex)
# #
# we really need a better proposal CMakeList.txt files: # we really need a better proposal CMakeList.txt file:
set (ADD_PYTHON OFF) set (ADD_PYTHON OFF)
file (READ modules/CMakeLists_PROPOSAL.txt overwrite_CMakeLists_PROPOSAL_txt) file (READ modules/CMakeLists_PROPOSAL.txt overwrite_CMakeLists_PROPOSAL_txt)
file (WRITE modules/proposal/CMakeLists.txt ${overwrite_CMakeLists_PROPOSAL_txt}) file (WRITE modules/proposal/CMakeLists.txt ${overwrite_CMakeLists_PROPOSAL_txt})
...@@ -245,9 +271,79 @@ target_link_libraries (CORSIKA8 INTERFACE PROPOSAL) ...@@ -245,9 +271,79 @@ target_link_libraries (CORSIKA8 INTERFACE PROPOSAL)
add_subdirectory (tests) add_subdirectory (tests)
#+++++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++++
# installation
#
install (
TARGETS CORSIKA8
EXPORT CORSIKA8PublicTargets
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# header only part
#
install (DIRECTORY corsika DESTINATION include)
write_basic_package_version_file (
${PROJECT_BINARY_DIR}/corsikaConfigVersion.cmake
VERSION ${c8_version}
COMPATIBILITY SameMajorVersion
)
# export targets in build tree
export (
EXPORT CORSIKA8PublicTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/corsikaTargets.cmake"
NAMESPACE CORSIKA8::
)
# export targets in install tree
install (
EXPORT CORSIKA8PublicTargets
FILE corsikaTargets.cmake
NAMESPACE CORSIKA8::
DESTINATION lib/cmake/corsika
)
# config for build tree
configure_package_config_file (
cmake/corsikaConfig.cmake.in
${PROJECT_BINARY_DIR}/corsikaConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
# config for install tree
# overwrite with install location (if it was build as part of corsika)
set (Pythia8_INCDIR ${Pythia8_INCDIR_INSTALL})
set (Pythia8_LIBDIR ${Pythia8_LIBDIR_INSTALL})
configure_package_config_file (
cmake/corsikaConfig.cmake.in
${PROJECT_BINARY_DIR}/cmake/corsikaConfig.cmake
INSTALL_DESTINATION ${PROJECT_BINARY_DIR}/do_not_need_this
)
install (
FILES
${CMAKE_BINARY_DIR}/conanbuildinfo.cmake
${CMAKE_BINARY_DIR}/conaninfo.txt
${CMAKE_BINARY_DIR}/corsikaConfig.cmake
${CMAKE_BINARY_DIR}/corsikaConfigVersion.cmake
DESTINATION lib/cmake/corsika
)
#
# examples # examples
# #
add_subdirectory (examples) install (DIRECTORY examples DESTINATION share/corsika)
#
# tools
#
install (DIRECTORY tools DESTINATION share/corsika)
#+++++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++++
# #
......
# #
# Floating point exception support - select implementation to use # Floating point exception support - select implementation to use
# #
include(CheckIncludeFileCXX) include (CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX("fenv.h" HAS_FEENABLEEXCEPT) CHECK_INCLUDE_FILE_CXX ("fenv.h" HAS_FEENABLEEXCEPT)
if (HAS_FEENABLEEXCEPT) # FLOATING_POINT_ENVIRONMENT if (HAS_FEENABLEEXCEPT) # FLOATING_POINT_ENVIRONMENT
set (CORSIKA_HAS_FEENABLEEXCEPT 1) 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 () endif ()
...@@ -13,12 +13,12 @@ endif () ...@@ -13,12 +13,12 @@ endif ()
# General OS Detection # General OS Detection
# #
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(CORSIKA_OS_WINDOWS TRUE) set (CORSIKA_OS_WINDOWS TRUE)
set (CORSIKA_OS "Windows") set (CORSIKA_OS "Windows")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CORSIKA_OS_LINUX TRUE) set (CORSIKA_OS_LINUX TRUE)
set (CORSIKA_OS "Linux") set (CORSIKA_OS "Linux")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CORSIKA_OS_MAC TRUE) set (CORSIKA_OS_MAC TRUE)
set (CORSIKA_OS "Mac") set (CORSIKA_OS "Mac")
endif() endif ()
\ No newline at end of file
...@@ -68,55 +68,3 @@ function (CORSIKA_ADD_TEST) ...@@ -68,55 +68,3 @@ function (CORSIKA_ADD_TEST)
endif () endif ()
add_test (NAME ${name} COMMAND ${name} -o ${PROJECT_BINARY_DIR}/test_outputs/junit-${name}.xml -s -r junit) add_test (NAME ${name} COMMAND ${name} -o ${PROJECT_BINARY_DIR}/test_outputs/junit-${name}.xml -s -r junit)
endfunction (CORSIKA_ADD_TEST) endfunction (CORSIKA_ADD_TEST)
#################################################
#
# central macro to register an examples in cmake
#
# Examples can be globally executed by 'make run_examples'
#
# 1) Simple use:
# Pass the name of the source.cc file as the first
# argument, without the ".cc" extention.
#
# Example: CORSIKA_REGISTER_EXAMPLE (doSomething)
#
# The TARGET doSomething must already exists,
# i.e. typically via add_executable (doSomething src.cc).
#
# Example: CORSIKA_ADD_EXAMPLE (example_one
# RUN_OPTION "extra command line options"
# )
#
# In all cases, you can further customize the target with
# target_link_libraries(example_one ...) and so on.
#
function (CORSIKA_REGISTER_EXAMPLE)
cmake_parse_arguments (PARSE_ARGV 1 C8_EXAMPLE "" "" "RUN_OPTIONS")
set (name ${ARGV0})
if (NOT C8_EXAMPLE_RUN_OPTIONS)
set (run_options "")
else ()
set (run_options ${C8_EXAMPLE_RUN_OPTIONS})
endif ()
target_compile_options (${name} PRIVATE -g) # do not skip asserts
file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/example_outputs/)
if (TARGET run_examples)
else ()
add_custom_target (run_examples)
endif ()
add_dependencies (run_examples ${name})
# just run the command as-is
set (CMD ${CMAKE_BINARY_DIR}/bin/${name} ${run_options})
add_custom_command (TARGET run_examples
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo ""
COMMAND ${CMAKE_COMMAND} -E echo "**************************************"
COMMAND ${CMAKE_COMMAND} -E echo "***** running example: ${name} " ${run_options} VERBATIM
COMMAND ${CMD} VERBATIM
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/example_outputs)
install (TARGETS ${name} DESTINATION share/examples)
endfunction (CORSIKA_REGISTER_EXAMPLE)
...@@ -68,6 +68,11 @@ find_file (Pythia8_Pythia_h_LOC ...@@ -68,6 +68,11 @@ find_file (Pythia8_Pythia_h_LOC
PATH_SUFFIXES include/Pythia8 PATH_SUFFIXES include/Pythia8
DOC "The location of the Pythia8/Pythia.h script" DOC "The location of the Pythia8/Pythia.h script"
REQUIRED) 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}) string (REPLACE "/include/Pythia8/Pythia.h" "" Pythia8_DIR ${Pythia8_Pythia_h_LOC})
set (Pythia8_CONFIG ${Pythia8_DIR}/bin/pythia-config) set (Pythia8_CONFIG ${Pythia8_DIR}/bin/pythia-config)
......
set (CORSIKA8_VERSION @c8_version@)
@PACKAGE_INIT@
#++++++++++++++++++++++++++++
# General config and flags
#
set (CMAKE_CXX_STANDARD @CMAKE_CXX_STANDARD@)
set (CMAKE_CXX_EXTENSIONS @CMAKE_CXX_EXTENSIONS@)
set (COMPILE_OPTIONS @COMPILE_OPTIONS@)
set (CMAKE_VERBOSE_MAKEFILE @CMAKE_VERBOSE_MAKEFILE@)
#+++++++++++++++++++++++++++++
# Setup external dependencies via conan
#
include (${CMAKE_CURRENT_LIST_DIR}/conanbuildinfo.cmake)
conan_basic_setup (TARGETS)
#+++++++++++++++++++++++++++++
# Import Pythia8
# since we always import pythia (ExternalProject_Add) we have to
# import here, too.
#
add_library (C8::ext::pythia8 STATIC IMPORTED GLOBAL)
set_target_properties (
C8::ext::pythia8 PROPERTIES
IMPORTED_LOCATION @Pythia8_LIBDIR@/libpythia8.a
IMPORTED_LINK_INTERFACE_LIBRARIES dl
INTERFACE_INCLUDE_DIRECTORIES @Pythia8_INCDIR@
)
set (Pythia8_FOUND @Pythia8_FOUND@)
message (STATUS "Pythia8 at: @Pythia8_PREFIX@")
#++++++++++++++++++++++++++++++
# import CORSIKA8
#
include ("${CMAKE_CURRENT_LIST_DIR}/corsikaTargets.cmake")
check_required_components (corsika)
...@@ -52,7 +52,7 @@ namespace corsika { ...@@ -52,7 +52,7 @@ namespace corsika {
inline QuantityVector<length_d>& getCoordinates(CoordinateSystemPtr const& pCS); inline QuantityVector<length_d>& getCoordinates(CoordinateSystemPtr const& pCS);
/** /**
* \defgroup access coordinate components * \name access coordinate components
* \{ * \{
* *
* Note, if you access components in a different CoordinateSystem * Note, if you access components in a different CoordinateSystem
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#pragma once #pragma once
// the location of the "xmldoc" pythia directory (data files, config) // the location of the "xmldoc" pythia directory (data files, config)
#include <Pythia8ConfigurationDirectory.hpp> #include <corsika/modules/pythia8/Pythia8ConfigurationDirectory.hpp>
// the main pythia include // the main pythia include
#include <Pythia8/Pythia.h> #include <Pythia8/Pythia.h>
set (
HISTORY_HEADERS
EventType.hpp
Event.hpp
HistorySecondaryProducer.hpp