From b35f1fa5235657fd834ca4f6a25a8c127a9a5efe Mon Sep 17 00:00:00 2001
From: rulrich <ralf.m.ulrich@kit.edu>
Date: Sun, 31 May 2020 08:02:59 +0200
Subject: [PATCH] explicit boost dependency tracking

---
 .../Examples/cascade_proton_example.cc          |  3 ---
 Framework/Cascade/Cascade.h                     |  3 ---
 Framework/Geometry/testFourVector.cc            |  7 -------
 Framework/Logging/CMakeLists.txt                |  7 +++++--
 Framework/StackInterface/testCombinedStack.cc   |  4 ----
 Framework/StackInterface/testSecondaryView.cc   |  4 ----
 Framework/StackInterface/testStackInterface.cc  |  4 ----
 Framework/Utilities/CMakeLists.txt              |  1 +
 Processes/InteractionCounter/CMakeLists.txt     |  3 ++-
 .../testNuclearStackExtension.cc                |  3 ---
 ThirdParty/CMakeLists.txt                       | 17 ++++++++++++++---
 11 files changed, 22 insertions(+), 34 deletions(-)

diff --git a/Documentation/Examples/cascade_proton_example.cc b/Documentation/Examples/cascade_proton_example.cc
index f95c9ae22..17cc88680 100644
--- a/Documentation/Examples/cascade_proton_example.cc
+++ b/Documentation/Examples/cascade_proton_example.cc
@@ -40,9 +40,6 @@
 
 #include <corsika/utl/CorsikaFenv.h>
 
-#include <boost/type_index.hpp>
-using boost::typeindex::type_id_with_cvr;
-
 #include <iostream>
 #include <limits>
 #include <typeinfo>
diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h
index ee8e7db37..e7d2cafb3 100644
--- a/Framework/Cascade/Cascade.h
+++ b/Framework/Cascade/Cascade.h
@@ -35,9 +35,6 @@
 #include <limits>
 #include <type_traits>
 
-#include <boost/type_index.hpp>
-using boost::typeindex::type_id_with_cvr;
-
 /**
  * The cascade namespace assembles all objects needed to simulate full particles cascades.
  */
diff --git a/Framework/Geometry/testFourVector.cc b/Framework/Geometry/testFourVector.cc
index 4c2ce0971..c84d40c16 100644
--- a/Framework/Geometry/testFourVector.cc
+++ b/Framework/Geometry/testFourVector.cc
@@ -17,9 +17,6 @@
 #include <corsika/units/PhysicalUnits.h>
 #include <cmath>
 
-#include <boost/type_index.hpp>
-using boost::typeindex::type_id_with_cvr;
-
 using namespace corsika::geometry;
 using namespace corsika::units::si;
 
@@ -174,10 +171,6 @@ TEST_CASE("four vectors") {
     FourVector<const TimeType&, const Vector<length_d>&> p2(T, P);
     FourVector<const TimeType&, const Vector<length_d>&> p3(T_c, P_c);
 
-    std::cout << type_id_with_cvr<decltype(p1)>().pretty_name() << std::endl;
-    std::cout << type_id_with_cvr<decltype(p2)>().pretty_name() << std::endl;
-    std::cout << type_id_with_cvr<decltype(p3)>().pretty_name() << std::endl;
-
     p1 *= 10;
     // p2 *= 10; // this does not compile, and it shoudn't !
     // p3 *= 10; // this does not compile, and it shoudn't !!
diff --git a/Framework/Logging/CMakeLists.txt b/Framework/Logging/CMakeLists.txt
index 345a1904a..de7cb2dae 100644
--- a/Framework/Logging/CMakeLists.txt
+++ b/Framework/Logging/CMakeLists.txt
@@ -18,7 +18,10 @@ set (
   BufferedSink.h
   )
 
-CORSIKA_COPY_HEADERS_TO_NAMESPACE (CORSIKAlogging ${CORSIKAlogging_NAMESPACE} ${CORSIKAlogging_HEADERS})
+CORSIKA_COPY_HEADERS_TO_NAMESPACE (CORSIKAlogging
+  ${CORSIKAlogging_NAMESPACE}
+  ${CORSIKAlogging_HEADERS}
+  )
 
 # include directive for upstream code
 target_include_directories (
@@ -26,7 +29,7 @@ target_include_directories (
   INTERFACE
   $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
   $<INSTALL_INTERFACE:include/>
-  ${Boost_INCLUDE_DIRS}
+  CORSIKAboost
   )
 
 # install library
diff --git a/Framework/StackInterface/testCombinedStack.cc b/Framework/StackInterface/testCombinedStack.cc
index ccb47c51d..2ad1e817d 100644
--- a/Framework/StackInterface/testCombinedStack.cc
+++ b/Framework/StackInterface/testCombinedStack.cc
@@ -15,10 +15,6 @@
 #include <testTestStack.h> // for testing: simple stack. This is a
 // test-build, and inluce file is obtained from CMAKE_CURRENT_SOURCE_DIR
 
-#include <boost/type_index.hpp>
-#include <type_traits>
-using boost::typeindex::type_id_with_cvr;
-
 #include <iomanip>
 #include <iostream>
 #include <vector>
diff --git a/Framework/StackInterface/testSecondaryView.cc b/Framework/StackInterface/testSecondaryView.cc
index fe20b5daa..8e2ac0e9e 100644
--- a/Framework/StackInterface/testSecondaryView.cc
+++ b/Framework/StackInterface/testSecondaryView.cc
@@ -14,10 +14,6 @@
 #include <testTestStack.h> // for testing: simple stack. This is a
 // test-build, and inluce file is obtained from CMAKE_CURRENT_SOURCE_DIR
 
-#include <boost/type_index.hpp>
-#include <type_traits>
-using boost::typeindex::type_id_with_cvr;
-
 #include <iomanip>
 #include <iostream>
 #include <vector>
diff --git a/Framework/StackInterface/testStackInterface.cc b/Framework/StackInterface/testStackInterface.cc
index acedfc757..99567943a 100644
--- a/Framework/StackInterface/testStackInterface.cc
+++ b/Framework/StackInterface/testStackInterface.cc
@@ -14,10 +14,6 @@
                            // for testing only: include from
                            // CMAKE_CURRENT_SOURCE_DIR
 
-#include <boost/type_index.hpp>
-#include <type_traits>
-using boost::typeindex::type_id_with_cvr;
-
 #include <iomanip>
 #include <iostream>
 #include <tuple>
diff --git a/Framework/Utilities/CMakeLists.txt b/Framework/Utilities/CMakeLists.txt
index dbdb7ae64..13b544518 100644
--- a/Framework/Utilities/CMakeLists.txt
+++ b/Framework/Utilities/CMakeLists.txt
@@ -53,6 +53,7 @@ target_link_libraries (
   CORSIKAutilities
   CORSIKAgeometry
   CORSIKAunits
+  CORSIKAboost # so far only for MetaProgramming
   )
 
 target_include_directories (
diff --git a/Processes/InteractionCounter/CMakeLists.txt b/Processes/InteractionCounter/CMakeLists.txt
index 2323207a3..4821b249f 100644
--- a/Processes/InteractionCounter/CMakeLists.txt
+++ b/Processes/InteractionCounter/CMakeLists.txt
@@ -22,7 +22,6 @@ set_target_properties (
   PROPERTIES
   VERSION ${PROJECT_VERSION}
   SOVERSION 1
-#  PUBLIC_HEADER "${MODEL_HEADERS}"
   )
 
 # target dependencies on other libraries (also the header onlys)
@@ -31,6 +30,7 @@ target_link_libraries (
   CORSIKAunits
   CORSIKAprocesssequence
   CORSIKAthirdparty
+  CORSIKAboost
   )
 
 target_include_directories (
@@ -52,6 +52,7 @@ CORSIKA_ADD_TEST(testInteractionCounter SOURCES
 target_link_libraries (
   testInteractionCounter
   ProcessInteractionCounter
+  CORSIKAsetup
   CORSIKAunits
   CORSIKAenvironment
   CORSIKAtesting
diff --git a/Stack/NuclearStackExtension/testNuclearStackExtension.cc b/Stack/NuclearStackExtension/testNuclearStackExtension.cc
index 1bd2dd019..7c37bfbf7 100644
--- a/Stack/NuclearStackExtension/testNuclearStackExtension.cc
+++ b/Stack/NuclearStackExtension/testNuclearStackExtension.cc
@@ -13,9 +13,6 @@
 #include <corsika/stack/super_stupid/SuperStupidStack.h>
 #include <corsika/units/PhysicalUnits.h>
 
-#include <boost/type_index.hpp>
-using boost::typeindex::type_id_with_cvr;
-
 using namespace corsika;
 using namespace corsika::stack::nuclear_extension;
 using namespace corsika::geometry;
diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt
index e3cd96354..824b9b6ed 100644
--- a/ThirdParty/CMakeLists.txt
+++ b/ThirdParty/CMakeLists.txt
@@ -36,7 +36,7 @@ if (NOT Boost_FOUND)
   set (Boost_INCLUDE_DIR  ${Boost_PREFIX})
   set (Boost_LIBRARY_DIR ${Boost_PREFIX})
   add_dependencies (CORSIKAboost boost)
-
+  
   # create include directory at config time
   file (MAKE_DIRECTORY ${Boost_INCLUDE_DIR})
   
@@ -48,7 +48,18 @@ if (NOT Boost_FOUND)
     INTERFACE_INCLUDE_DIRECTORIES
       $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
     )
-    
+  message ("Use ThirdParty boost include dir ${Boost_INCLUDE_DIR}")
+  include_directories (${Boost_INCLUDE_DIR})
+
+else (NOT Boost_FOUND)
+
+  message ("Using system-level boost version ${Boost_VERSION} at ${Boost_INCLUDE_DIR}")
+  set_target_properties (
+    CORSIKAboost PROPERTIES
+    INTERFACE_INCLUDE_DIRECTORIES
+      $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
+    )
+
 endif (NOT Boost_FOUND)
 
 # eigen3
@@ -140,7 +151,7 @@ if (NOT Pythia8_FOUND)
 
 else (NOT Pythia8_FOUND)
 
-  message ("Using Pythia8 Version ${Pythia8_VERSION}")
+  message ("Using system-level Pythia8 version ${Pythia8_VERSION} at ${Pythia8_INCLUDE_DIR}")
   set_target_properties (
     CORSIKAPythia8 PROPERTIES
     IMPORTED_LOCATION ${Pythia8_LIBRARY}
-- 
GitLab