Camera tracking integration
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 15 Jul 2011 16:50:12 +0000 (16:50 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 15 Jul 2011 16:50:12 +0000 (16:50 +0000)
===========================

Fix for camera solver on windows.

There were two problems:
- Static align in Eigen should be also disabled for libmv.
- SSBA doesn't work correct for windows when optimization is
  turned on.

There's no other way rather than disable optimization for
the whole extern/libmv. This leads to 3-4x slowdown, but it's
really the only thing we could do now.

Keir is going to drop SSBA out and replace it with Bundler,
so it shouldn't be a major problem.

extern/libmv/CMakeLists.txt
extern/libmv/SConscript
extern/libmv/bundle.sh

index 2e67e70a2e7c0b43606a5b033c32734cf2febdeb..f63b4e41102f9537bc79dc7268bed7899a03b002 100644 (file)
@@ -151,6 +151,16 @@ IF(WIN32)
                ./third_party/glog/src/windows
                ./third_party/msinttypes
        )
+
+       IF(MSVC)
+               set(MSVC_OFLAGS O1 O2 Ox)
+               foreach(FLAG )
+                       string(REPLACE "" "Od" CMAKE_CXX_FLAGS_RELEASE "")
+                       string(REPLACE "" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "")
+               endforeach()
+       ENDIF(MSVC)
+
+       add_definitions(-DEIGEN_DONT_ALIGN_STATICALLY)
 ELSE(WIN32)
        list(APPEND SRC
                third_party/glog/src/utilities.cc
index 03f27ce9b39fb4e56913c1e66ee7c5068a03301c..83ebc0ecea2ecf4cc92840662766996282c4d0cb 100644 (file)
@@ -4,8 +4,14 @@ import os
 
 Import('env')
 
-defs = 'V3DLIB_ENABLE_SUITESPARSE GOOGLE_GLOG_DLL_DECL='
-cflags = []
+defs = []
+
+cflags_libmv = Split(env['CFLAGS'])
+ccflags_libmv = Split(env['CCFLAGS'])
+cxxflags_libmv = Split(env['CXXFLAGS'])
+
+defs.append('V3DLIB_ENABLE_SUITESPARSE')
+defs.append('GOOGLE_GLOG_DLL_DECL=')
 
 src = env.Glob("*.cpp")
 src += env.Glob('libmv/image/*.cc')
@@ -25,10 +31,29 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
 
     src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
     src += ['./third_party/glog/src/windows/port.cc']
+
+    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+        cflags_libmv.append('/Od')
+        ccflags_libmv.append('/Od')
+        cxxflags_libmv.append('/Od')
+
+        if not env['BF_DEBUG']:
+            defs.append('NDEBUG')
+    else:
+        if not env['BF_DEBUG']:
+            cflags_libmv = Split(env['REL_CFLAGS'])
+            ccflags_libmv = Split(env['REL_CCFLAGS'])
+            cxxflags_libmv = Split(env['REL_CXXFLAGS'])
+
+    defs.append('EIGEN_DONT_ALIGN_STATICALLY')
 else:
     src += env.Glob("third_party/glog/src/*.cc")
     incs += ' ./third_party/glog/src'
+    if not env['BF_DEBUG']:
+        cflags_libmv = Split(env['REL_CFLAGS'])
+        ccflags_libmv = Split(env['REL_CCFLAGS'])
+        cxxflags_libmv = Split(env['REL_CXXFLAGS'])
 
 incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include'
 
-env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=Split(defs), libtype=['extern', 'player'], priority=[20,137], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137], compileflags=cflags_libmv, cc_compileflags=ccflags_libmv, cxx_compileflags=cxxflags_libmv )
index dbceea4faad41a1b2e4b8ca69515756326f8e5a6..389bfc8c7d3de6ceeaba6071bfe3dae3efe7abb7 100755 (executable)
@@ -163,6 +163,16 @@ IF(WIN32)
                ./third_party/glog/src/windows
                ./third_party/msinttypes
        )
+
+       IF(MSVC)
+               set(MSVC_OFLAGS O1 O2 Ox)
+               foreach(FLAG ${MSVC_OFLAGS})
+                       string(REPLACE "${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+                       string(REPLACE "${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
+               endforeach()
+       ENDIF(MSVC)
+
+       add_definitions(-DEIGEN_DONT_ALIGN_STATICALLY)
 ELSE(WIN32)
        list(APPEND SRC
 ${third_glog_sources}
@@ -187,8 +197,14 @@ import os
 
 Import('env')
 
-defs = 'V3DLIB_ENABLE_SUITESPARSE GOOGLE_GLOG_DLL_DECL='
-cflags = []
+defs = []
+
+cflags_libmv = Split(env['CFLAGS'])
+ccflags_libmv = Split(env['CCFLAGS'])
+cxxflags_libmv = Split(env['CXXFLAGS'])
+
+defs.append('V3DLIB_ENABLE_SUITESPARSE')
+defs.append('GOOGLE_GLOG_DLL_DECL=')
 
 src = env.Glob("*.cpp")
 $src
@@ -200,11 +216,30 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
 ${win_src}
     src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
     src += ['./third_party/glog/src/windows/port.cc']
+
+    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+        cflags_libmv.append('/Od')
+        ccflags_libmv.append('/Od')
+        cxxflags_libmv.append('/Od')
+
+        if not env['BF_DEBUG']:
+            defs.append('NDEBUG')
+    else:
+        if not env['BF_DEBUG']:
+            cflags_libmv = Split(env['REL_CFLAGS'])
+            ccflags_libmv = Split(env['REL_CCFLAGS'])
+            cxxflags_libmv = Split(env['REL_CXXFLAGS'])
+
+    defs.append('EIGEN_DONT_ALIGN_STATICALLY')
 else:
     src += env.Glob("third_party/glog/src/*.cc")
     incs += ' ./third_party/glog/src'
+    if not env['BF_DEBUG']:
+        cflags_libmv = Split(env['REL_CFLAGS'])
+        ccflags_libmv = Split(env['REL_CCFLAGS'])
+        cxxflags_libmv = Split(env['REL_CXXFLAGS'])
 
 incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include'
 
-env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=Split(defs), libtype=['extern', 'player'], priority=[20,137], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137], compileflags=cflags_libmv, cc_compileflags=ccflags_libmv, cxx_compileflags=cxxflags_libmv )
 EOF