IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 1985a20e authored by Alan Coleman's avatar Alan Coleman
Browse files

Merge branch 'conan2_cmake_building' into 'master'

Moving to Conan2 based builds and update versions of some dependencies.

See merge request !625
parents 9f4e0876 6874af53
No related branches found
No related tags found
1 merge request!625Moving to Conan2 based builds and update versions of some dependencies.
Pipeline #13702 failed
Showing
with 561 additions and 153 deletions
...@@ -10,3 +10,15 @@ flymd.md ...@@ -10,3 +10,15 @@ flymd.md
Testing Testing
tags tags
Environment/GeneratedMediaProperties.inc Environment/GeneratedMediaProperties.inc
CMakeUserPresets.json
corsika/framework/core/GeneratedParticleClasses.inc
corsika/framework/core/GeneratedParticleProperties.inc
corsika/framework/core/particle_db.pkl
corsika/media/GeneratedMediaProperties.inc
corsika/modules/epos/Generated.inc
corsika/modules/fluka/Generated.inc
corsika/modules/qgsjetII/Generated.inc
corsika/modules/sibyll/Generated.inc
corsika/modules/sophia/Generated.inc
conan_cmake/
corsika-cmake.sh
...@@ -102,10 +102,11 @@ check-python-quality: ...@@ -102,10 +102,11 @@ check-python-quality:
tags: tags:
- corsika - corsika
script: script:
- pip3 install conan --upgrade --user
- mkdir -p ${CI_PROJECT_DIR}/build - mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh - ${CI_PROJECT_DIR}/conan-install.sh -s .. -d
- cmake .. -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8 - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8"
rules: rules:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
...@@ -141,10 +142,11 @@ config-clang-14: ...@@ -141,10 +142,11 @@ config-clang-14:
tags: tags:
- corsika - corsika
script: script:
- pip3 install conan --upgrade --user
- mkdir -p ${CI_PROJECT_DIR}/build - mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh - ${CI_PROJECT_DIR}/conan-install.sh -s .. -d
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8 - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8"
- cmake --build . -- -j4 - cmake --build . -- -j4
- set -o pipefail - set -o pipefail
- ctest -j4 - ctest -j4
...@@ -163,6 +165,7 @@ config-clang-14: ...@@ -163,6 +165,7 @@ config-clang-14:
junit: junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
# build_test for gcc # build_test for gcc
build_test-u-22_04: build_test-u-22_04:
extends: .build_test extends: .build_test
...@@ -194,10 +197,11 @@ build_test-clang-14: ...@@ -194,10 +197,11 @@ build_test-clang-14:
tags: tags:
- corsika - corsika
script: script:
- pip3 install conan --upgrade --user
- mkdir -p ${CI_PROJECT_DIR}/build - mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh - ${CI_PROJECT_DIR}/conan-install.sh -s .. -d
- cmake .. -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8 - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8"
- cmake --build . -- VERBOSE=1 -j4 - cmake --build . -- VERBOSE=1 -j4
- set -o pipefail - set -o pipefail
- ctest -j4 - ctest -j4
...@@ -205,7 +209,8 @@ build_test-clang-14: ...@@ -205,7 +209,8 @@ build_test-clang-14:
- mkdir -p ${CI_PROJECT_DIR}/build/build_examples - mkdir -p ${CI_PROJECT_DIR}/build/build_examples
- cd ${CI_PROJECT_DIR}/build/build_examples - cd ${CI_PROJECT_DIR}/build/build_examples
- export corsika_DIR=${CI_PROJECT_DIR}/build/install - export corsika_DIR=${CI_PROJECT_DIR}/build/install
- cmake -DCMAKE_BUILD_TYPE=Debug ../install/share/corsika/examples - export corsika_CONAN_DEPENDENCIES=${CI_PROJECT_DIR}/build/install/lib/cmake/dependencies
- cmake -DCMAKE_TOOLCHAIN_FILE=${corsika_CONAN_DEPENDENCIES}/conan_toolchain.cmake -DCMAKE_PREFIX_PATH=${corsika_CONAN_DEPENDENCIES} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Debug ../install/share/corsika/examples
- cmake --build . -- -j2 - cmake --build . -- -j2
- cmake --build . --target run_examples -- -j2 - cmake --build . --target run_examples -- -j2
- export EXE=${CI_PROJECT_DIR}/build/install/bin/c8_air_shower # Run the example scripts - export EXE=${CI_PROJECT_DIR}/build/install/bin/c8_air_shower # Run the example scripts
...@@ -233,7 +238,7 @@ build_test-clang-14: ...@@ -233,7 +238,7 @@ build_test-clang-14:
- ${CI_PROJECT_DIR}/build/build_examples/example_outputs/c8_air_shower_output #python examples need this - ${CI_PROJECT_DIR}/build/build_examples/example_outputs/c8_air_shower_output #python examples need this
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
- ${CI_PROJECT_DIR}/build/CMakeCache.txt #python tests need this - ${CI_PROJECT_DIR}/build/CMakeCache.txt #python tests need this
- ${CI_PROJECT_DIR}/build/bin #python tests need this - ${CI_PROJECT_DIR}/build #/bin #python tests need this
# build_test_example for gcc # build_test_example for gcc
build_test_example-u-22_04: build_test_example-u-22_04:
...@@ -267,19 +272,22 @@ build_test_example-clang-14: ...@@ -267,19 +272,22 @@ build_test_example-clang-14:
tags: tags:
- corsika - corsika
script: script:
- pip3 install conan --upgrade --user
- mkdir -p ${CI_PROJECT_DIR}/build - mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh - ${CI_PROJECT_DIR}/conan-install.sh -s .. -r
- cmake .. -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DCMAKE_BUILD_TYPE=Release -DUSE_Pythia8_C8=C8 - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8"
- cmake --build . -- -j4 - cmake --build . -- -j4
- set -o pipefail - set -o pipefail
- ctest -j4 - ctest -j4
- cmake --install . - cmake --install .
- mkdir -p ${CI_PROJECT_DIR}/build/build_examples - mkdir -p ${CI_PROJECT_DIR}/build/build_examples
- cd ${CI_PROJECT_DIR}/build/build_examples - cd ${CI_PROJECT_DIR}/build/build_examples
- cmake -DCMAKE_BUILD_TYPE=Release ${CI_PROJECT_DIR}/build/install/share/corsika/examples - export corsika_DIR=${CI_PROJECT_DIR}/build/install
- cmake --build . -- VERBOSE=1 -j2 - export corsika_CONAN_DEPENDENCIES=${CI_PROJECT_DIR}/build/install/lib/cmake/dependencies
- cmake --build . --target run_examples -- -j2 - cmake -DCMAKE_TOOLCHAIN_FILE=${corsika_CONAN_DEPENDENCIES}/conan_toolchain.cmake -DCMAKE_PREFIX_PATH=${corsika_CONAN_DEPENDENCIES} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release ../install/share/corsika/examples
- cmake --build . -- VERBOSE=1 -j4
- cmake --build . --target run_examples -- -j4
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
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
...@@ -300,6 +308,7 @@ build_test_example-clang-14: ...@@ -300,6 +308,7 @@ build_test_example-clang-14:
paths: paths:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
# release for gcc # release for gcc
release-full-u-22_04: release-full-u-22_04:
extends: .release extends: .release
...@@ -335,10 +344,11 @@ coverage: ...@@ -335,10 +344,11 @@ coverage:
tags: tags:
- corsika - corsika
script: script:
- pip3 install conan --upgrade --user
- mkdir -p ${CI_PROJECT_DIR}/build - mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh - ${CI_PROJECT_DIR}/conan-install.sh -s .. -d
- cmake .. -DCMAKE_BUILD_TYPE=Coverage -DUSE_Pythia8_C8=C8 - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCOVERAGE_BUILD=True -DUSE_Pythia8_C8=C8"
- cmake --build . -- -j4 - cmake --build . -- -j4
- ctest -j4 - ctest -j4
- cmake --build . --target coverage - cmake --build . --target coverage
...@@ -378,10 +388,11 @@ sanity: ...@@ -378,10 +388,11 @@ sanity:
tags: tags:
- corsika - corsika
script: script:
- pip3 install conan --upgrade --user
- mkdir -p ${CI_PROJECT_DIR}/build - mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh - ${CI_PROJECT_DIR}/conan-install.sh -s .. -d
- cmake .. -DWITH_CORSIKA_SANITIZERS_ENABLED=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8 - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DWITH_CORSIKA_SANITIZERS_ENABLED=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8"
- cmake --build . -- -j4 - cmake --build . -- -j4
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
......
[submodule "modules/data"] [submodule "modules/data"]
path = modules/data path = modules/data
url = ../../AirShowerPhysics/corsika-data.git url = ../../AirShowerPhysics/corsika-data.git
branch = master
shallow = true shallow = true
[submodule "modules/conex"] [submodule "modules/conex"]
path = modules/conex/cxroot path = modules/conex/cxroot
url = ../../AirShowerPhysics/cxroot.git url = ../../AirShowerPhysics/cxroot.git
branch = master
shallow = true shallow = true
...@@ -62,7 +62,13 @@ endif () ...@@ -62,7 +62,13 @@ 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})
if(DEFINED CONAN_CMAKE_DIR)
list(APPEND CMAKE_MODULE_PATH "${CONAN_CMAKE_DIR}")
endif(DEFINED CONAN_CMAKE_DIR)
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
set (CMAKE_INSTALL_MESSAGE LAZY) set (CMAKE_INSTALL_MESSAGE LAZY)
...@@ -111,8 +117,7 @@ add_compile_options ( ...@@ -111,8 +117,7 @@ add_compile_options (
# Setup external dependencies. # Setup external dependencies.
# #
### ###
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
# #
# add cnpy temporarily. As long as SaveBoostHistogram does not save to parquet directly # add cnpy temporarily. As long as SaveBoostHistogram does not save to parquet directly
...@@ -123,7 +128,15 @@ add_subdirectory (externals/cnpy) ...@@ -123,7 +128,15 @@ add_subdirectory (externals/cnpy)
# Coverage # Coverage
# #
# targets and settings needed to generate coverage reports # targets and settings needed to generate coverage reports
if (CMAKE_BUILD_TYPE STREQUAL Coverage) #if (CMAKE_BUILD_TYPE STREQUAL Coverage)
SET(COVERAGE_BUILD OFF CACHE BOOL "Activate coverage build")
if( COVERAGE_BUILD AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
message(INFO "\n|==========> COVERAGE TARGET ACTIVATED.\n")
find_package (Perl REQUIRED) find_package (Perl REQUIRED)
# compile coverage under -O0 to avoid any optimization, function elimation etc. # compile coverage under -O0 to avoid any optimization, function elimation etc.
...@@ -173,6 +186,7 @@ if (CMAKE_BUILD_TYPE STREQUAL Coverage) ...@@ -173,6 +186,7 @@ if (CMAKE_BUILD_TYPE STREQUAL Coverage)
DEPENDS coverage.info DEPENDS coverage.info
) )
add_custom_target (coverage DEPENDS coverage-report) add_custom_target (coverage DEPENDS coverage-report)
endif () endif ()
#+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++
...@@ -211,13 +225,14 @@ set (public_CORSIKA8_targets CORSIKA8) ...@@ -211,13 +225,14 @@ set (public_CORSIKA8_targets CORSIKA8)
# CORSIKA8 # CORSIKA8
# #
add_library (CORSIKA8 INTERFACE) add_library (CORSIKA8 INTERFACE)
set_target_properties ( set_target_properties (
CORSIKA8 CORSIKA8
PROPERTIES PROPERTIES
INTERFACE_CORSIKA8_MAJOR_VERSION 0 INTERFACE_CORSIKA8_MAJOR_VERSION 0
COMPATIBLE_INTERFACE_STRING CORSIKA8_MAJOR_VERSION COMPATIBLE_INTERFACE_STRING CORSIKA8_MAJOR_VERSION
) )
#
target_include_directories ( target_include_directories (
CORSIKA8 CORSIKA8
INTERFACE INTERFACE
...@@ -225,17 +240,31 @@ target_include_directories ( ...@@ -225,17 +240,31 @@ target_include_directories (
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}> $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<INSTALL_INTERFACE:include> $<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:
find_package(Boost COMPONENTS filesystem REQUIRED)
find_package(CLI11 REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(spdlog REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(Arrow REQUIRED)
find_package(PROPOSAL REQUIRED)
find_package(BZip2 REQUIRED)
find_package(Catch2 REQUIRED)
target_link_libraries ( target_link_libraries (
CORSIKA8 CORSIKA8
INTERFACE INTERFACE
CONAN_PKG::proposal ZLIB::ZLIB
CONAN_PKG::eigen BZip2::BZip2
CONAN_PKG::spdlog Boost::filesystem
CONAN_PKG::boost CLI11::CLI11
CONAN_PKG::yaml-cpp Eigen3::Eigen
CONAN_PKG::arrow spdlog::spdlog
CONAN_PKG::cli11 yaml-cpp::yaml-cpp
Parquet::parquet_static
PROPOSAL::PROPOSAL
cnpy # for SaveBoostHistogram cnpy # for SaveBoostHistogram
) )
...@@ -312,6 +341,12 @@ install ( ...@@ -312,6 +341,12 @@ install (
NAMESPACE CORSIKA8:: NAMESPACE CORSIKA8::
DESTINATION lib/cmake/corsika DESTINATION lib/cmake/corsika
) )
if(DEFINED CONAN_CMAKE_DIR)
install (
DIRECTORY conan_cmake/
DESTINATION lib/cmake/dependencies
)
endif(DEFINED CONAN_CMAKE_DIR)
# #
# config for build tree (for find_package) # config for build tree (for find_package)
# #
...@@ -362,8 +397,6 @@ configure_file ( ...@@ -362,8 +397,6 @@ configure_file (
# #
install ( install (
FILES FILES
${CMAKE_BINARY_DIR}/conanbuildinfo.cmake
${CMAKE_BINARY_DIR}/conaninfo.txt
${CMAKE_BINARY_DIR}/corsikaDefines.cmake ${CMAKE_BINARY_DIR}/corsikaDefines.cmake
${CMAKE_BINARY_DIR}/corsikaConfigVersion.cmake ${CMAKE_BINARY_DIR}/corsikaConfigVersion.cmake
DESTINATION lib/cmake/corsika DESTINATION lib/cmake/corsika
......
...@@ -59,7 +59,7 @@ CORSIKA 8 is tested regularly at least on `gcc11.0.0` and `clang-14.0.0`. ...@@ -59,7 +59,7 @@ CORSIKA 8 is tested regularly at least on `gcc11.0.0` and `clang-14.0.0`.
You will also need: You will also need:
- Python 3 (supported versions are Python >= 3.6), with pip - Python 3 (supported versions are Python >= 3.6), with pip
- conan (via pip) - conan (via pip, with version higher than 2.0)
- cmake > 3.4 - cmake > 3.4
- git - git
- g++, gfortran, binutils, make - g++, gfortran, binutils, make
...@@ -96,7 +96,7 @@ manage our dependencies. Currently, version 1.57.0 or higher is required. ...@@ -96,7 +96,7 @@ manage our dependencies. Currently, version 1.57.0 or higher is required.
**Note**: if you are NOT using a virtual environment, you may want to use the `pip install --user` flag. **Note**: if you are NOT using a virtual environment, you may want to use the `pip install --user` flag.
``` shell ``` shell
pip install conan~=1.57.0 pip install conan
``` ```
### Compiling ### Compiling
...@@ -109,8 +109,9 @@ git clone --recursive https://gitlab.iap.kit.edu/AirShowerPhysics/corsika.git ...@@ -109,8 +109,9 @@ git clone --recursive https://gitlab.iap.kit.edu/AirShowerPhysics/corsika.git
# Or for https: git clone --recursive git@gitlab.iap.kit.edu:AirShowerPhysics/corsika.git # Or for https: git clone --recursive git@gitlab.iap.kit.edu:AirShowerPhysics/corsika.git
mkdir corsika-build mkdir corsika-build
cd corsika-build cd corsika-build
../corsika/conan-install.sh ../corsika/conan-install.sh --source-directory ../corsika --release-with-debug
cmake ../corsika -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=../corsika-install # conan-install.sh takes required options from command line to install dependencies for 'Debug', 'Release' and 'RelWithDebInfo' builds.
../corsika/corsika-cmake.sh -c "-DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=../corsika-install"
make -j4 #The number should match the number of available cores on your machine make -j4 #The number should match the number of available cores on your machine
make install make install
``` ```
...@@ -155,8 +156,9 @@ git clone --recursive https://gitlab.iap.kit.edu/AirShowerPhysics/corsika.git ...@@ -155,8 +156,9 @@ git clone --recursive https://gitlab.iap.kit.edu/AirShowerPhysics/corsika.git
sudo docker run -v $PWD:/corsika -it corsika/devel:clang-8 /bin/bash sudo docker run -v $PWD:/corsika -it corsika/devel:clang-8 /bin/bash
mkdir build mkdir build
cd build cd build
../corsika/conan-install.sh ../corsika/conan-install.sh --source-directory ../corsika --release-with-debug
cmake ../corsika -DCMAKE_INSTALL_PREFIX=../corsika-install # conan-install.sh takes required options from command line to install dependencies for 'Debug', 'Release' and 'RelWithDebInfo' builds.
../corsika/corsika-cmake.sh -c "-DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=../corsika-install"
make -j4 #The number should match the number of available cores on your machine make -j4 #The number should match the number of available cores on your machine
make install make install
``` ```
......
...@@ -30,12 +30,6 @@ set (CMAKE_CXX_EXTENSIONS @CMAKE_CXX_EXTENSIONS@) ...@@ -30,12 +30,6 @@ set (CMAKE_CXX_EXTENSIONS @CMAKE_CXX_EXTENSIONS@)
set (COMPILE_OPTIONS @COMPILE_OPTIONS@) set (COMPILE_OPTIONS @COMPILE_OPTIONS@)
set (CMAKE_VERBOSE_MAKEFILE @CMAKE_VERBOSE_MAKEFILE@) 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 # Import Pythia8
# since we always import pythia (ExternalProject_Add) we have to # since we always import pythia (ExternalProject_Add) we have to
......
...@@ -55,9 +55,10 @@ function (CORSIKA_ADD_TEST) ...@@ -55,9 +55,10 @@ function (CORSIKA_ADD_TEST)
else () else ()
set(sanitize ${C8_ADD_TEST_SANITIZE}) set(sanitize ${C8_ADD_TEST_SANITIZE})
endif () endif ()
find_package(Catch2 REQUIRED)
add_executable (${name} ${sources}) add_executable (${name} ${sources})
target_link_libraries (${name} CORSIKA8 CONAN_PKG::catch2 CorsikaTestingCommon) target_link_libraries (${name} CORSIKA8 Catch2::Catch2WithMain CorsikaTestingCommon)
target_compile_options (${name} PRIVATE -g) # do not skip asserts target_compile_options (${name} PRIVATE -g) # do not skip asserts
target_include_directories (${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories (${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test_outputs/) file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test_outputs/)
......
#! /bin/sh #!/bin/bash
DIR=$(readlink -f $(dirname $0))
if [ $# -eq 0 ]; then function show_usage(){
# no arguments passed, target is current working dir printf "\n\nUsage:"
target_dir="$PWD" printf "$0 options [parameters]\n"
elif [ $# -eq 1 ]; then printf "\n"
# target is provided directory printf "Options:\n"
target_dir="$1" printf "\n -s or --source-directory:\n Corsika 8 download directory, which contains the 'conanfile.py' recipe. Default is the current directory."
else printf "\n -d or --debug:\n Specify 'Debug' as build type for the installed dependences. This should be matched when building CORSIKA 8."
echo "usage: conan-install.sh [directory]" >&2 printf "\n -r or --release:\n Specify 'Release' as build type for the installed dependences. This should be matched when building CORSIKA 8."
printf "\n -rd or --release-with-debug:\n Specify 'RelWithDebInfo' as build type for the installed dependences. This should be matched when building CORSIKA 8."
printf "\n\nExample: ./conan-install.sh --source-directory /some_path/corsika --debug"
printf "\n -h or --help:\n Prints this message.\n"
exit 0
}
echo "|---------------------------------------------------|"
echo "|-----------------[ CORSIKA 8 ]---------------------|"
echo "|-----[ CONAN2 DEPENDENCIES INSTALL SCRIPT ]------- |"
echo "|---------------------------------------------------|"
echo "|-------------------- BEGIN ------------------------| "
echo " "
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SCRIPT_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
BUILD_TYPE="RelWithDebInfo"
CORSIKA_DIR=${CURRENT_DIR}
CORSIKA_DIR_INFORMED=${CURRENT_DIR}
CONAN2_OUTPUT_FOLDER_NAME="conan_cmake"
printf "[ conan-install | info > This script is located at the directory: ${SCRIPT_DIR}\n"
if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]];then
show_usage
fi
while [ ! -z "$1" ]; do
case "$1" in
--source-directory|-s)
shift
CORSIKA_DIR=$(readlink -e ${1})
CORSIKA_DIR_INFORMED=${1}
;;
--debug|-d)
#shift
BUILD_TYPE="Debug"
;;
--release|-r)
#shift
BUILD_TYPE="Release"
;;
--release-with-debug|-rd)
#shift
BUILD_TYPE="RelWithDebInfo"
;;
--help|-h)
#shift
show_usage
;;
*)
show_usage
;;
esac
if [ $# -gt 0 ]; then
shift
fi
done
if [[ ${#CORSIKA_DIR} -eq 0 ]]; then
printf "[ conan-install | warning > Output folder for cmake scripts generated by conan2 not found.\n"
printf "[ conan-install | warning > Directory '${CORSIKA_DIR_INFORMED}' does not exist.\n"
exit 1 exit 1
fi fi
echo "using `conan --version`"
if ! conan profile show corsika8 >/dev/null 2>/dev/null; then if [ -d "${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME}" ]; then
conan profile new --detect corsika8 printf "[ conan-install | info > Output folder for cmake scripts generated by conan2 is: ${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME}\n"
conan profile update settings.compiler.cppstd=17 corsika8 else
if [ "$(uname)" = "Linux" ]; then printf "[ conan-install | warning > Output folder for cmake scripts generated by conan2 not found.\n"
conan profile update settings.compiler.libcxx=libstdc++11 corsika8 printf "[ conan-install | warning > Creating directory ${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME}.\n"
fi mkdir -p "${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME}"
fi fi
mkdir -p "$target_dir" || exit 2 if [ -f "${CORSIKA_DIR}/conanfile.py" ]; then
cd "$target_dir" || exit 3 printf "[ conan-install | info > conan2 recipe: ${CORSIKA_DIR}/conanfile.py\n"
else
printf "[ conan-install | warning > conan2 recipe not found.\n"
printf "[ conan-install | warning > File '${CORSIKA_DIR}/conanfile.py' does not exist.\n"
exit 1
fi
# Conan2 variabes
CONAN2_HOME=$(readlink -e `conan config home`)
CONAN2_PROFILE_NAME="corsika8"
printf "[ conan-install | info > conan2 home: ${CONAN2_HOME}\n"
# Conan2 commands
CONAN2_DEFAULT_PROFILE_COMMAND="conan profile detect --force"
CONAN2_PROFILE_COMMAND="conan profile detect --name ${CONAN2_PROFILE_NAME} --force"
CONAN2_INSTALL_COMMAND="conan install ${CORSIKA_DIR} --output-folder=${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME} --build=missing --settings=build_type=${BUILD_TYPE} --profile=${CONAN2_PROFILE_NAME}"
CONAN2_SHOW_PROFLE_COMMAND="conan profile show -pr ${CONAN2_PROFILE_NAME}"
printf "[ conan-install | info > Creating default profile...\n\n"
eval $CONAN2_DEFAULT_PROFILE_COMMAND
if [ ! $? -eq 0 ]; then
printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${CONAN2_DEFAULT_PROFILE_COMMAND}.\n"
exit 126
fi
printf "[ conan-install | info > Creating '${CONAN2_PROFILE_NAME}' profile...\n\n"
eval $CONAN2_PROFILE_COMMAND
if [ ! $? -eq 0 ]; then
printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${CONAN2_PROFILE_COMMAND}.\n"
exit 126
fi
printf "\n\n[ conan-install | info > Editing '${CONAN2_PROFILE_NAME}' profile\n"
#========== cppstd setting ============
STD_NUMBER=`grep -n -m 1 "compiler.cppstd=" ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME} | cut -d: -f1`
SED_STD_COMMAND="sed -i '${STD_NUMBER}s/.*/compiler.cppstd=gnu17/' ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME}"
eval $SED_STD_COMMAND
if [ ! $? -eq 0 ]; then
printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${SED_STD_COMMAND}\n"
exit 126
fi
if [ "${CI_JOB_ID}" ]; then #========== libcxx setting ============
# Temporary fix for the CI which has a broken arrow install CXX_NUMBER=`grep -n -m 1 "compiler.libcxx=" ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME} | cut -d: -f1`
conan remove -f arrow SED_CXX_COMMAND="sed -i '${CXX_NUMBER}s/.*/compiler.libcxx=libstdc++11/' ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME}"
eval $SED_CXX_COMMAND
if [ ! $? -eq 0 ]; then
printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${SED_CXX_COMMAND}\n"
exit 126
fi
eval $CONAN2_SHOW_PROFLE_COMMAND
if [ ! $? -eq 0 ]; then
printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${CONAN2_SHOW_PROFLE_COMMAND}\n"
exit 126
fi
printf "[ conan-install | info > ${CONAN2_INSTALL_COMMAND}\n"
eval ${CONAN2_INSTALL_COMMAND}
if [ ! $? -eq 0 ]; then
printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${CONAN2_INSTALL_COMMAND}\n"
exit 126
fi
CORSIKA_CMAKE_SCRIPT="#!/bin/bash
function show_usage(){
printf \"\n\nUsage:\"
printf \"\$0 options [parameters]\n\"
printf \"\n\"
printf \"Options:\n\"
printf \"\n -c or --cmake-flags:\n Additional flags and settings to cmake base command. Default is empty string.\"
printf \"\n\nExample: ./corsika-cmake.sh --cmake-flags '-DUSE_Pythia8_C8=C8' \"
printf \"\n\nNote: the source directory (the one containing CMakeLists.txt), CMAKE_BUILD_TYPE, CMAKE_POLICY_DEFAULT_CMP0091 and CMAKE_TOOLCHAIN_FILE are already set. Do not repeat them.\"
printf \"\n -h or --help:\n Prints this message.\n\"
exit 0
}
echo \"|---------------------------------------------------|\"
echo \"|-----------------[ CORSIKA 8 ]---------------------|\"
echo \"|----------[ CMAKE CONFIGURATION SCRIPT ]---------- |\"
echo \"|---------------------------------------------------|\"
echo \"|-------------------- BEGIN ------------------------|\"
CMAKE_BASE_SETTINGS=\"cmake -S ${CORSIKA_DIR} -D CONAN_CMAKE_DIR=${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME} -D CMAKE_TOOLCHAIN_FILE=${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME}/conan_toolchain.cmake -D CMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=${BUILD_TYPE}\"
CMAKE_ADDITIONAL_SETTINGS=\"\"
if [[ \"\$1\" == \"--help\" ]] || [[ \"\$1\" == \"-h\" ]];then
show_usage
fi fi
conan install -pr corsika8 --build=missing "${DIR}"
while [ ! -z \"\$1\" ]; do
case \"\$1\" in
--cmake-flags|-c)
shift
CMAKE_ADDITIONAL_SETTINGS=\${1}
;;
--help|-h)
#shift
show_usage
;;
*)
show_usage
;;
esac
if [ \$# -gt 0 ]; then
shift
fi
done
printf \"[corsika-cmake | info > Issuing CMake command :\n\"
printf '[corsika-cmake | info > \e[1;36m%s\e[0m\n\n\n' \"\${CMAKE_BASE_SETTINGS} \${CMAKE_ADDITIONAL_SETTINGS}\"
eval \"\${CMAKE_BASE_SETTINGS} \${CMAKE_ADDITIONAL_SETTINGS}\"
if [ ! \$? -eq 0 ]; then
printf \"[ corsika | error > Project configuration (CMake) failed. \n\"
exit 1
fi
echo \"|---------------------------------------------------|\"
echo \"|-----------------[ CORSIKA 8 ]---------------------|\"
echo \"|----------[ CMAKE CONFIGURATION SCRIPT ]---------- |\"
echo \"|---------------------------------------------------|\"
echo \"|-------------------- END --------------------------|\"
"
printf "%s" "${CORSIKA_CMAKE_SCRIPT}" > ${SCRIPT_DIR}/corsika-cmake.sh
chmod +x ${SCRIPT_DIR}/corsika-cmake.sh
printf "\n\n[ conan-install | info > Copy and paste the commands below in the corsika-build directory:\n\n"
printf '\e[1;36m%s\e[0m\n' "> ${SCRIPT_DIR}/corsika-cmake.sh "
printf '\e[1;36m%s\e[0m\n' "> make -j8"
echo " "
echo "|---------------------------------------------------|"
echo "|-----------------[ CORSIKA 8 ]---------------------|"
echo "|-----[ CONAN2 DEPENDENCIES INSTALL SCRIPT ]------- |"
echo "|---------------------------------------------------|"
echo "|-------------------- END --------------------------| "
echo " "
exit 0
from conan import ConanFile
from conan.tools.cmake import cmake_layout,CMakeToolchain, CMakeDeps
class Pkg(ConanFile):
generators = "CMakeDeps", #"CMakeToolchain",
settings = "os", "arch", "compiler", "build_type"
default_options = {
'readline*:shared': 'True',
'arrow*:shared': 'False',
'arrow*:parquet': 'True',
'arrow*:fPIC': 'False',
'arrow*:with_re2': 'True',
'arrow*:with_protobuf': 'False',
'arrow*:with_openssl': 'False',
'arrow*:with_gflags': 'False',
'arrow*:with_glog': 'False',
'arrow*:with_grpc': 'False',
'arrow*:with_utf8proc': 'False',
'arrow*:with_zstd': 'False',
'arrow*:with_bz2': 'False',
'arrow*:with_thrift': 'True',
'arrow*:with_boost': 'True',
'boost*:without_container': 'True',
'boost*:without_context': 'True',
'boost*:without_contract': 'True',
'boost*:without_coroutine': 'True',
'boost*:without_date_time': 'True',
'boost*:without_fiber': 'True',
'boost*:without_filesystem': 'False',
'boost*:without_graph': 'True',
'boost*:without_graph_parallel': 'True',
'boost*:without_iostreams': 'False',
'boost*:without_json': 'True',
'boost*:without_locale': 'True',
'boost*:without_log': 'True',
'boost*:without_math': 'False',
'boost*:without_mpi': 'True',
'boost*:without_nowide': 'True',
'boost*:without_program_options': 'True',
'boost*:without_python': 'True',
'boost*:without_serialization': 'False',
'boost*:without_stacktrace': 'True',
'boost*:without_system': 'False',
'boost*:without_test': 'True',
'boost*:without_thread': 'True',
'boost*:without_timer': 'True',
'boost*:without_type_erasure': 'True',
'boost*:without_wave': 'True'
}
def configure(self):
self.options['arrow'].with_boost = True
self.options['arrow'].parquet = True
self.options['arrow'].with_thrift = True
def requirements(self):
self.requires("spdlog/1.14.1", force=True)
self.requires("catch2/3.6.0")
self.requires("bzip2/1.0.8")
self.requires("boost/1.85.0", force=True)
self.requires("eigen/3.4.0")
self.requires("zlib/1.3.1")
self.requires("yaml-cpp/0.8.0")
self.requires("cli11/1.9.1")
self.requires("arrow/16.1.0")
self.requires("proposal/7.6.2")
def build_requirements(self):
self.tool_requires("readline/8.0")
self.tool_requires("bison/[>1.0]")
def generate(self):
tc = CMakeToolchain(self)
tc.absolute_paths = True
tc.generate()
[requires]
spdlog/1.9.2
catch2/2.13.8
eigen/3.3.8
boost/1.78.0
zlib/1.2.13
proposal/7.6.2
yaml-cpp/0.7.0
arrow/10.0.0
cli11/1.9.1
[build_requires]
readline/8.0 # this is only needed to fix a missing dependency in "bison" which is pulled-in by arrow
bison/[>1.0] # needed for arrow, and we HAVE to compile it
[generators]
cmake
[options]
readline:shared=True
arrow:shared=False
arrow:parquet=True
arrow:fPIC=False
arrow:with_boost=True
arrow:with_re2=True
arrow:with_protobuf=False
arrow:with_openssl=False
arrow:with_gflags=False
arrow:with_glog=False
arrow:with_grpc=False
arrow:with_utf8proc=False
arrow:with_zstd=False
arrow:with_bz2=False
arrow:with_thrift=True
boost:without_container=True
boost:without_context=True
boost:without_contract=True
boost:without_coroutine=True
boost:without_date_time=True
boost:without_fiber=True
boost:without_filesystem=False
boost:without_graph=True
boost:without_graph_parallel=True
boost:without_iostreams=False
boost:without_json=True
boost:without_locale=True
boost:without_log=True
boost:without_math=False
boost:without_mpi=True
boost:without_nowide=True
boost:without_program_options=True
boost:without_python=True
boost:without_serialization=False
boost:without_stacktrace=True
boost:without_system=False
boost:without_test=False
boost:without_thread=True
boost:without_timer=True
boost:without_type_erasure=True
boost:without_wave=True
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#pragma once
#include <fmt/format.h>
#include <corsika/framework/core/ParticleProperties.hpp>
#include <boost/filesystem/path.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <Eigen/Dense>
//-----------------------------------
// STD
//-----------------------------------
namespace std {
auto inline format_as(std::_Put_time<char> const& arg) {
std::ostringstream os;
os << arg;
return os.str();
}
} // namespace std
//-----------------------------------
// CORSIKA
//-----------------------------------
namespace corsika {
// formatters for particle codes declared on ParticleProperties.hpp
auto inline format_as(Code code) { return fmt::underlying(code); }
auto inline format_as(PDGCode code) { return fmt::underlying(code); }
template <typename Type>
auto inline format_as(Type const& arg) {
std::ostringstream os;
os << arg;
return os.str();
}
} // namespace corsika
//-----------------------------------
// boost::filesystem
//-----------------------------------
namespace boost::filesystem {
auto inline format_as(path const& fname) { return fname.string().c_str(); }
} // namespace boost::filesystem
//-----------------------------------
// phys::units
//-----------------------------------
namespace phys::units {
template <typename Dimensions>
auto inline format_as(phys::units::quantity<Dimensions> const& arg) {
return io::to_string(arg);
}
} // namespace phys::units
//----------------------------------
// Eigen
//----------------------------------
namespace Eigen {
template <typename Scalar, int M, int N>
auto inline format_as(Matrix<Scalar, M, N> const& arg) {
std::ostringstream os;
os << arg;
return os.str();
}
template <typename Matrix1, typename Matrix2>
auto inline format_as(Product<Matrix1, Matrix2> const& arg) {
std::ostringstream os;
os << arg;
return os.str();
}
} // namespace Eigen
...@@ -22,23 +22,31 @@ ...@@ -22,23 +22,31 @@
// use the coarse system clock. This is *much* faster // use the coarse system clock. This is *much* faster
// but introduces a timestamp error of O(10 ms) which is fine for us. // but introduces a timestamp error of O(10 ms) which is fine for us.
#ifndef SPDLOG_CLOCK_COARSE
#define SPDLOG_CLOCK_COARSE #define SPDLOG_CLOCK_COARSE
#endif
// do not create a default logger (we provide our own "corsika" logger) // do not create a default logger (we provide our own "corsika" logger)
#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER
#define SPDLOG_DISABLE_DEFAULT_LOGGER #define SPDLOG_DISABLE_DEFAULT_LOGGER
#endif
// use __PRETTY_FUNCTION__ instead of __FUNCTION__ where // use __PRETTY_FUNCTION__ instead of __FUNCTION__ where
// printing function names in trace statements. This is much // printing function names in trace statements. This is much
// nicer than __FUNCTION__ under GCC/clang. // nicer than __FUNCTION__ under GCC/clang.
#ifndef SPDLOG_FUNCTION
#define SPDLOG_FUNCTION __PRETTY_FUNCTION__ #define SPDLOG_FUNCTION __PRETTY_FUNCTION__
#endif
// if this is a Debug build, include debug messages in objects // if this is a Debug build, include debug messages in objects
#ifdef _C8_DEBUG_ #ifdef _C8_DEBUG_
// trace is the highest level of logging (ALL messages will be printed) // trace is the highest level of logging (ALL messages will be printed)
#ifndef SPDLOG_ACTIVE_LEVEL
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
#endif
#else // otherwise, remove everything but "error" and worse messages #else // otherwise, remove everything but "error" and worse messages
#ifndef SPDLOG_ACTIVE_LEVEL
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG
#endif #endif
#endif
#include <spdlog/fmt/ostr.h> // will output whenerver a streaming operator is found #include <spdlog/fmt/ostr.h> // will output whenerver a streaming operator is found
#include <spdlog/sinks/stdout_color_sinks.h> #include <spdlog/sinks/stdout_color_sinks.h>
...@@ -149,3 +157,4 @@ namespace corsika { ...@@ -149,3 +157,4 @@ namespace corsika {
} // namespace corsika } // namespace corsika
#include <corsika/detail/framework/core/Logging.inl> #include <corsika/detail/framework/core/Logging.inl>
#include <corsika/detail/framework/core/SpdlogSpecializations.inl>
...@@ -82,15 +82,14 @@ namespace corsika { ...@@ -82,15 +82,14 @@ namespace corsika {
* *
* The Code enum is the actual place to define CORSIKA 8 particle codes. * The Code enum is the actual place to define CORSIKA 8 particle codes.
*/ */
enum class Code : int32_t; enum class Code : std::int32_t;
/** /**
* @enum PDGCode * @enum PDGCode
* *
* Specifically for PDG ids. * Specifically for PDG ids.
*/ */
enum class PDGCode : int32_t; enum class PDGCode : std::int32_t;
/** /**
* Internal integer type for enum Code. * Internal integer type for enum Code.
*/ */
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <corsika/modules/proposal/InteractionModel.hpp> #include <corsika/modules/proposal/InteractionModel.hpp>
#include <corsika/modules/proposal/ContinuousProcess.hpp> #include <corsika/modules/proposal/ContinuousProcess.hpp>
#include <fmt/format.h>
namespace corsika::proposal { namespace corsika::proposal {
...@@ -25,3 +26,13 @@ namespace corsika::proposal { ...@@ -25,3 +26,13 @@ namespace corsika::proposal {
thr) {} thr) {}
}; };
} // namespace corsika::proposal } // namespace corsika::proposal
//----------------------------------
// SPDLOG PROPOSAL
//----------------------------------
namespace PROPOSAL {
auto format_as(InteractionType code) { return fmt::underlying(code); }
} // namespace PROPOSAL
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <corsika/framework/geometry/Vector.hpp> #include <corsika/framework/geometry/Vector.hpp>
#include <corsika/framework/stack/Stack.hpp> #include <corsika/framework/stack/Stack.hpp>
#include <corsika/modules/sophia/ParticleConversion.hpp> #include <corsika/modules/sophia/ParticleConversion.hpp>
#include <fmt/format.h>
#include <sophia.hpp> #include <sophia.hpp>
...@@ -123,4 +124,6 @@ namespace corsika::sophia { ...@@ -123,4 +124,6 @@ namespace corsika::sophia {
typedef corsika::Stack<SophiaStackData, ParticleInterface> SophiaStack; typedef corsika::Stack<SophiaStackData, ParticleInterface> SophiaStack;
auto inline format_as(SophiaCode code) { return fmt::underlying(code); }
} // namespace corsika::sophia } // namespace corsika::sophia
...@@ -20,6 +20,8 @@ namespace corsika::tauola { ...@@ -20,6 +20,8 @@ namespace corsika::tauola {
*/ */
enum class Helicity { LeftHanded, Unpolarized, RightHanded }; enum class Helicity { LeftHanded, Unpolarized, RightHanded };
auto inline format_as(Helicity code) { return fmt::underlying(code); }
/** /**
* An interface to TAUOLA to simulate tau lepton decays. * An interface to TAUOLA to simulate tau lepton decays.
* *
......
...@@ -9,34 +9,46 @@ find_package (corsika CONFIG REQUIRED) ...@@ -9,34 +9,46 @@ find_package (corsika CONFIG REQUIRED)
# this is only for CORSIKA_REGISTER_EXAMPLE # this is only for CORSIKA_REGISTER_EXAMPLE
include ("${CMAKE_CURRENT_SOURCE_DIR}/corsikaExamples.cmake") include ("${CMAKE_CURRENT_SOURCE_DIR}/corsikaExamples.cmake")
find_package(Catch2)
find_package(yaml-cpp)
find_package(CLI11)
find_package(Arrow)
find_package(PROPOSAL)
find_package(Boost)
find_package(ZLIB)
find_package(BZip2)
find_package(Eigen3)
find_package(spdlog)
set(CONANDEPS Catch2::Catch2WithMain yaml-cpp::yaml-cpp CLI11::CLI11 arrow::arrow PROPOSAL::PROPOSAL boost::boost ZLIB::ZLIB BZip2::BZip2 Eigen3::Eigen spdlog::spdlog )
################### ###################
## cascade_examples ## cascade_examples
################### ###################
add_executable (em_shower cascade_examples/em_shower.cpp) add_executable (em_shower cascade_examples/em_shower.cpp)
target_link_libraries (em_shower CORSIKA8::CORSIKA8) target_link_libraries (em_shower CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (em_shower RUN_OPTIONS 100 8472) CORSIKA_REGISTER_EXAMPLE (em_shower RUN_OPTIONS 100 8472)
if (WITH_FLUKA) if (WITH_FLUKA)
add_executable (mars cascade_examples/mars.cpp) add_executable (mars cascade_examples/mars.cpp)
target_link_libraries (mars CORSIKA8::CORSIKA8) target_link_libraries (mars CORSIKA8::CORSIKA8 ${CONANDEPS})
message("FLUKA found, will make 'mars' example") message("FLUKA found, will make 'mars' example")
else() else()
message("FLUKA not found, will not make 'mars' example") message("FLUKA not found, will not make 'mars' example")
endif() endif()
add_executable (mc_conex cascade_examples/mc_conex.cpp) add_executable (mc_conex cascade_examples/mc_conex.cpp)
target_link_libraries (mc_conex CORSIKA8::CORSIKA8) target_link_libraries (mc_conex CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (mc_conex RUN_OPTIONS 4 2 10000.) CORSIKA_REGISTER_EXAMPLE (mc_conex RUN_OPTIONS 4 2 10000.)
add_executable (radio_em_shower cascade_examples/radio_em_shower.cpp) add_executable (radio_em_shower cascade_examples/radio_em_shower.cpp)
target_link_libraries (radio_em_shower CORSIKA8::CORSIKA8) target_link_libraries (radio_em_shower CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (radio_em_shower RUN_OPTIONS 10 1121673489) CORSIKA_REGISTER_EXAMPLE (radio_em_shower RUN_OPTIONS 10 1121673489)
if (WITH_FLUKA) if (WITH_FLUKA)
add_executable (water cascade_examples/water.cpp) add_executable (water cascade_examples/water.cpp)
target_link_libraries (water CORSIKA8::CORSIKA8) target_link_libraries (water CORSIKA8::CORSIKA8 ${CONANDEPS})
message("FLUKA found, will make 'water' example") message("FLUKA found, will make 'water' example")
else() else()
message("FLUKA not found, will not make 'water' example") message("FLUKA not found, will not make 'water' example")
...@@ -48,30 +60,30 @@ endif() ...@@ -48,30 +60,30 @@ endif()
##################### #####################
add_executable (boundary_crossing framework_examples/boundary_crossing.cpp) add_executable (boundary_crossing framework_examples/boundary_crossing.cpp)
target_link_libraries (boundary_crossing CORSIKA8::CORSIKA8) target_link_libraries (boundary_crossing CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (boundary_crossing) CORSIKA_REGISTER_EXAMPLE (boundary_crossing)
add_executable (environment framework_examples/environment.cpp) add_executable (environment framework_examples/environment.cpp)
target_link_libraries (environment CORSIKA8::CORSIKA8) target_link_libraries (environment CORSIKA8::CORSIKA8 ${CONANDEPS})
add_executable (geometry framework_examples/geometry.cpp) add_executable (geometry framework_examples/geometry.cpp)
target_link_libraries (geometry CORSIKA8::CORSIKA8) target_link_libraries (geometry CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (geometry) CORSIKA_REGISTER_EXAMPLE (geometry)
add_executable (helix_trajectory framework_examples/helix_trajectory.cpp) add_executable (helix_trajectory framework_examples/helix_trajectory.cpp)
target_link_libraries (helix_trajectory CORSIKA8::CORSIKA8) target_link_libraries (helix_trajectory CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (helix_trajectory) CORSIKA_REGISTER_EXAMPLE (helix_trajectory)
add_executable (known_particles framework_examples/known_particles.cpp) add_executable (known_particles framework_examples/known_particles.cpp)
target_link_libraries (known_particles CORSIKA8::CORSIKA8) target_link_libraries (known_particles CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (known_particles) CORSIKA_REGISTER_EXAMPLE (known_particles)
add_executable (stack framework_examples/stack.cpp) add_executable (stack framework_examples/stack.cpp)
target_link_libraries (stack CORSIKA8::CORSIKA8) target_link_libraries (stack CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (stack) CORSIKA_REGISTER_EXAMPLE (stack)
add_executable (static_sequence framework_examples/static_sequence.cpp) add_executable (static_sequence framework_examples/static_sequence.cpp)
target_link_libraries (static_sequence CORSIKA8::CORSIKA8) target_link_libraries (static_sequence CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (static_sequence) CORSIKA_REGISTER_EXAMPLE (static_sequence)
...@@ -80,17 +92,17 @@ CORSIKA_REGISTER_EXAMPLE (static_sequence) ...@@ -80,17 +92,17 @@ CORSIKA_REGISTER_EXAMPLE (static_sequence)
################### ###################
add_executable (stopping_power physics_examples/stopping_power.cpp) add_executable (stopping_power physics_examples/stopping_power.cpp)
target_link_libraries (stopping_power CORSIKA8::CORSIKA8) target_link_libraries (stopping_power CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (stopping_power) CORSIKA_REGISTER_EXAMPLE (stopping_power)
add_executable (synchrotron_clover_leaf physics_examples/synchrotron_clover_leaf.cpp) add_executable (synchrotron_clover_leaf physics_examples/synchrotron_clover_leaf.cpp)
target_link_libraries (synchrotron_clover_leaf CORSIKA8::CORSIKA8) target_link_libraries (synchrotron_clover_leaf CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (synchrotron_clover_leaf) CORSIKA_REGISTER_EXAMPLE (synchrotron_clover_leaf)
add_executable (synchrotron_test_C8tracking physics_examples/synchrotron_test_C8tracking.cpp) add_executable (synchrotron_test_C8tracking physics_examples/synchrotron_test_C8tracking.cpp)
target_link_libraries (synchrotron_test_C8tracking CORSIKA8::CORSIKA8) target_link_libraries (synchrotron_test_C8tracking CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (synchrotron_test_C8tracking) CORSIKA_REGISTER_EXAMPLE (synchrotron_test_C8tracking)
add_executable (synchrotron_test_manual_tracking physics_examples/synchrotron_test_manual_tracking.cpp) add_executable (synchrotron_test_manual_tracking physics_examples/synchrotron_test_manual_tracking.cpp)
target_link_libraries (synchrotron_test_manual_tracking CORSIKA8::CORSIKA8) target_link_libraries (synchrotron_test_manual_tracking CORSIKA8::CORSIKA8 ${CONANDEPS})
CORSIKA_REGISTER_EXAMPLE (synchrotron_test_manual_tracking) CORSIKA_REGISTER_EXAMPLE (synchrotron_test_manual_tracking)
...@@ -38,7 +38,7 @@ function (CORSIKA_REGISTER_EXAMPLE) ...@@ -38,7 +38,7 @@ function (CORSIKA_REGISTER_EXAMPLE)
endif () endif ()
add_dependencies (run_examples ${name}) add_dependencies (run_examples ${name})
# just run the command as-is # just run the command as-is
set (CMD ${CMAKE_CURRENT_BINARY_DIR}/bin/${name} ${run_options}) set (CMD ${CMAKE_CURRENT_BINARY_DIR}/${name} ${run_options})
add_custom_command (TARGET run_examples add_custom_command (TARGET run_examples
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "" COMMAND ${CMAKE_COMMAND} -E echo ""
......
...@@ -9,12 +9,12 @@ set ( ...@@ -9,12 +9,12 @@ set (
) )
add_library (cnpy STATIC ${CNPY_SOURCES}) add_library (cnpy STATIC ${CNPY_SOURCES})
find_package(ZLIB REQUIRED)
# target dependencies on other libraries (also the header onlys) # target dependencies on other libraries (also the header onlys)
target_link_libraries ( target_link_libraries (
cnpy cnpy
PUBLIC PUBLIC
CONAN_PKG::zlib ZLIB::ZLIB
) )
target_include_directories ( target_include_directories (
......
Subproject commit 20589c2dac8d39ef07d0f1b46eaa3696c82f82a3 Subproject commit ab5f63b4ea3347f96d82a999c908af2b6475845e
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment