diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-09-11 15:54:10 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-09-11 15:54:10 +0400 |
commit | becd442a36d949b7e678b4f44445ada9f4880b85 (patch) | |
tree | 34a3dc155988e9d2423a604337d40d034ac9a229 /extern | |
parent | 31ed71cb6b86278eb5c15de65eb8e2ed800821e1 (diff) |
Fix libmv build on OS X with 10.5 SDK. The tr1::unordered_map implementation
is broken in this SDK, now it uses the boost implementation instead.
Diffstat (limited to 'extern')
-rw-r--r-- | extern/libmv/third_party/ceres/SConscript | 5 | ||||
-rw-r--r-- | extern/libmv/third_party/ceres/internal/ceres/collections_port.h | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/extern/libmv/third_party/ceres/SConscript b/extern/libmv/third_party/ceres/SConscript index 6b5f1b8d64d..c629fa00176 100644 --- a/extern/libmv/third_party/ceres/SConscript +++ b/extern/libmv/third_party/ceres/SConscript @@ -25,6 +25,11 @@ defs.append('CERES_RESTRICT_SCHUR_SPECIALIZATION') incs = '. ../../ ../../../Eigen3 ./include ./internal ../gflags' +# work around broken hashtable in 10.5 SDK +if env['OURPLATFORM'] == 'darwin' and env['WITH_BF_BOOST']: + incs += ' ' + env['BF_BOOST_INC'] + defs.append('CERES_HASH_BOOST') + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): incs += ' ../msinttypes' diff --git a/extern/libmv/third_party/ceres/internal/ceres/collections_port.h b/extern/libmv/third_party/ceres/internal/ceres/collections_port.h index 6f8a830a85e..9dff0efe245 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/collections_port.h +++ b/extern/libmv/third_party/ceres/internal/ceres/collections_port.h @@ -33,6 +33,10 @@ #ifndef CERES_INTERNAL_COLLECTIONS_PORT_H_ #define CERES_INTERNAL_COLLECTIONS_PORT_H_ +#ifdef CERES_HASH_BOOST +#include <boost/tr1/unordered_map.hpp> +#include <boost/tr1/unordered_set.hpp> +#else #if defined(_MSC_VER) && _MSC_VER <= 1700 #include <unordered_map> #include <unordered_set> @@ -40,6 +44,8 @@ #include <tr1/unordered_map> #include <tr1/unordered_set> #endif +#endif + #include <utility> #include "ceres/integral_types.h" #include "ceres/internal/port.h" @@ -118,7 +124,11 @@ CERES_HASH_NAMESPACE_START // Hasher for STL pairs. Requires hashers for both members to be defined. template<typename T> +#ifdef CERES_HASH_BOOST +struct hash { +#else struct hash<pair<T, T> > { +#endif size_t operator()(const pair<T, T>& p) const { size_t h1 = hash<T>()(p.first); size_t h2 = hash<T>()(p.second); |