CMake: De-duplicate checks around unordered maps and shared pointer
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Jan 2016 07:38:46 +0000 (12:38 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Jan 2016 07:38:46 +0000 (12:38 +0500)
Previously several areas were calling TEST_SHARED_PTR_SUPPORT and
TEST_UNORDERED_MAP_SUPPORT which isn't that bad on it's own but
was causing some quite verbose output with same information line
printed multiple times. additionally, what's more worse, define flags
for Ceres were duplicated in main CMakeLists and Ceres's CMakeLists.

Now we've got a single place where checks for those classes are
happening and other areas are simply checking for variables set by
those check macros, keeping CMake output clean and nice.

CMakeLists.txt
extern/ceres/CMakeLists.txt
intern/cycles/CMakeLists.txt
source/blender/depsgraph/CMakeLists.txt

index 73d219e0e1c113719b5b950dc23103026dd28325..e91f4b503a23b51d88eac6c001c41c4d4239e23f 100644 (file)
@@ -731,6 +731,9 @@ if(HAVE_STDBOOL_H)
        add_definitions(-DHAVE_STDBOOL_H)
 endif()
 
        add_definitions(-DHAVE_STDBOOL_H)
 endif()
 
+TEST_SHARED_PTR_SUPPORT()
+TEST_UNORDERED_MAP_SUPPORT()
+
 if(WITH_AUDASPACE)
        if(WITH_SYSTEM_AUDASPACE)
                set(AUDASPACE_DEFINITIONS
 if(WITH_AUDASPACE)
        if(WITH_SYSTEM_AUDASPACE)
                set(AUDASPACE_DEFINITIONS
@@ -2604,7 +2607,6 @@ endif()
 if(WITH_LIBMV)
        set(CERES_DEFINES)
 
 if(WITH_LIBMV)
        set(CERES_DEFINES)
 
-       TEST_SHARED_PTR_SUPPORT()
        if(SHARED_PTR_FOUND)
                if(SHARED_PTR_TR1_MEMORY_HEADER)
                        list(APPEND CERES_DEFINES -DCERES_TR1_MEMORY_HEADER)
        if(SHARED_PTR_FOUND)
                if(SHARED_PTR_TR1_MEMORY_HEADER)
                        list(APPEND CERES_DEFINES -DCERES_TR1_MEMORY_HEADER)
@@ -2616,7 +2618,6 @@ if(WITH_LIBMV)
                message(FATAL_ERROR "Ceres: Unable to find shared_ptr.")
        endif()
 
                message(FATAL_ERROR "Ceres: Unable to find shared_ptr.")
        endif()
 
-       TEST_UNORDERED_MAP_SUPPORT()
        if(HAVE_STD_UNORDERED_MAP_HEADER)
                if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
                        list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
        if(HAVE_STD_UNORDERED_MAP_HEADER)
                if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
                        list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
index 711b2ef69f2a36561f113c37d85057b7e619601a..2ad8c5430885a600458428ca3ba3f14943e71073 100644 (file)
@@ -326,25 +326,4 @@ if(WITH_OPENMP)
        )
 endif()
 
        )
 endif()
 
-TEST_UNORDERED_MAP_SUPPORT()
-if(HAVE_STD_UNORDERED_MAP_HEADER)
-       if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
-               add_definitions(-DCERES_STD_UNORDERED_MAP)
-       else()
-               if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
-                       add_definitions(-DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
-               else()
-                       add_definitions(-DCERES_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(-DCERES_TR1_UNORDERED_MAP)
-       else()
-               add_definitions(-DCERES_NO_UNORDERED_MAP)
-               message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
-       endif()
-endif()
-
 blender_add_lib(extern_ceres "${SRC}" "${INC}" "${INC_SYS}")
 blender_add_lib(extern_ceres "${SRC}" "${INC}" "${INC_SYS}")
index 3df9a670f7dd85e09a98d4e4bcdab5a425fd7a58..c118f4cd015fdf2d00bb5252e9dc88fbbc1d210d 100644 (file)
@@ -157,7 +157,9 @@ add_definitions(
        -DWITH_MULTI
 )
 
        -DWITH_MULTI
 )
 
-TEST_UNORDERED_MAP_SUPPORT()
+if(CYCLES_STANDALONE_REPOSITORY)
+       TEST_UNORDERED_MAP_SUPPORT()
+endif()
 if(HAVE_STD_UNORDERED_MAP_HEADER)
        if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
                add_definitions(-DCYCLES_STD_UNORDERED_MAP)
 if(HAVE_STD_UNORDERED_MAP_HEADER)
        if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
                add_definitions(-DCYCLES_STD_UNORDERED_MAP)
index f3ff709e98b1703295f5f69fd503f5fd07cb2257..e1dc8b020fbdee95eb85acc15a7552c556a32329 100644 (file)
@@ -83,7 +83,6 @@ set(SRC
        util/depsgraph_util_transitive.h
 )
 
        util/depsgraph_util_transitive.h
 )
 
-TEST_UNORDERED_MAP_SUPPORT()
 if(HAVE_STD_UNORDERED_MAP_HEADER)
        if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
                add_definitions(-DDEG_STD_UNORDERED_MAP)
 if(HAVE_STD_UNORDERED_MAP_HEADER)
        if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
                add_definitions(-DDEG_STD_UNORDERED_MAP)