Build: require C11/C++11 for all operating systems in master.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 25 Jul 2018 14:59:46 +0000 (16:59 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 30 Jul 2018 15:12:24 +0000 (17:12 +0200)
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

20 files changed:
CMakeLists.txt
build_files/build_environment/install_deps.sh
build_files/cmake/macros.cmake
build_files/cmake/platform/platform_apple_xcode.cmake
build_files/cmake/platform/platform_win32.cmake
intern/cycles/CMakeLists.txt
intern/cycles/util/util_defines.h
intern/cycles/util/util_foreach.h
intern/cycles/util/util_function.h
intern/cycles/util/util_map.h
intern/cycles/util/util_set.h
intern/cycles/util/util_static_assert.h
intern/cycles/util/util_thread.cpp
intern/cycles/util/util_thread.h
intern/cycles/util/util_vector.h
source/blender/alembic/intern/abc_customdata.cc
source/blender/blenlib/BLI_compiler_compat.h
source/blender/depsgraph/CMakeLists.txt
source/blender/depsgraph/util/deg_util_foreach.h
source/blender/depsgraph/util/deg_util_function.h

index 7b01890..f643531 100644 (file)
@@ -505,27 +505,6 @@ if(WIN32)
        set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
 endif()
 
-# Experimental support of C11 and C++11
-#
-# We default options to whatever default standard in the current compiler.
-if(APPLE)
-       set(_c11_init ON)
-       set(_cxx11_init ON)
-       set(WITH_C11 ON)
-       set(WITH_CXX11 ON)
-elseif(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11))
-       set(_c11_init ON)
-       set(_cxx11_init ON)
-else()
-       set(_c11_init OFF)
-       set(_cxx11_init OFF)
-endif()
-
-option(WITH_C11 "Build with C11 standard enabled, for development use only!" ${_c11_init})
-mark_as_advanced(WITH_C11)
-option(WITH_CXX11 "Build with C++11 standard enabled, for development use only!" ${_cxx11_init})
-mark_as_advanced(WITH_CXX11)
-
 # Compiler toolchain
 if(CMAKE_COMPILER_IS_GNUCC)
        option(WITH_LINKER_GOLD "Use ld.gold linker which is usually faster than ld.bfd" ON)
@@ -703,11 +682,8 @@ elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL O
        WITH_OPENVDB OR WITH_OPENCOLORIO)
        # Keep enabled
 else()
-       # New dependency graph needs either Boost or C++11 for function bindings.
-       if(NOT WITH_CXX11)
-               # Enabled but we don't need it
-               set(WITH_BOOST OFF)
-       endif()
+       # Disable boost if not needed.
+       set(WITH_BOOST OFF)
 endif()
 
 # auto enable openimageio for cycles
@@ -764,9 +740,6 @@ if(WITH_BUILDINFO)
        endif()
 endif()
 
-TEST_SHARED_PTR_SUPPORT()
-TEST_UNORDERED_MAP_SUPPORT()
-
 if(WITH_AUDASPACE)
        if(WITH_SYSTEM_AUDASPACE)
                set(AUDASPACE_DEFINITIONS
@@ -1362,42 +1335,8 @@ endif()
 # Configure Ceres
 
 if(WITH_LIBMV)
-       set(CERES_DEFINES)
-
-       if(WITH_CXX11)
-               # nothing to be done
-       elseif(SHARED_PTR_FOUND)
-               if(SHARED_PTR_TR1_MEMORY_HEADER)
-                       list(APPEND CERES_DEFINES -DCERES_TR1_MEMORY_HEADER)
-               endif()
-               if(SHARED_PTR_TR1_NAMESPACE)
-                       list(APPEND CERES_DEFINES -DCERES_TR1_SHARED_PTR)
-               endif()
-       else()
-               message(FATAL_ERROR "Ceres: Unable to find shared_ptr.")
-       endif()
-
-       if(WITH_CXX11)
-               list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
-       elseif(HAVE_STD_UNORDERED_MAP_HEADER)
-               if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
-                       list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
-               else()
-                       if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
-                               list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
-                       else()
-                               list(APPEND CERES_DEFINES -DCERES_NO_UNORDERED_MAP)
-                               message(STATUS "Ceres: Replacing unordered_map/set with map/set (warning: slower!)")
-                       endif()
-               endif()
-       else()
-               if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
-                       list(APPEND CERES_DEFINES -DCERES_TR1_UNORDERED_MAP)
-               else()
-                       list(APPEND CERES_DEFINES -DCERES_NO_UNORDERED_MAP)
-                       message(STATUS "Ceres: Replacing unordered_map/set with map/set (warning: slower!)")
-               endif()
-       endif()
+       # We always have C++11 which includes unordered_map.
+       set(CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
 endif()
 
 #-----------------------------------------------------------------------------
@@ -1619,28 +1558,17 @@ if(WITH_PYTHON)
        endif()
 endif()
 
-if(WITH_CXX11)
-       if(
-               CMAKE_COMPILER_IS_GNUCC OR
-               CMAKE_C_COMPILER_ID MATCHES "Clang" OR
-               CMAKE_C_COMPILER_ID MATCHES "Intel"
-       )
-               # TODO(sergey): Do we want c++11 or gnu-c++11 here?
-               set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-       elseif(MSVC)
-               # Nothing special is needed, C++11 features are available by default.
-       else()
-               message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER_ID} is not supported for C++11 build yet")
-       endif()
+if(
+       CMAKE_COMPILER_IS_GNUCC OR
+       CMAKE_C_COMPILER_ID MATCHES "Clang" OR
+       CMAKE_C_COMPILER_ID MATCHES "Intel"
+)
+       # TODO(sergey): Do we want c++11 or gnu-c++11 here?
+       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+elseif(MSVC)
+       # Nothing special is needed, C++11 features are available by default.
 else()
-       # GCC-6 switched to C++11 by default, which would break linking with existing libraries
-       # by default. So we explicitly disable C++11 for a new GCC so no linking issues happens.
-       if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0"))
-               set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98")
-               # We also disable any of C++11 ABI from usage, so we wouldn't even try to
-               # link to stuff from std::__cxx11 namespace.
-               add_definitions("-D_GLIBCXX_USE_CXX11_ABI=0")
-       endif()
+       message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++11 build")
 endif()
 
 # Visual Studio has all standards it supports available by default
index 6cd7254..8d277ac 100755 (executable)
@@ -290,7 +290,7 @@ SUDO="sudo"
 
 NO_BUILD=false
 NO_CONFIRM=false
-USE_CXX11=false
+USE_CXX11=true
 
 PYTHON_VERSION="3.6.2"
 PYTHON_VERSION_MIN="3.6"
@@ -501,9 +501,6 @@ while true; do
     --no-confirm)
       NO_CONFIRM=true; shift; continue
     ;;
-    --use-cxx11)
-      USE_CXX11=true; shift; continue
-    ;;
     --with-all)
       WITH_ALL=true; shift; continue
     ;;
@@ -802,20 +799,10 @@ OPENCOLLADA_REPO_BRANCH="master"
 
 FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
 
+# C++11 is required now
 CXXFLAGS_BACK=$CXXFLAGS
-if [ "$USE_CXX11" = true ]; then
-  WARNING "You are trying to use c++11, this *should* go smoothely with any very recent distribution
-However, if you are experiencing linking errors (also when building Blender itself), please try the following:
-    * Re-run this script with '--build-all --force-all' options.
-    * Ensure your gcc version is at the very least 4.8, if possible you should really rather use gcc-5.1 or above.
-
-Please note that until the transition to C++11-built libraries if completed in your distribution, situation will
-remain fuzzy and incompatibilities may happen..."
-  PRINT ""
-  PRINT ""
-  CXXFLAGS="$CXXFLAGS -std=c++11"
-  export CXXFLAGS
-fi
+CXXFLAGS="$CXXFLAGS -std=c++11"
+export CXXFLAGS
 
 #### Show Dependencies ####
 
@@ -1690,9 +1677,7 @@ compile_OIIO() {
 #    fi
     cmake_d="$cmake_d -D USE_OCIO=OFF"
 
-    if [ "$USE_CXX11" = true ]; then
-      cmake_d="$cmake_d -D OIIO_BUILD_CPP11=ON"
-    fi
+    cmake_d="$cmake_d -D OIIO_BUILD_CPP11=ON"
 
     if file /bin/cp | grep -q '32-bit'; then
       cflags="-fPIC -m32 -march=i686"
@@ -1905,9 +1890,7 @@ compile_OSL() {
     cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
     cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
     cmake_d="$cmake_d -D USE_SIMD=sse2"
-    if [ "$USE_CXX11" = true ]; then
-        cmake_d="$cmake_d -D OSL_BUILD_CPP11=1"
-    fi
+    cmake_d="$cmake_d -D OSL_BUILD_CPP11=1"
 
     #~ cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
 
@@ -2293,12 +2276,6 @@ compile_ALEMBIC() {
 
     cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst"
 
-    # Without Boost or TR1, Alembic requires C++11.
-    if [ "$USE_CXX11" != true ]; then
-      cmake_d="$cmake_d -D ALEMBIC_LIB_USES_BOOST=ON"
-      cmake_d="$cmake_d -D ALEMBIC_LIB_USES_TR1=OFF"
-    fi
-
     if [ -d $INST/boost ]; then
       if [ -d $INST/boost ]; then
         cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
@@ -4235,12 +4212,6 @@ print_info() {
   _buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*"
   _buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC*"
 
-  if [ "$USE_CXX11" = true ]; then
-    _1="-D WITH_CXX11=ON"
-    PRINT "  $_1"
-    _buildargs="$_buildargs $_1"
-  fi
-
   _1="-D WITH_CODEC_SNDFILE=ON"
   PRINT "  $_1"
   _buildargs="$_buildargs $_1"
index 5d5425a..54a41f9 100644 (file)
@@ -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.
 
index 1b8e13a..7af69c0 100644 (file)
@@ -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()
index df96333..bfbc8d9 100644 (file)
@@ -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()
index 0740aa5..00ac8e7 100644 (file)
@@ -224,31 +224,6 @@ endif()
 # TODO(sergey): Consider removing it, only causes confusion in interface.
 set(WITH_CYCLES_DEVICE_MULTI TRUE)
 
-if(CYCLES_STANDALONE_REPOSITORY)
-       TEST_UNORDERED_MAP_SUPPORT()
-endif()
-if(WITH_CXX11)
-       add_definitions(-DCYCLES_STD_UNORDERED_MAP)
-elseif(HAVE_STD_UNORDERED_MAP_HEADER)
-       if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
-               add_definitions(-DCYCLES_STD_UNORDERED_MAP)
-       else()
-               if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
-                       add_definitions(-DCYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
-               else()
-                       add_definitions(-DCYCLES_NO_UNORDERED_MAP)
-                       message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
-               endif()
-       endif()
-else()
-       if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
-               add_definitions(-DCYCLES_TR1_UNORDERED_MAP)
-       else()
-               add_definitions(-DCYCLES_NO_UNORDERED_MAP)
-               message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
-       endif()
-endif()
-
 # Logging capabilities using GLog library.
 if(WITH_CYCLES_LOGGING)
        add_definitions(-DWITH_CYCLES_LOGGING)
index d994d4e..1a09f65 100644 (file)
 #  define UNLIKELY(x)     (x)
 #endif
 
-#if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1800))
-#  define HAS_CPP11_FEATURES
-#endif
-
 #if defined(__GNUC__) || defined(__clang__)
-#  if defined(HAS_CPP11_FEATURES)
 /* Some magic to be sure we don't have reference in the type. */
 template<typename T> static inline T decltype_helper(T x) { return x; }
-#    define TYPEOF(x) decltype(decltype_helper(x))
-#  else
-#    define TYPEOF(x) typeof(x)
-#  endif
+#  define TYPEOF(x) decltype(decltype_helper(x))
 #endif
 
 /* Causes warning:
index 03fcefc..2a74ff0 100644 (file)
 #ifndef __UTIL_FOREACH_H__
 #define __UTIL_FOREACH_H__
 
-/* Use Boost to get nice foreach() loops for STL data structures. */
+/* Nice foreach() loops for STL data structures. */
 
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
-#  define foreach(x, y) for(x : y)
-#else
-#  include <boost/foreach.hpp>
-#  define foreach BOOST_FOREACH
-#endif
+#define foreach(x, y) for(x : y)
 
 #endif /* __UTIL_FOREACH_H__ */
index 958f8b4..f3cc003 100644 (file)
 #ifndef __UTIL_FUNCTION_H__
 #define __UTIL_FUNCTION_H__
 
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
-#  include <functional>
-#else
-#  include <boost/bind.hpp>
-#  include <boost/function.hpp>
-#endif
+#include <functional>
 
 CCL_NAMESPACE_BEGIN
 
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
-#  define function_bind std::bind
-#  define function_null nullptr
+#define function_bind std::bind
+#define function_null nullptr
 using std::function;
 using std::placeholders::_1;
 using std::placeholders::_2;
@@ -39,11 +33,7 @@ using std::placeholders::_6;
 using std::placeholders::_7;
 using std::placeholders::_8;
 using std::placeholders::_9;
-#else
-using boost::function;
-#  define function_bind boost::bind
-#  define function_null NULL
-#endif
+
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_FUNCTION_H__ */
index b3d887f..3c92884 100644 (file)
 #define __UTIL_MAP_H__
 
 #include <map>
-
-#if defined(CYCLES_TR1_UNORDERED_MAP)
-#  include <tr1/unordered_map>
-#endif
-
-#if defined(CYCLES_STD_UNORDERED_MAP) || defined(CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
-#  include <unordered_map>
-#endif
-
-#if !defined(CYCLES_NO_UNORDERED_MAP) && !defined(CYCLES_TR1_UNORDERED_MAP) && \
-       !defined(CYCLES_STD_UNORDERED_MAP) && !defined(CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)  // NOLINT
-#  error One of: CYCLES_NO_UNORDERED_MAP, CYCLES_TR1_UNORDERED_MAP,\
- CYCLES_STD_UNORDERED_MAP, CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE must be defined!  // NOLINT
-#endif
-
+#include <unordered_map>
 
 CCL_NAMESPACE_BEGIN
 
 using std::map;
 using std::pair;
-
-#if defined(CYCLES_NO_UNORDERED_MAP)
-typedef std::map unordered_map;
-#endif
-
-#if defined(CYCLES_TR1_UNORDERED_MAP) || defined(CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
-using std::tr1::unordered_map;
-#endif
-
-#if defined(CYCLES_STD_UNORDERED_MAP)
 using std::unordered_map;
-#endif
 
 CCL_NAMESPACE_END
 
index 1d010e1..298e1f7 100644 (file)
 #define __UTIL_SET_H__
 
 #include <set>
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
-#  include <unordered_set>
-#else
-#  if defined(CYCLES_TR1_UNORDERED_MAP)
-#    include <tr1/unordered_set>
-#  endif
-#  if defined(CYCLES_STD_UNORDERED_MAP) || \
-      defined(CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
-#    include <unordered_set>
-#  endif
-#  if !defined(CYCLES_NO_UNORDERED_MAP) && \
-      !defined(CYCLES_TR1_UNORDERED_MAP) && \
-      !defined(CYCLES_STD_UNORDERED_MAP) && \
-      !defined(CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
-#    error One of: CYCLES_NO_UNORDERED_MAP, CYCLES_TR1_UNORDERED_MAP,\
- CYCLES_STD_UNORDERED_MAP, CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE must be defined!  // NOLINT
-#  endif
-#endif
+#include <unordered_set>
 
 #if defined(_MSC_VER) && (_MSC_VER >= 1900)
 #  include <iterator>
 CCL_NAMESPACE_BEGIN
 
 using std::set;
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
-using std::unordered_set;
-#else
-#  if defined(CYCLES_NO_UNORDERED_MAP)
-typedef std::set unordered_set;
-#  endif
-#  if defined(CYCLES_TR1_UNORDERED_MAP) || defined(CYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
-using std::tr1::unordered_set;
-#  endif
-#  if defined(CYCLES_STD_UNORDERED_MAP)
 using std::unordered_set;
-#  endif
-#endif
+
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_SET_H__ */
index e900492..dc3cb3f 100644 (file)
@@ -22,27 +22,7 @@ CCL_NAMESPACE_BEGIN
 /* TODO(sergey): In theory CUDA might work with own static assert
  * implementation since it's just pure C++.
  */
-#ifndef __KERNEL_GPU__
-#  if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
-/* C++11 has built-in static_assert() */
-#  elif defined(static_assert)
-/* Some platforms might have static_assert() defined even tho their
- * C++ support wouldn't be declared to be C++11.
- */
-#  else  /* C++11 or MSVC2015 */
-template <bool Test> class StaticAssertFailure;
-template <> class StaticAssertFailure<true> {};
-#    define _static_assert_private_glue_impl(A, B) A ## B
-#    define _static_assert_glue(A, B) _static_assert_private_glue_impl(A, B)
-#    ifdef __COUNTER__
-#      define static_assert(condition, message) \
-  enum {_static_assert_glue(q_static_assert_result, __COUNTER__) = sizeof(StaticAssertFailure<!!(condition)>)}  // NOLINT
-#    else  /* __COUNTER__ */
-#      define static_assert(condition, message) \
-  enum {_static_assert_glue(q_static_assert_result, __LINE__) = sizeof(StaticAssertFailure<!!(condition)>)}  // NOLINT
-#    endif  /* __COUNTER__ */
-#  endif  /* C++11 or MSVC2015 */
-#else  /* __KERNEL_GPU__ */
+#ifdef __KERNEL_GPU__
 #  ifndef static_assert
 #    define static_assert(statement, message)
 #  endif
index c66aa48..16a8591 100644 (file)
@@ -26,11 +26,7 @@ thread::thread(function<void(void)> run_cb, int group)
     joined_(false),
        group_(group)
 {
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
        thread_ = std::thread(&thread::run, this);
-#else
-       pthread_create(&pthread_id_, NULL, run, (void*)this);
-#endif
 }
 
 thread::~thread()
@@ -64,7 +60,6 @@ void *thread::run(void *arg)
 bool thread::join()
 {
        joined_ = true;
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
        try {
                thread_.join();
                return true;
@@ -72,9 +67,6 @@ bool thread::join()
        catch (const std::system_error&) {
                return false;
        }
-#else
-       return pthread_join(pthread_id_, NULL) == 0;
-#endif
 }
 
 CCL_NAMESPACE_END
index 77b51d3..f39fcfb 100644 (file)
 #ifndef __UTIL_THREAD_H__
 #define __UTIL_THREAD_H__
 
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
-#  include <thread>
-#  include <mutex>
-#  include <condition_variable>
-#  include <functional>
-#else
-#  include <boost/thread.hpp>
-#  include <pthread.h>
-#endif
+#include <thread>
+#include <mutex>
+#include <condition_variable>
+#include <functional>
 #include <queue>
 
 #ifdef _WIN32
 
 CCL_NAMESPACE_BEGIN
 
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
 typedef std::mutex thread_mutex;
 typedef std::unique_lock<std::mutex> thread_scoped_lock;
 typedef std::condition_variable thread_condition_variable;
-#else
-/* use boost for mutexes */
-typedef boost::mutex thread_mutex;
-typedef boost::mutex::scoped_lock thread_scoped_lock;
-typedef boost::condition_variable thread_condition_variable;
-#endif
 
 /* own pthread based implementation, to avoid boost version conflicts with
  * dynamically loaded blender plugins */
@@ -66,11 +54,7 @@ public:
 
 protected:
        function<void(void)> run_cb_;
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
        std::thread thread_;
-#else
-       pthread_t pthread_id_;
-#endif
        bool joined_;
        int group_;
 };
index 569f503..0b33221 100644 (file)
@@ -59,11 +59,7 @@ public:
 
        void shrink_to_fit(void)
        {
-#if __cplusplus < 201103L
-               vector<value_type>().swap(*this);
-#else
                std::vector<value_type, allocator_type>::shrink_to_fit();
-#endif
        }
 
        void free_memory(void)
index 8754500..f2ae1c8 100644 (file)
 
 #include <Alembic/AbcGeom/All.h>
 #include <algorithm>
-
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1900)
 #include <unordered_map>
-typedef std::unordered_map<uint64_t, int> uv_index_map;
-#else
-#include <map>
-typedef std::map<uint64_t, int> uv_index_map;
-#endif
 
 extern "C" {
 #include "DNA_customdata_types.h"
@@ -60,6 +53,8 @@ using Alembic::AbcGeom::OV2fGeomParam;
 using Alembic::AbcGeom::OC4fGeomParam;
 
 
+typedef std::unordered_map<uint64_t, int> uv_index_map;
+
 static inline uint64_t uv_to_hash_key(Imath::V2f v)
 {
        /* Convert -0.0f to 0.0f, so bitwise comparison works. */
index 0726e3b..2b53975 100644 (file)
 #  define alloca _alloca
 #endif
 
-#if defined(__cplusplus) && ((__cplusplus >= 201103L) || defined(_MSC_VER))
-#  define HAS_CPP11_FEATURES
-#endif
-
-#if (defined(__GNUC__) || defined(__clang__)) && defined(HAS_CPP11_FEATURES)
+#if (defined(__GNUC__) || defined(__clang__)) && defined(__cplusplus)
 extern "C++" {
        /* Some magic to be sure we don't have reference in the type. */
        template<typename T> static inline T decltype_helper(T x) { return x; }
index 50c0910..ced045e 100644 (file)
@@ -100,28 +100,6 @@ set(SRC
        util/deg_util_function.h
 )
 
-if(WITH_CXX11)
-       add_definitions(-DDEG_STD_UNORDERED_MAP)
-elseif(HAVE_STD_UNORDERED_MAP_HEADER)
-       if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
-               add_definitions(-DDEG_STD_UNORDERED_MAP)
-       else()
-               if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
-                       add_definitions(-DDEG_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
-               else()
-                       add_definitions(-DDEG_NO_UNORDERED_MAP)
-                       message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
-               endif()
-       endif()
-else()
-       if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
-               add_definitions(-DDEG_TR1_UNORDERED_MAP)
-       else()
-               add_definitions(-DDEG_NO_UNORDERED_MAP)
-               message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
-       endif()
-endif()
-
 if(WITH_LEGACY_DEPSGRAPH)
        add_definitions(-DWITH_LEGACY_DEPSGRAPH)
 endif()
index cb7361f..5484192 100644 (file)
 
 #pragma once
 
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
-#  define foreach(x, y) for(x : y)
-#elif defined(HAVE_BOOST_FUNCTION_BINDINGS)
-#  include <boost/foreach.hpp>
-#  define foreach BOOST_FOREACH
-#else
-#pragma message("No available foreach() implementation. Using stub instead, disabling new depsgraph")
-
-#ifndef WITH_LEGACY_DEPSGRAPH
-#  error "Unable to build new depsgraph and legacy one is disabled."
-#endif
-
-#define DISABLE_NEW_DEPSGRAPH
-
-#  define foreach(x, y) for (x; false; (void)y)
-#endif
+#define foreach(x, y) for(x : y)
index 38e753c..8863d92 100644 (file)
 
 #pragma once
 
-#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1900)
-
 #include <functional>
 
 using std::function;
 using namespace std::placeholders;
 #define function_bind std::bind
-
-#elif defined(HAVE_BOOST_FUNCTION_BINDINGS)
-
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-
-using boost::function;
-#define function_bind boost::bind
-
-#else
-
-#pragma message("No available function binding implementation. Using stub instead, disabling new depsgraph")
-
-#ifndef WITH_LEGACY_DEPSGRAPH
-#  error "Unable to build new depsgraph and legacy one is disabled."
-#endif
-
-#define DISABLE_NEW_DEPSGRAPH
-
-#include "BLI_utildefines.h"
-#include <cstdlib>
-
-template<typename T>
-class function {
-public:
-       function() {};
-       function(void *) {}
-       operator bool() const { return false; }
-       bool operator== (void *) { return false; }
-
-       template<typename T1>
-       void operator() (T1) {
-               BLI_assert(!"Should not be used");
-       }
-};
-
-class Wrap {
-public:
-       Wrap() {}
-       template <typename T>
-       Wrap(T /*arg*/) {}
-};
-
-template <typename T>
-void *function_bind(T func,
-                    Wrap arg1 = Wrap(),
-                    Wrap arg2 = Wrap(),
-                    Wrap arg3 = Wrap(),
-                    Wrap arg4 = Wrap(),
-                    Wrap arg5 = Wrap(),
-                    Wrap arg6 = Wrap(),
-                    Wrap arg7 = Wrap())
-{
-       BLI_assert(!"Should not be used");
-       (void)func;
-       (void)arg1;
-       (void)arg2;
-       (void)arg3;
-       (void)arg4;
-       (void)arg5;
-       (void)arg6;
-       (void)arg7;
-       return NULL;
-}
-
-#define _1 Wrap()
-#define _2 Wrap()
-#define _3 Wrap()
-#define _4 Wrap()
-
-#endif