]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Refactor C++17 bessel function support into separate check
authorMatthias Maier <tamiko@43-1.org>
Mon, 25 May 2020 04:27:46 +0000 (23:27 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 25 May 2020 04:28:57 +0000 (23:28 -0500)
cmake/checks/check_01_cxx_features.cmake
include/deal.II/base/config.h.in
include/deal.II/base/std_cxx17/cmath.h

index eaa9ab20fa0bcc9c80dc557f34ba4d859cd5e63a..4682bbb23c5dfb61dd5a37f130c44f0a7e527aab 100644 (file)
@@ -24,6 +24,7 @@
 #
 #   DEAL_II_HAVE_FP_EXCEPTIONS
 #   DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
+#   DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS
 #   DEAL_II_FALLTHROUGH
 #   DEAL_II_DEPRECATED
 #   DEAL_II_CONSTEXPR
@@ -105,10 +106,8 @@ MACRO(_test_cxx17_support)
     DEAL_II_HAVE_CXX17_CONSTEXPR_LAMBDA_BUG_OK
     )
 
-  # Test that the c++17 attributes are supported.
   CHECK_CXX_SOURCE_COMPILES(
     "
-    #include <cmath>
     #include <iostream>
     #include <optional>
     #include <tuple>
@@ -119,9 +118,6 @@ MACRO(_test_cxx17_support)
 
     //check for some C++17 features that we use in our headers:
     using std::apply;
-    using std::cyl_bessel_j;
-    using std::cyl_bessel_jf;
-    using std::cyl_bessel_jl;
     using std::optional;
 
     [[nodiscard]] int test_nodiscard()
@@ -356,6 +352,7 @@ UNSET_IF_CHANGED(CHECK_CXX_FEATURES_FLAGS_SAVED
   DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
   DEAL_II_HAVE_CXX17_ATTRIBUTE_FALLTHROUGH
   DEAL_II_HAVE_ATTRIBUTE_FALLTHROUGH
+  DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS
   DEAL_II_CXX14_CONSTEXPR_BUG_OK
   )
 
@@ -551,6 +548,25 @@ ELSE()
 ENDIF()
 
 
+#
+# Check for c++17 bessel function support. Unfortunately libc++ version 10
+# does not have those.
+#
+
+CHECK_CXX_SOURCE_COMPILES(
+  "
+  #include <cmath>
+  using std::cyl_bessel_j;
+  using std::cyl_bessel_jf;
+  using std::cyl_bessel_jl;
+  int main()
+  {
+  }
+  "
+  DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS
+  )
+
+
 #
 # Check for correct c++14 constexpr support.
 #
index 836539c207d14547506f7498cbe0f910efc641a2..92b30760aab3e8d90f3288cd956975233cf54959 100644 (file)
 
 #cmakedefine DEAL_II_HAVE_FP_EXCEPTIONS
 #cmakedefine DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
+#cmakedefine DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS
 #cmakedefine DEAL_II_CXX14_CONSTEXPR_BUG
 
 #cmakedefine DEAL_II_DEPRECATED @DEAL_II_DEPRECATED@
index 6695379d2ccba5b9530d0efabb64c34a47bf3f95..bf0f8e93badb8c50779440f524d7c0928e8d53a8 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <deal.II/base/config.h>
 
-#ifdef DEAL_II_HAVE_CXX17
+#ifdef DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS
 #  include <cmath>
 #else
 #  include <boost/math/special_functions/bessel.hpp>
@@ -27,7 +27,7 @@
 DEAL_II_NAMESPACE_OPEN
 namespace std_cxx17
 {
-#ifndef DEAL_II_HAVE_CXX17
+#ifndef DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS
   double (&cyl_bessel_j)(double,
                          double) = boost::math::cyl_bessel_j<double, double>;
   float (&cyl_bessel_jf)(float,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.