diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-25 17:59:46 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-30 18:12:24 +0300 |
commit | 885cc4cf9a1d5c167e4cbd26c3294d8b1ad400d8 (patch) | |
tree | cb7f2b6ef98c6ce346f2378096bc9d32a3e5606e /build_files/cmake | |
parent | b59d85b5a56c020c7b86b0cca4dc38e4950550f9 (diff) |
Build: require C11/C++11 for all operating systems in master.
This is in preparation of upgrading our library dependencies, some of which
need C++11. We already use C++11 in blender2.8 and for Windows and macOS, so
this just affects Linux.
On many distributions this will not require any changes, on some
install_deps.sh will need to be run again to rebuild libraries.
Differential Revision: https://developer.blender.org/D3568
Diffstat (limited to 'build_files/cmake')
-rw-r--r-- | build_files/cmake/macros.cmake | 158 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_apple_xcode.cmake | 2 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_win32.cmake | 3 |
3 files changed, 1 insertions, 162 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 5d5425a9fc6..54a41f95819 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -859,164 +859,6 @@ macro(message_first_run) endif() endmacro() -macro(TEST_UNORDERED_MAP_SUPPORT) - # - Detect unordered_map availability - # Test if a valid implementation of unordered_map exists - # and define the include path - # This module defines - # HAVE_UNORDERED_MAP, whether unordered_map implementation was found - # - # HAVE_STD_UNORDERED_MAP_HEADER, <unordered_map.h> was found - # HAVE_UNORDERED_MAP_IN_STD_NAMESPACE, unordered_map is in namespace std - # HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE, unordered_map is in namespace std::tr1 - # - # UNORDERED_MAP_INCLUDE_PREFIX, include path prefix for unordered_map, if found - # UNORDERED_MAP_NAMESPACE, namespace for unordered_map, if found - - include(CheckIncludeFileCXX) - - # Workaround for newer GCC (6.x+) where C++11 was enabled by default, which lead us - # to a situation when there is <unordered_map> include but which can't be used uless - # C++11 is enabled. - if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11)) - set(HAVE_STD_UNORDERED_MAP_HEADER False) - else() - CHECK_INCLUDE_FILE_CXX("unordered_map" HAVE_STD_UNORDERED_MAP_HEADER) - endif() - if(HAVE_STD_UNORDERED_MAP_HEADER) - # Even so we've found unordered_map header file it doesn't - # mean unordered_map and unordered_set will be declared in - # std namespace. - # - # Namely, MSVC 2008 have unordered_map header which declares - # unordered_map class in std::tr1 namespace. In order to support - # this, we do extra check to see which exactly namespace is - # to be used. - - include(CheckCXXSourceCompiles) - CHECK_CXX_SOURCE_COMPILES("#include <unordered_map> - int main() { - std::unordered_map<int, int> map; - return 0; - }" - HAVE_UNORDERED_MAP_IN_STD_NAMESPACE) - if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE) - message_first_run(STATUS "Found unordered_map/set in std namespace.") - - set(HAVE_UNORDERED_MAP "TRUE") - set(UNORDERED_MAP_INCLUDE_PREFIX "") - set(UNORDERED_MAP_NAMESPACE "std") - else() - CHECK_CXX_SOURCE_COMPILES("#include <unordered_map> - int main() { - std::tr1::unordered_map<int, int> map; - return 0; - }" - HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE) - if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE) - message_first_run(STATUS "Found unordered_map/set in std::tr1 namespace.") - - set(HAVE_UNORDERED_MAP "TRUE") - set(UNORDERED_MAP_INCLUDE_PREFIX "") - set(UNORDERED_MAP_NAMESPACE "std::tr1") - else() - message_first_run(STATUS "Found <unordered_map> but cannot find either std::unordered_map " - "or std::tr1::unordered_map.") - endif() - endif() - else() - CHECK_INCLUDE_FILE_CXX("tr1/unordered_map" HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE) - if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE) - message_first_run(STATUS "Found unordered_map/set in std::tr1 namespace.") - - set(HAVE_UNORDERED_MAP "TRUE") - set(UNORDERED_MAP_INCLUDE_PREFIX "tr1") - set(UNORDERED_MAP_NAMESPACE "std::tr1") - else() - message_first_run(STATUS "Unable to find <unordered_map> or <tr1/unordered_map>. ") - endif() - endif() -endmacro() - -macro(TEST_SHARED_PTR_SUPPORT) - # This check are coming from Ceres library. - # - # Find shared pointer header and namespace. - # - # This module defines the following variables: - # - # SHARED_PTR_FOUND: TRUE if shared_ptr found. - # SHARED_PTR_TR1_MEMORY_HEADER: True if <tr1/memory> header is to be used - # for the shared_ptr object, otherwise use <memory>. - # SHARED_PTR_TR1_NAMESPACE: TRUE if shared_ptr is defined in std::tr1 namespace, - # otherwise it's assumed to be defined in std namespace. - - include(CheckIncludeFileCXX) - include(CheckCXXSourceCompiles) - set(SHARED_PTR_FOUND FALSE) - # Workaround for newer GCC (6.x+) where C++11 was enabled by default, which lead us - # to a situation when there is <unordered_map> include but which can't be used uless - # C++11 is enabled. - if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11)) - set(HAVE_STD_MEMORY_HEADER False) - else() - CHECK_INCLUDE_FILE_CXX(memory HAVE_STD_MEMORY_HEADER) - endif() - if(HAVE_STD_MEMORY_HEADER) - # Finding the memory header doesn't mean that shared_ptr is in std - # namespace. - # - # In particular, MSVC 2008 has shared_ptr declared in std::tr1. In - # order to support this, we do an extra check to see which namespace - # should be used. - CHECK_CXX_SOURCE_COMPILES("#include <memory> - int main() { - std::shared_ptr<int> int_ptr; - return 0; - }" - HAVE_SHARED_PTR_IN_STD_NAMESPACE) - - if(HAVE_SHARED_PTR_IN_STD_NAMESPACE) - message_first_run("-- Found shared_ptr in std namespace using <memory> header.") - set(SHARED_PTR_FOUND TRUE) - else() - CHECK_CXX_SOURCE_COMPILES("#include <memory> - int main() { - std::tr1::shared_ptr<int> int_ptr; - return 0; - }" - HAVE_SHARED_PTR_IN_TR1_NAMESPACE) - if(HAVE_SHARED_PTR_IN_TR1_NAMESPACE) - message_first_run("-- Found shared_ptr in std::tr1 namespace using <memory> header.") - set(SHARED_PTR_TR1_NAMESPACE TRUE) - set(SHARED_PTR_FOUND TRUE) - endif() - endif() - endif() - - if(NOT SHARED_PTR_FOUND) - # Further, gcc defines shared_ptr in std::tr1 namespace and - # <tr1/memory> is to be included for this. And what makes things - # even more tricky is that gcc does have <memory> header, so - # all the checks above wouldn't find shared_ptr. - CHECK_INCLUDE_FILE_CXX("tr1/memory" HAVE_TR1_MEMORY_HEADER) - if(HAVE_TR1_MEMORY_HEADER) - CHECK_CXX_SOURCE_COMPILES("#include <tr1/memory> - int main() { - std::tr1::shared_ptr<int> int_ptr; - return 0; - }" - HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER) - if(HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER) - message_first_run("-- Found shared_ptr in std::tr1 namespace using <tr1/memory> header.") - set(SHARED_PTR_TR1_MEMORY_HEADER TRUE) - set(SHARED_PTR_TR1_NAMESPACE TRUE) - set(SHARED_PTR_FOUND TRUE) - endif() - endif() - endif() -endmacro() - # when we have warnings as errors applied globally this # needs to be removed for some external libs which we dont maintain. diff --git a/build_files/cmake/platform/platform_apple_xcode.cmake b/build_files/cmake/platform/platform_apple_xcode.cmake index 1b8e13a0623..7af69c092cc 100644 --- a/build_files/cmake/platform/platform_apple_xcode.cmake +++ b/build_files/cmake/platform/platform_apple_xcode.cmake @@ -104,7 +104,7 @@ endif() # 10.9 is our min. target, if you use higher sdk, weak linking happens if(CMAKE_OSX_DEPLOYMENT_TARGET) if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.9) - message(STATUS "Setting deployment target to 10.9, lower versions are incompatible with WITH_CXX11") + message(STATUS "Setting deployment target to 10.9, lower versions are not supported") set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "" FORCE) endif() else() diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index df96333e9f1..bfbc8d90859 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -131,9 +131,6 @@ include(InstallRequiredSystemLibraries) remove_cc_flag("/MDd" "/MD") if(MSVC_CLANG) # Clangs version of cl doesn't support all flags - if(NOT WITH_CXX11) # C++11 is on by default in clang-cl and can't be turned off, if c++11 is not enabled in blender repress some c++11 related warnings. - set(CXX_WARN_FLAGS "-Wno-inconsistent-missing-override") - endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference") else() |