From 81a0c784a5c27d7a0dea468f9bdf40cd9fe9e952 Mon Sep 17 00:00:00 2001
From: ralfulrich <ralf.ulrich@kit.edu>
Date: Wed, 13 Oct 2021 22:43:23 +0200
Subject: [PATCH] config.hpp -> corsika.hpp

---
 CMakeLists.txt                                | 20 +++--
 cmake/config.hpp.in                           | 21 -----
 cmake/corsika.hpp.in                          | 81 +++++++++++++++++++
 corsika/corsika.hpp                           | 56 -------------
 .../detail/framework/utility/CorsikaData.inl  |  5 +-
 corsika/framework/core/Cascade.hpp            |  4 +
 6 files changed, 100 insertions(+), 87 deletions(-)
 delete mode 100644 cmake/config.hpp.in
 create mode 100644 cmake/corsika.hpp.in
 delete mode 100644 corsika/corsika.hpp

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 757623e75..6bbd25bb0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,8 +17,12 @@ include (GNUInstallDirs)
 
 #+++++++++++++++++++++++++++++
 # project name
+# version is:  "8.major.minor.patch"
+#   major: API changes
+#   minor: no API changes
+#   patch: bug fix and small improvements 
 #
-set (c8_version 8.0.0)
+set (c8_version 8.0.0.0) 
 project (
   corsika
   VERSION ${c8_version}
@@ -317,22 +321,22 @@ configure_package_config_file (
   INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
   )
 #
-# generate "corsika/config.hpp" file with cmake-level details and paths
+# generate "corsika/corsika.hpp" file with cmake-level details and paths
 # first for build-tree
 #
 # the location of the "corsika-data" is of fundamental importance
 set (CORSIKA_CMAKE_DATA_DIR ${CMAKE_SOURCE_DIR}/modules/data)
 configure_file (
-  cmake/config.hpp.in
-  ${PROJECT_BINARY_DIR}/corsika/config.hpp
+  cmake/corsika.hpp.in
+  ${PROJECT_BINARY_DIR}/corsika/corsika.hpp
 )
 #
 # second also for install-tree
 #
 set (CORSIKA_CMAKE_DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}/corsika/data")
 configure_file (
-  cmake/config.hpp.in
-  ${PROJECT_BINARY_DIR}/config.hpp-install
+  cmake/corsika.hpp.in
+  ${PROJECT_BINARY_DIR}/corsika.hpp-install
 )
 #
 # installation of cmake and config files
@@ -358,8 +362,8 @@ install (
 # also install-level config.hpp
 # 
 install (FILES 
-  ${PROJECT_BINARY_DIR}/config.hpp-install
-  RENAME config.hpp
+  ${PROJECT_BINARY_DIR}/corsika.hpp-install
+  RENAME corsika.hpp
   DESTINATION include/corsika
   )
 #
diff --git a/cmake/config.hpp.in b/cmake/config.hpp.in
deleted file mode 100644
index cf388f732..000000000
--- a/cmake/config.hpp.in
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace corsika {
-
-  /**
-   * @file config.hpp
-   *
-   * @brief CORSIKA_DATA_DIR is a cmake-time marker for the location of corsika-data.
-   *
-   * the location of the "corsika-data" is of fundamental importance
-   * this should not be done in corsikaDefines.cmake since we may want
-   * to change behaviour at config/build/install time.
-   *
-   * There is a build-time default location of corsika-data at: "modules/data",
-   * but there is also an install-time default location of corsika-data at
-   * "share/corsika/data".
-   * The search for corsika-data can always be overwritten by the
-   * user with the `CORSIKA_DATA` envrionment variable.
-   */
-
-  static std::string const CORSIKA_DATA_DIR = "@CORSIKA_CMAKE_DATA_DIR@";
-
-} // namespace corsika
\ No newline at end of file
diff --git a/cmake/corsika.hpp.in b/cmake/corsika.hpp.in
new file mode 100644
index 000000000..f17f89efd
--- /dev/null
+++ b/cmake/corsika.hpp.in
@@ -0,0 +1,81 @@
+#pragma once
+
+namespace corsika {
+
+  /**
+   * @file corsika.hpp
+   *
+   * The CORSIKA 8 air shower simulation framework.
+   *
+   * @mainpage Technical documentation of the CORSIKA 8 software framework.
+   *
+   * Software documentatin and reference guide for the CORSIKA 8
+   * software framework for air shower simulations. CORSIKA 8 is developed
+   * at <a
+   * href="https://gitlab.ikp.kit.edu/AirShowerPhysics">https://gitlab.ikp.kit.edu</a>. If
+   * you got the code from somewhere else, consider to switch to the official development
+   * repository. If you want to report bugs, or want to suggest features or future
+   * development, please submit an "issue" on this gitlab server. We only accept Issues
+   * and discussion via our central development server https://gitlab.ikp.kit.edu.
+   *
+   * Write to corsika-devel@lists.kit.edu, or even register yourself at
+   * https://www.lists.kit.edu/sympa/info/corsika-devel to get in contact
+   * with other developers.
+   *
+   * For more information about the project, see @ref md_README.
+   */
+
+  // clang-format-off
+
+  /*! Usage:
+   *  to get the version R.X.Y.Z,
+   *  x: major version
+   *  y: minor version
+   *  z: patch number
+   */
+  static std::string const CORSIKA_VERSION = "@PROJECT_VERSION@";
+
+  /*!
+   *  The value of \p CORSIKA_RELEASE_VERSION encodes the
+   *  main release version number of CORSIKA. It is "8" right now.
+   */
+  static unsigned int const CORSIKA_RELEASE_NUMBER = @PROJECT_VERSION_MAJOR@;
+
+  /*!
+   * The value of \p CORSIKA_MAJOR_VERSION encodes the
+   * major release version number of CORSIKA.
+   */
+  static unsigned int const CORSIKA_MAJOR_NUMBER = @PROJECT_VERSION_MINOR@;
+
+  /*!
+   *  The value of \p CORSIKA_MINOR_NUMBER encodes the
+   *  minor release number of the CORSIKA library.
+   */
+  static unsigned int const CORSIKA_MINOR_NUMBER = @PROJECT_VERSION_PATCH@;
+
+  /*!
+   *  The value of \p CORSIKA_PATCH_NUMBER encodes the
+   *  patch number of the CORSIKA library.
+   */
+  static std::string const CORSIKA_PATCH_NUMBER = @PROJECT_VERSION_TWEAK@;
+
+  /**
+   *
+   *  CORSIKA_DATA_DIR is a cmake-time marker for the location of corsika-data.
+   *
+   * the location of the "corsika-data" is of fundamental importance
+   * this should not be done in corsikaDefines.cmake since we may want
+   * to change behaviour at config/build/install time.
+   *
+   * There is a build-time default location of corsika-data at: "modules/data",
+   * but there is also an install-time default location of corsika-data at
+   * "share/corsika/data".
+   * The search for corsika-data can always be overwritten by the
+   * user with the `CORSIKA_DATA` envrionment variable.
+   */
+
+  static std::string const CORSIKA_DATA_DIR = "@CORSIKA_CMAKE_DATA_DIR@";
+
+  // clang-format-on
+
+} // namespace corsika
diff --git a/corsika/corsika.hpp b/corsika/corsika.hpp
deleted file mode 100644
index 022325b73..000000000
--- a/corsika/corsika.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * (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
-
-/**
- * @file corsika.hpp
- *
- * The CORSIKA 8 air shower simulation framework.
- *
- * @mainpage Technical documentation of the CORSIKA 8 software framework.
- *
- * Software documentatin and reference guide for the CORSIKA 8
- * software framework for air shower simulations. CORSIKA 8 is developed
- * at <a
- * href="https://gitlab.ikp.kit.edu/AirShowerPhysics">https://gitlab.ikp.kit.edu</a>. If
- * you got the code from somewhere else, consider to switch to the official development
- * repository. If you want to report bugs, or want to suggest features or future
- * development, please submit an "issue" on this gitlab server. We only accept Issues and
- * discussion via our central development server https://gitlab.ikp.kit.edu.
- *
- * Write to corsika-devel@lists.kit.edu, or even register yourself at
- * https://www.lists.kit.edu/sympa/info/corsika-devel to get in contact
- * with other developers.
- *
- * For more information about the project, see @ref md_README.
- */
-
-/*! Usage:
- *  to get the version X.YY.Z,
- *  set CORSIKA_VERSION X0YY0Z
- */
-#define CORSIKA_VERSION 800000
-
-/*! \def CORSIKA_MAJOR_VERSION
- *  \brief The preprocessor macro \p CORSIKA_MAJOR_VERSION encodes the
- *         major version number of CORSIKA.
- */
-#define CORSIKA_MAJOR_VERSION (CORSIKA_VERSION / 100000)
-
-/*! \def CORSIKA_MINOR_VERSION
- *  \brief The preprocessor macro \p CORSIKA_MINOR_VERSION encodes the
- *         minor version number of CORSIKA.
- */
-#define CORSIKA_MINOR_VERSION (CORSIKA_VERSION / 100 % 1000)
-
-/*! \def CORSIKA_PATCH_NUMBER
- *  \brief The preprocessor macro \p CORSIKA_PATCH_NUMBER encodes the
- *         patch number of the CORSIKA library.
- */
-#define CORSIKA_PATCH_NUMBER 0
diff --git a/corsika/detail/framework/utility/CorsikaData.inl b/corsika/detail/framework/utility/CorsikaData.inl
index af5937227..0bfc36939 100644
--- a/corsika/detail/framework/utility/CorsikaData.inl
+++ b/corsika/detail/framework/utility/CorsikaData.inl
@@ -7,7 +7,7 @@
  */
 #pragma once
 
-#include <corsika/config.hpp>
+#include <corsika/corsika.hpp>
 #include <corsika/framework/core/Logging.hpp>
 
 #include <boost/filesystem/path.hpp>
@@ -19,7 +19,8 @@
 namespace corsika {
 
   inline boost::filesystem::path corsika_data(boost::filesystem::path const& key) {
-    boost::filesystem::path fname = boost::filesystem::path(CORSIKA_DATA_DIR) / key;
+    boost::filesystem::path fname =
+        boost::filesystem::path(corsika::CORSIKA_DATA_DIR) / key;
     // LCOV_EXCL_START, this cannot be easily tested system-independently
     if (auto const* p = std::getenv("CORSIKA_DATA"); p != nullptr) {
       fname = boost::filesystem::path(p) / key;
diff --git a/corsika/framework/core/Cascade.hpp b/corsika/framework/core/Cascade.hpp
index 10f9eb9a2..1163950f3 100644
--- a/corsika/framework/core/Cascade.hpp
+++ b/corsika/framework/core/Cascade.hpp
@@ -8,6 +8,8 @@
 
 #pragma once
 
+#include <corsika/corsika.hpp>
+
 #include <corsika/framework/process/ProcessReturn.hpp>
 #include <corsika/framework/core/PhysicalUnits.hpp>
 #include <corsika/framework/random/ExponentialDistribution.hpp>
@@ -82,6 +84,8 @@ namespace corsika {
         , output_(out)
         , stack_(stack) {
       CORSIKA_LOG_INFO(c8_ascii_);
+      CORSIKA_LOG_INFO("This is CORSIKA {}.{}.{}.{}", CORSIKA_RELEASE_NUMBER,
+                       CORSIKA_MAJOR_NUMBER, CORSIKA_MINOR_NUMBER, CORSIKA_PATCH_NUMBER);
       CORSIKA_LOG_INFO("Tracking algorithm: {} (version {})", TTracking::getName(),
                        TTracking::getVersion());
       if constexpr (stack_view_type::has_event) {
-- 
GitLab