blender/extern/libmv/third_party/ceres/SConscript
Sergey Sharybin b7bca8663a 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/
2013-11-28 23:28:11 +06:00

65 lines
2.3 KiB
Python

#!/usr/bin/python
# NOTE: This file is automatically generated by bundle.sh script
# If you're doing changes in this file, please update template
# in that script too
import sys
import os
Import('env')
src = []
defs = []
src += env.Glob('internal/ceres/*.cc')
src += env.Glob('internal/ceres/generated/schur_eliminator_d_d_d.cc')
src += env.Glob('internal/ceres/generated/partitioned_matrix_view_d_d_d.cc')
#src += env.Glob('internal/ceres/generated/*.cc')
defs.append('CERES_HAVE_PTHREAD')
defs.append('CERES_NO_SUITESPARSE')
defs.append('CERES_NO_CXSPARSE')
defs.append('CERES_NO_LAPACK')
defs.append('CERES_RESTRICT_SCHUR_SPECIALIZATION')
defs.append('CERES_HAVE_RWLOCK')
if env['WITH_BF_OPENMP']:
defs.append('CERES_USE_OPENMP')
conf = Configure(env)
if conf.CheckCXXHeader("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:
print("-- Unable to find <unordered_map> or <tr1/unordered_map>. ")
print("-- Replacing unordered_map/set with map/set (warning: slower!)")
defs.append('CERES_NO_UNORDERED_MAP')
env = conf.Finish()
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'
incs += ' ../glog/src/windows'
else:
incs += ' ../glog/src'
env.BlenderLib ( libname = 'extern_ceres', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137])