Fix C++11 build issues on OS X, remove references to outdated libs.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 16 May 2016 18:03:59 +0000 (20:03 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 17 May 2016 19:39:16 +0000 (21:39 +0200)
CMakeLists.txt
intern/cycles/CMakeLists.txt
intern/cycles/bvh/bvh_build.cpp
source/blender/depsgraph/CMakeLists.txt

index af457de21fac59d2faf4029ed2b847974c4122a7..32c67ba313427a36f3a1c2040673b5f4e2c30162 100644 (file)
@@ -592,8 +592,6 @@ if(APPLE)
                set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
                add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
        endif()
-
-       option(WITH_LIBS10.5  "Use 10.5 libs (needed for 64bit builds)" OFF)
 endif()
 
 
@@ -1954,20 +1952,8 @@ elseif(WIN32)
 
 elseif(APPLE)
 
-       if(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5" OR ${CMAKE_OSX_DEPLOYMENT_TARGET} STRGREATER "10.5")
-               set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE) # valid also for 10.6/7/8/9
-       endif()
-
        if(NOT DEFINED LIBDIR)
-               if(WITH_LIBS10.5)
-                       set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
-               else()
-                       if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
-                               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
-                       else()
-                               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.0.0-powerpc)
-                       endif()
-               endif()
+               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
        else()
                message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
        endif()
@@ -2082,9 +2068,7 @@ elseif(APPLE)
        )
        mark_as_advanced(SYSTEMSTUBS_LIBRARY)
        if(SYSTEMSTUBS_LIBRARY)
-               list(APPEND PLATFORM_LINKLIBS stdc++ SystemStubs)
-       else()
-               list(APPEND PLATFORM_LINKLIBS stdc++)
+               list(APPEND PLATFORM_LINKLIBS SystemStubs)
        endif()
 
        set(PLATFORM_CFLAGS "-pipe -funsigned-char")
@@ -2097,6 +2081,12 @@ elseif(APPLE)
                endif()
        endif()
 
+       if(WITH_CXX11)
+               list(APPEND PLATFORM_LINKLIBS c++)
+       else()
+               list(APPEND PLATFORM_LINKLIBS stdc++)
+       endif()
+
        # XXX - SOME MAC DEV PLEASE TEST WITH THE SDK INSTALLED!
        # ALSO SHOULD BE MOVED INTO OWN MODULE WHEN FUNCTIONAL
        if(WITH_INPUT_NDOF)
@@ -2324,6 +2314,11 @@ elseif(APPLE)
        # Get rid of eventually clashes, we export some symbols explicite as local
        set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker ${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map")
 
+       if(WITH_CXX11)
+               set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
+               set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")
+       endif()
+
        # Suppress ranlib "has no symbols" warnings (workaround for T48250)
        set(CMAKE_C_ARCHIVE_CREATE   "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
        set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
@@ -2682,7 +2677,9 @@ endif()
 if(WITH_LIBMV)
        set(CERES_DEFINES)
 
-       if(SHARED_PTR_FOUND)
+       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()
@@ -2693,7 +2690,9 @@ if(WITH_LIBMV)
                message(FATAL_ERROR "Ceres: Unable to find shared_ptr.")
        endif()
 
-       if(HAVE_STD_UNORDERED_MAP_HEADER)
+       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()
index 3b6c25c370e597121dd57601909dd2dcb93745d5..efc36f0e6b8f6dfc4a046e0d10e32b1b2f4d8140 100644 (file)
@@ -153,7 +153,9 @@ set(WITH_CYCLES_DEVICE_MULTI TRUE)
 if(CYCLES_STANDALONE_REPOSITORY)
        TEST_UNORDERED_MAP_SUPPORT()
 endif()
-if(HAVE_STD_UNORDERED_MAP_HEADER)
+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()
index 63edbc9998f0dcfdd448228b18132c1dec2068fe..6af4d25eefc0f5bbabe6853c2f50e0b368a76f1a 100644 (file)
@@ -607,8 +607,10 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
        vector<int, LeafStackAllocator> p_type[PRIMITIVE_NUM_TOTAL];
        vector<int, LeafStackAllocator> p_index[PRIMITIVE_NUM_TOTAL];
        vector<int, LeafStackAllocator> p_object[PRIMITIVE_NUM_TOTAL];
+
        /* TODO(sergey): In theory we should be able to store references. */
-       vector<BVHReference, LeafStackAllocator> object_references;
+       typedef StackAllocator<256, BVHReference> LeafReferenceStackAllocator;
+       vector<BVHReference, LeafReferenceStackAllocator> object_references;
 
        uint visibility[PRIMITIVE_NUM_TOTAL] = {0};
        /* NOTE: Keep initializtion in sync with actual number of primitives. */
index e1dc8b020fbdee95eb85acc15a7552c556a32329..2b4df85f29c82a492b1ea25c77928a76e5d7fbc2 100644 (file)
@@ -83,7 +83,9 @@ set(SRC
        util/depsgraph_util_transitive.h
 )
 
-if(HAVE_STD_UNORDERED_MAP_HEADER)
+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()