From 869e64882773dfa8f05c3fefe64bdb1ee6c44801 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Tue, 15 Oct 2013 10:31:54 +0000 Subject: [PATCH] We indeed need to export TBB_IMPLEMENT_CPP0X=1 more freely. TODO: Is it safe to export TBB_IMPLEMENT_CPP0X for headers used from an external library? git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31237 0785d39b-7218-0410-832d-ea1e28bc413d --- .../tbb41_20130401oss/src/CMakeLists.txt | 7 ------ .../cmake/checks/check_01_cxx_features.cmake | 22 +++++++++---------- .../cmake/configure/configure_1_threads.cmake | 22 ++++++++++++++++++- deal.II/include/deal.II/base/config.h.in | 5 +++++ 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt b/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt index 96711a27e0..6e5c208abe 100644 --- a/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt +++ b/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt @@ -118,10 +118,3 @@ ELSE() DEAL_II_ADD_DEFINITIONS(obj_tbb "DO_ITT_NOTIFY") ENDIF() ENDIF() - -# -# Workaround for clang to compile in C++11 mode: -# -IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - DEAL_II_ADD_DEFINITIONS(obj_tbb "TBB_IMPLEMENT_CPP0X=1") -ENDIF() diff --git a/deal.II/cmake/checks/check_01_cxx_features.cmake b/deal.II/cmake/checks/check_01_cxx_features.cmake index e872415eb3..84a9d178a2 100644 --- a/deal.II/cmake/checks/check_01_cxx_features.cmake +++ b/deal.II/cmake/checks/check_01_cxx_features.cmake @@ -176,17 +176,15 @@ IF(DEAL_II_HAVE_CXX11_FLAG) MESSAGE(STATUS "Insufficient C++11 support. Disabling ${DEAL_II_CXX11_FLAG}.") ENDIF() -# -# Currently unused -# -# IF(DEAL_II_USE_CXX11) -# # -# # Also test for a couple of C++11 things that we don't use in the -# # library but that users may want to use in their applications and that -# # we might want to test in the testsuite -# # -# # TODO: Actually we have to export the test results somehow. :-] -# # + IF(DEAL_II_USE_CXX11) + CHECK_CXX_SOURCE_COMPILES( + " + #include + int main(){ std::is_trivially_copyable bob; } + " + DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE) + +# Currently unused: # # CHECK_CXX_SOURCE_COMPILES( # " @@ -212,7 +210,7 @@ IF(DEAL_II_HAVE_CXX11_FLAG) # SET(DEAL_II_CAN_USE_ADDITIONAL_CXX1X_FEATURES) # ENDIF() # -# ENDIF() + ENDIF() POP_TEST_FLAG() diff --git a/deal.II/cmake/configure/configure_1_threads.cmake b/deal.II/cmake/configure/configure_1_threads.cmake index e6ddef4076..88c0737d5f 100644 --- a/deal.II/cmake/configure/configure_1_threads.cmake +++ b/deal.II/cmake/configure/configure_1_threads.cmake @@ -22,7 +22,7 @@ # -# Set up genereal threading: +# Set up general threading: # The macro will be included in CONFIGURE_FEATURE_THREADS_EXTERNAL/BUNDLED. # MACRO(SETUP_THREADING) @@ -164,6 +164,16 @@ MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL) ENDIF() + # + # Workaround for an issue with C++11 mode, non gcc-compilers and missing + # template std::ist_trivially_copyable + # + IF( DEAL_II_USE_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") + ENDIF() + SETUP_THREADING() ENDMACRO() @@ -190,6 +200,16 @@ MACRO(FEATURE_THREADS_CONFIGURE_BUNDLED) ) ENDIF() + # + # Workaround for an issue with C++11 mode, non gcc-compilers and missing + # template std::ist_trivially_copyable + # + IF( DEAL_II_USE_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") + ENDIF() + # # tbb uses dlopen/dlclose, so link against libdl.so as well: # diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index d033635bfd..8c5dba2a0d 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -121,6 +121,11 @@ # define DEAL_II_CAN_USE_CXX1X #endif +/* Defined if C++11 is enabled and the standard library supports + * template std::is_trivially_copyable + */ +#cmakedefine DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE + /* Defined if isnan is available */ #cmakedefine HAVE_ISNAN -- 2.39.5