diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-11-28 21:24:55 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-11-28 21:28:11 +0400 |
commit | b7bca8663ac86fbade802ce4d7c835f45bb98807 (patch) | |
tree | 37593233eb54964fd44f33e19486a7951ed2501a /extern/libmv/third_party/ceres/SConscript | |
parent | 683093b5c8df391eac957cfe0c76c33d46c3503e (diff) |
Made collections port compatible with MSVC2008
The issue was caused by the fact that in this version
of MSVC unordered_map class is defined in <unordered_map>
header file, but this file declares the class int std::tr1
namespace.
This confused existing assumption that if there's an
existing <unordered_map> file then class is declared
in std namespace.
Added an extra check to CMake which detects whether
it's std or std::tr1 which actually contains class
of unordered_map.
This might be changed/cleaned in the future, for
now committing to our repository to solve compilation
error on windows.
Details of the patch in upstream can be found there:
https://ceres-solver-review.googlesource.com/#/c/4371/
Diffstat (limited to 'extern/libmv/third_party/ceres/SConscript')
-rw-r--r-- | extern/libmv/third_party/ceres/SConscript | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/extern/libmv/third_party/ceres/SConscript b/extern/libmv/third_party/ceres/SConscript index e61e979efd2..22960e7b3bd 100644 --- a/extern/libmv/third_party/ceres/SConscript +++ b/extern/libmv/third_party/ceres/SConscript @@ -29,7 +29,14 @@ if env['WITH_BF_OPENMP']: conf = Configure(env) if conf.CheckCXXHeader("unordered_map"): - defs.append('CERES_STD_UNORDERED_MAP') + if conf.CheckType('std::unordered_map<int, int>', language = 'CXX', includes="#include <unordered_map>"): + defs.append('CERES_STD_UNORDERED_MAP') + elif conf.CheckType('std::tr1::unordered_map<int, int>', language = 'CXX', includes="#include <unordered_map>"): + defs.append('CERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE') + else: + print("-- Found <unordered_map> but can not find neither std::unordered_map nor std::tr1::unordered_map.") + print("-- Replacing unordered_map/set with map/set (warning: slower!)") + defs.append('CERES_NO_UNORDERED_MAP') elif conf.CheckCXXHeader("tr1/unordered_map"): defs.append('CERES_TR1_UNORDERED_MAP') else: |