From f632117938499fcb2934f99e3dc1766c0ab8491d Mon Sep 17 00:00:00 2001
From: ralfulrich <ralf.ulrich@kit.edu>
Date: Mon, 7 Jan 2019 08:13:25 +0100
Subject: [PATCH] check if APPLE

---
 CMakeLists.txt           | 10 +++++++---
 Processes/Sibyll/Decay.h |  6 ++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b7a37854c..9a788d053 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,17 +34,21 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
   # Set the possible values of build type for cmake-gui
   set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
     "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
-endif()
+endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
 
 # enable warnings and disallow non-standard language
 set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wno-ignored-qualifiers")
 set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-set(CMAKE_CXX_FLAGS_RELEASE "-O3") 
+set(CMAKE_CXX_FLAGS_RELEASE "-O3") # -O2 would not trade speed for size, neither O2/3 use fast-math 
 
 # clang produces a lot of unecessary warnings without this:
 add_compile_options("$<$<CXX_COMPILER_ID:Clang>:-Wno-nonportable-include-path>") 
 
-  
+# check if we are on OSX:
+if (APPLE)
+  add_compile_definitions (CORSIKA_OSX)
+endif (APPLE)
+
 # unit testing coverage, does not work yet
 #include (CodeCoverage)
 ##set(COVERAGE_LCOV_EXCLUDES 'Documentation/*')
diff --git a/Processes/Sibyll/Decay.h b/Processes/Sibyll/Decay.h
index ec776afcd..13c6a3ebc 100644
--- a/Processes/Sibyll/Decay.h
+++ b/Processes/Sibyll/Decay.h
@@ -169,7 +169,10 @@ namespace corsika::process {
         using corsika::geometry::Point;
         using namespace corsika::units::si;
 
+	// TODO: this should be done in a central, common place. Not here..
+#ifndef CORSIKA_OSX
         feenableexcept(FE_INVALID);
+#endif
 
         fCount++;
         SibStack ss;
@@ -216,7 +219,10 @@ namespace corsika::process {
         // empty sibyll stack
         ss.Clear();
 
+	// TODO: this should be done in a central, common place. Not here..
+#ifndef CORSIKA_OSX
         fedisableexcept(FE_INVALID);
+#endif
       }
     };
   } // namespace sibyll
-- 
GitLab