From 8721c56f8cc18f6cffdbbd0512d915a50c7c9e3b Mon Sep 17 00:00:00 2001 From: maier Date: Mon, 23 Dec 2013 10:00:14 +0000 Subject: [PATCH] CMake: Bugfix: Also change DEAL_II_USE_CXX11 to DEAL_II_WITH_CXX11 in cmake files and in the bundled folder git-svn-id: https://svn.dealii.org/trunk@32098 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/bundled/CMakeLists.txt | 2 +- .../boost/signals2/detail/foreign_ptr.hpp | 4 +- .../cmake/checks/check_01_cxx_features.cmake | 80 ++++++++++++++++- .../cmake/checks/check_03_compiler_bugs.cmake | 90 ------------------- .../cmake/configure/configure_1_threads.cmake | 4 +- .../configure/configure_2_trilinos.cmake | 2 +- 6 files changed, 82 insertions(+), 100 deletions(-) diff --git a/deal.II/bundled/CMakeLists.txt b/deal.II/bundled/CMakeLists.txt index f1ab6bc839..9e82ec672a 100644 --- a/deal.II/bundled/CMakeLists.txt +++ b/deal.II/bundled/CMakeLists.txt @@ -38,7 +38,7 @@ IF(FEATURE_BOOST_BUNDLED_CONFIGURED) ADD_SUBDIRECTORY(${BOOST_FOLDER}/libs/iostreams/src) ENDIF() - IF(DEAL_II_WITH_THREADS AND NOT DEAL_II_USE_CXX11) + IF(DEAL_II_WITH_THREADS AND NOT DEAL_II_WITH_CXX11) ADD_SUBDIRECTORY(${BOOST_FOLDER}/libs/thread/src) ENDIF() ENDIF() diff --git a/deal.II/bundled/boost-1.49.0/include/boost/signals2/detail/foreign_ptr.hpp b/deal.II/bundled/boost-1.49.0/include/boost/signals2/detail/foreign_ptr.hpp index a6ad99cae4..1f60f10b94 100644 --- a/deal.II/bundled/boost-1.49.0/include/boost/signals2/detail/foreign_ptr.hpp +++ b/deal.II/bundled/boost-1.49.0/include/boost/signals2/detail/foreign_ptr.hpp @@ -39,7 +39,7 @@ namespace boost // should only be used by deal.II and dependent projects... // // - Maier, 2013 -#ifdef DEAL_II_USE_CXX11 +#ifdef DEAL_II_WITH_CXX11 template struct weak_ptr_traits > { typedef std::shared_ptr shared_type; @@ -54,7 +54,7 @@ namespace boost typedef boost::weak_ptr weak_type; }; // as above -#ifdef DEAL_II_USE_CXX11 +#ifdef DEAL_II_WITH_CXX11 template struct shared_ptr_traits > { typedef std::weak_ptr weak_type; diff --git a/deal.II/cmake/checks/check_01_cxx_features.cmake b/deal.II/cmake/checks/check_01_cxx_features.cmake index c5024e098a..fa1540fae4 100644 --- a/deal.II/cmake/checks/check_01_cxx_features.cmake +++ b/deal.II/cmake/checks/check_01_cxx_features.cmake @@ -143,6 +143,75 @@ IF(NOT DEFINED DEAL_II_WITH_CXX11 OR DEAL_II_WITH_CXX11) " DEAL_II_HAVE_CXX11_TYPE_TRAITS) + # + # On Mac OS-X 10.9 with recent gcc compilers in C++11 mode linking to + # some standard C library functions, notably toupper and tolower, fail + # due to unresolved references to this functions. + # + # Thanks to Denis Davydov for the testcase. + # + # Matthias Maier, 2013 + # + CHECK_CXX_SOURCE_COMPILES( + " + #include + int main () + { + char c = toupper('a'); + } + " + DEAL_II_HAVE_CXX11_MACOSXC99BUG_OK) + + + # + # icc-13 triggers an internal compiler error when compiling + # std::numeric_limits<...>::min() with -std=c++0x [1]. + # + # Reported by Ted Kord. + # + # - Matthias Maier, 2013 + # + # [1] http://software.intel.com/en-us/forums/topic/328902 + # + CHECK_CXX_SOURCE_COMPILES( + " + #include + struct Integer + { + static const int min_int_value; + static const int max_int_value; + }; + const int Integer::min_int_value = std::numeric_limits::min(); + const int Integer::max_int_value = std::numeric_limits::max(); + int main() { return 0; } + " + DEAL_II_HAVE_CXX11_ICCNUMERICLIMITSBUG_OK) + + # + # icc-14.0.0 has an astonishing bug [1] where it hits an internal compiler + # error when run in C++11 mode with libstdc++-4.7 (from gcc). + # + # We just disable C++11 mode in this case + # + # [1] http://software.intel.com/en-us/forums/topic/472385 + # + # - Matthias Maier, 2013 + # + CHECK_CXX_SOURCE_COMPILES( + " + #include + template void foo() + { + std::vector data(100); + } + int main() + { + foo(); + } + " + DEAL_II_HAVE_CXX11_ICCLIBSTDCPP47CXX11BUG_OK) + + IF( DEAL_II_HAVE_CXX11_ARRAY AND DEAL_II_HAVE_CXX11_CONDITION_VARIABLE AND DEAL_II_HAVE_CXX11_FUNCTIONAL AND @@ -151,8 +220,11 @@ IF(NOT DEFINED DEAL_II_WITH_CXX11 OR DEAL_II_WITH_CXX11) DEAL_II_HAVE_CXX11_THREAD AND DEAL_II_HAVE_CXX11_MUTEX AND DEAL_II_HAVE_CXX11_TUPLE AND - DEAL_II_HAVE_CXX11_TYPE_TRAITS ) - SET(DEAL_II_HAVE_CXX11 TRUE) + DEAL_II_HAVE_CXX11_TYPE_TRAITS AND + DEAL_II_HAVE_CXX11_MACOSXC99BUG_OK AND + DEAL_II_HAVE_CXX11_ICCNUMERICLIMITSBUG_OK AND + DEAL_II_HAVE_CXX11_ICCLIBSTDCPP47CXX11BUG_OK ) + SET(DEAL_II_HAVE_CXX11 TRUE) ENDIF() RESET_CMAKE_REQUIRED() @@ -174,8 +246,8 @@ OPTION(DEAL_II_WITH_CXX11 IF(DEAL_II_WITH_CXX11 AND NOT DEAL_II_HAVE_CXX11) MESSAGE(FATAL_ERROR "\n" - "C++11 support was requested (DEAL_II_WITH_CXX11=TRUE) but is not - supported by the current compiler.\n" + "C++11 support was requested (DEAL_II_WITH_CXX11=TRUE) but is not " + "supported by the current compiler.\n" "Please disable C++11 support, i.e. configure with\n" " -DDEAL_II_WITH_CXX11=FALSE,\n" "or use a different compiler, instead. (If the compiler flag for C++11 " diff --git a/deal.II/cmake/checks/check_03_compiler_bugs.cmake b/deal.II/cmake/checks/check_03_compiler_bugs.cmake index ea8d16f293..364bad027e 100644 --- a/deal.II/cmake/checks/check_03_compiler_bugs.cmake +++ b/deal.II/cmake/checks/check_03_compiler_bugs.cmake @@ -289,67 +289,6 @@ IF(DEAL_II_HAVE_BUNDLED_DIRECTORY) ENDIF() -# -# icc-13 triggers an internal compiler error when compiling -# std::numeric_limits<...>::min() with -std=c++0x [1]. -# Just disable C++11 support completely in this case. -# -# Reported by Ted Kord. -# -# - Matthias Maier, 2013 -# -# [1] http://software.intel.com/en-us/forums/topic/328902 -# -CHECK_CXX_COMPILER_BUG( - " - #include - struct Integer - { - static const int min_int_value; - static const int max_int_value; - }; - const int Integer::min_int_value = std::numeric_limits::min(); - const int Integer::max_int_value = std::numeric_limits::max(); - int main() { return 0; } - " - DEAL_II_ICC_NUMERICLIMITS_BUG) - -# -# icc-14.0.0 has an astonishing bug [1] where it hits an internal compiler -# error when run in C++11 mode with libstdc++-4.7 (from gcc). -# -# We just disable C++11 mode in this case -# -# [1] http://software.intel.com/en-us/forums/topic/472385 -# -# - Matthias Maier, 2013 -# -CHECK_CXX_COMPILER_BUG( - " - #include - template void foo() - { - std::vector data(100); - } - int main() - { - foo(); - } - " - DEAL_II_ICC_LIBSTDCPP47CXX11_BUG) - - -IF( DEAL_II_ICC_NUMERICLIMITS_BUG OR - DEAL_II_ICC_LIBSTDCPP47CXX11_BUG ) - MESSAGE(STATUS - "Intel C++11 bug found, disabling C++11 support" - ) - STRIP_FLAG(DEAL_II_CXX_FLAGS "${DEAL_II_CXX11_FLAG}") - SET(DEAL_II_CAN_USE_CXX1X FALSE) - SET(DEAL_II_USE_CXX11 FALSE) -ENDIF() - - # # in intel (at least 13.1 and 14), vectorization causes # wrong code. See https://code.google.com/p/dealii/issues/detail?id=156 @@ -377,32 +316,3 @@ IF( CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "Windows" ) SET(DEAL_II_CONSTEXPR_BUG TRUE) ENDIF() - -# -# On Mac OS-X 10.9 with recent gcc compilers in C++11 mode linking to some -# standard C library functions, notably toupper and tolower, fail due to -# unresolved references to this functions. Disable C++11 support in this -# case. -# -# Thanks to Denis Davydov for the testcase. -# -# Matthias Maier, 2013 -# -CHECK_CXX_COMPILER_BUG( - " - #include - int main () - { - char c = toupper('a'); - } - " - DEAL_II_MAC_OSX_C99_BUG) - -IF(DEAL_II_MAC_OSX_C99_BUG) - MESSAGE(STATUS - "Mac OS-X C99 bug found, disabling C++11 support" - ) - STRIP_FLAG(DEAL_II_CXX_FLAGS "${DEAL_II_CXX11_FLAG}") - SET(DEAL_II_CAN_USE_CXX1X FALSE) - SET(DEAL_II_USE_CXX11 FALSE) -ENDIF() diff --git a/deal.II/cmake/configure/configure_1_threads.cmake b/deal.II/cmake/configure/configure_1_threads.cmake index 182f7d3bc8..edd2b4cd20 100644 --- a/deal.II/cmake/configure/configure_1_threads.cmake +++ b/deal.II/cmake/configure/configure_1_threads.cmake @@ -165,7 +165,7 @@ MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL) # Workaround for an issue with C++11 mode, non gcc-compilers and missing # template std::ist_trivially_copyable # - IF( DEAL_II_USE_CXX11 AND + IF( DEAL_II_WITH_CXX11 AND NOT DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE AND NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU" ) LIST(APPEND DEAL_II_DEFINITIONS "TBB_IMPLEMENT_CPP0X=1") @@ -200,7 +200,7 @@ MACRO(FEATURE_THREADS_CONFIGURE_BUNDLED) # Workaround for an issue with C++11 mode, non gcc-compilers and missing # template std::ist_trivially_copyable # - IF( DEAL_II_USE_CXX11 AND + IF( DEAL_II_WITH_CXX11 AND NOT DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE AND NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU" ) LIST(APPEND DEAL_II_DEFINITIONS "TBB_IMPLEMENT_CPP0X=1") diff --git a/deal.II/cmake/configure/configure_2_trilinos.cmake b/deal.II/cmake/configure/configure_2_trilinos.cmake index d76b3cbf20..e04bbfac41 100644 --- a/deal.II/cmake/configure/configure_2_trilinos.cmake +++ b/deal.II/cmake/configure/configure_2_trilinos.cmake @@ -160,7 +160,7 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) # with the -std=c++0x flag of GCC, see deal.II FAQ. # Test whether that is indeed the case # - IF(DEAL_II_USE_CXX11 AND NOT TRILINOS_SUPPORTS_CPP11) + IF(DEAL_II_WITH_CXX11 AND NOT TRILINOS_SUPPORTS_CPP11) IF(TRILINOS_HAS_C99_TR1_WORKAROUND) LIST(APPEND DEAL_II_DEFINITIONS "HAS_C99_TR1_CMATH") -- 2.39.5