From: Matthias Maier Date: Mon, 25 May 2020 04:27:46 +0000 (-0500) Subject: CMake: Refactor C++17 bessel function support into separate check X-Git-Tag: v9.3.0-rc1~1562^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cb449cd84e062abcdb7714a067265a035dbd1ea;p=dealii.git CMake: Refactor C++17 bessel function support into separate check --- diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index eaa9ab20fa..4682bbb23c 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -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 #include #include #include @@ -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 + 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. # diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 836539c207..92b30760aa 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -137,6 +137,7 @@ #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@ diff --git a/include/deal.II/base/std_cxx17/cmath.h b/include/deal.II/base/std_cxx17/cmath.h index 6695379d2c..bf0f8e93ba 100644 --- a/include/deal.II/base/std_cxx17/cmath.h +++ b/include/deal.II/base/std_cxx17/cmath.h @@ -17,7 +17,7 @@ #include -#ifdef DEAL_II_HAVE_CXX17 +#ifdef DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS # include #else # include @@ -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; float (&cyl_bessel_jf)(float,