Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-03-25 12:21:30 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-03-25 12:25:00 +0400
commitbbfcb0b1e44636b73b8c46f1cb800fa53dda5277 (patch)
treeb24ce4191d24a44ae420870b0c2a3667d118f6ca /extern/libmv/third_party/ceres/CMakeLists.txt
parent6452d9f02f07fb3aaa7c6601228ef96015a54996 (diff)
Build file macro for testing unordered_map C++ container support.
Using unordered_map and unordered_set C++ container types currently requires careful testing or usage of boost, due to the various confusing C++ version differences in include paths and namespaces. Libmv defines tests for these cases in cmake and scons, such that ceres can use any available implementation, or fall back too std::map/std::set if none can be found. This patch generalizes this buildfile code by providing a Blender macro. * cmake: defines both the variables used by libmv at them moment as well as 2 variables UNORDERED_MAP_INCLUDE_PREFIX and UNORDERED_MAP_NAMESPACE, which can later be used in other C++ parts for convenience. * scons: adds a tool script returning the include prefix and namespace. Libmv checks these to define the appropriate definitions for ceres. Differential Revision: https://developer.blender.org/D425
Diffstat (limited to 'extern/libmv/third_party/ceres/CMakeLists.txt')
-rw-r--r--extern/libmv/third_party/ceres/CMakeLists.txt47
1 files changed, 7 insertions, 40 deletions
diff --git a/extern/libmv/third_party/ceres/CMakeLists.txt b/extern/libmv/third_party/ceres/CMakeLists.txt
index 7fd86b69dcf..baa619f930c 100644
--- a/extern/libmv/third_party/ceres/CMakeLists.txt
+++ b/extern/libmv/third_party/ceres/CMakeLists.txt
@@ -309,58 +309,25 @@ if(WITH_OPENMP)
)
endif()
-include(CheckIncludeFileCXX)
-CHECK_INCLUDE_FILE_CXX(unordered_map HAVE_STD_UNORDERED_MAP_HEADER)
+TEST_UNORDERED_MAP_SUPPORT()
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_UNURDERED_MAP_IN_STD_NAMESPACE)
- if(HAVE_UNURDERED_MAP_IN_STD_NAMESPACE)
+ if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
add_definitions(-DCERES_STD_UNORDERED_MAP)
- message(STATUS "Found unordered_map/set in std namespace.")
else()
- CHECK_CXX_SOURCE_COMPILES("#include <unordered_map>
- int main() {
- std::tr1::unordered_map<int, int> map;
- return 0;
- }"
- HAVE_UNURDERED_MAP_IN_TR1_NAMESPACE)
- if(HAVE_UNURDERED_MAP_IN_TR1_NAMESPACE)
+ if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
- message(STATUS "Found unordered_map/set in std::tr1 namespace.")
else()
- message(STATUS "Found <unordered_map> but cannot find either std::unordered_map "
- "or std::tr1::unordered_map.")
- message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
add_definitions(-DCERES_NO_UNORDERED_MAP)
+ message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
else()
- CHECK_INCLUDE_FILE_CXX("tr1/unordered_map" UNORDERED_MAP_IN_TR1_NAMESPACE)
- if(UNORDERED_MAP_IN_TR1_NAMESPACE)
- add_definitions(-DCERES_TR1_UNORDERED_MAP)
- message(STATUS "Found unordered_map/set in std::tr1 namespace.")
+ if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
+ add_definitions(-DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
else()
- message(STATUS "Unable to find <unordered_map> or <tr1/unordered_map>. ")
- message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
add_definitions(-DCERES_NO_UNORDERED_MAP)
+ message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
-unset(HAVE_UNURDERED_MAP_IN_TR1_NAMESPACE)
-unset(HAVE_STD_UNORDERED_MAP_HEADER)
-
blender_add_lib(extern_ceres "${SRC}" "${INC}" "${INC_SYS}")