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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-06-10 19:27:41 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-10 19:27:41 +0400
commit59ef51aa2753895442aaf2d8e4ef8ff923be3973 (patch)
tree8a6e6472f44bfe937154d6536669117bd57c6359 /extern/libmv/third_party/ceres/bundle.sh
parent39e591d3d04015b84fe5f12e7ef5af6507df92af (diff)
Initial Ceres integration into Blender
Currently only put sources of Ceres library into extern/libmv/third_party and setup CMake and SCons building systems. Integration details: - Even CMake build files are not re-used from Ceres's trunk: they're using some automatic stuff detection like glog, pthreads, protobuf and so and it's not so clear how to re-use that files without modifications. And IMO it's easier if build files are getting re-generated automatically to match Blender-specific setup rather than keeping changes made locally in Blender in sync when re-bundling Ceres library. Especially in case when it's already needed to support SCons build system. - Integrated only actual sources, all tests were stripped. Probably it'll be nice to have them, but they'll need clear integration with current module test stuff in Blender. - Suitesparse was disabled. It'll help a lot having it, but there are some difficulties making cholmod working fine on windows. Would be added in future - collections_port.cc was also stripped. It's not used by Ceres's upstream and it gives compilation error (undefined uint32 -- looks like namespace issue). - Currently all schur eliminators are included. Not sure if it makes sense, also not sure if it makes sense having them switchable on and off -- IMO better to have single configuration which works and does not require special tweaks after everything was set up. To bundle updated version of Ceres: - Go to extern/libmv/third_party/ceres folder - Run ./bundle.sh This will checkout fresh Ceres snapshot of Windows branch (which is currently most interesting from integration into Blender POV), apply all patches listed in patches/series and copy needed files into Blender's working copy. This will also re-generate CMake/SCons build rules. If you'll need extra files from Ceres repository which are not present in Blender, you'll need to copy them manually and then run ./mkfiles.sh from extern/libmv/third_party/ceres folder which will update list of files used by Blender. Thanks to Leir Mierle and Sameer Agarwal (and all others who helped developing Ceres) this library and thanks to Keir Mierle with help integrating it into Blender!
Diffstat (limited to 'extern/libmv/third_party/ceres/bundle.sh')
-rw-r--r--extern/libmv/third_party/ceres/bundle.sh185
1 files changed, 185 insertions, 0 deletions
diff --git a/extern/libmv/third_party/ceres/bundle.sh b/extern/libmv/third_party/ceres/bundle.sh
new file mode 100644
index 00000000000..f54342180db
--- /dev/null
+++ b/extern/libmv/third_party/ceres/bundle.sh
@@ -0,0 +1,185 @@
+#!/bin/sh
+
+if [ "x$1" = "x--i-really-know-what-im-doing" ] ; then
+ echo Proceeding as requested by command line ...
+else
+ echo "*** Please run again with --i-really-know-what-im-doing ..."
+ exit 1
+fi
+
+repo="https://code.google.com/p/ceres-solver/"
+branch="windows"
+tmp=`mktemp -d`
+
+GIT="git --git-dir $tmp/ceres/.git --work-tree $tmp/ceres"
+
+git clone $repo $tmp/ceres
+
+if [ $branch != "master" ]; then
+ $GIT checkout -t remotes/origin/$branch
+fi
+
+$GIT log -n 50 > ChangeLog
+
+for p in `cat ./patches/series`; do
+ echo "Applying patch $p..."
+ cat ./patches/$p | patch -d $tmp/ceres -p1
+done
+
+find include -type f -not -iwholename '*.svn*' -exec rm -rf {} \;
+find internal -type f -not -iwholename '*.svn*' -exec rm -rf {} \;
+
+cat "files.txt" | while read f; do
+ mkdir -p `dirname $f`
+ cp $tmp/ceres/$f $f
+done
+
+rm -rf $tmp
+
+sources=`find ./include ./internal -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/' | sort -d`
+headers=`find ./include ./internal -type f -iname '*.h' | sed -r 's/^\.\//\t/' | sort -d`
+
+src_dir=`find ./internal -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort -d | uniq`
+src=""
+for x in $src_dir $src_third_dir; do
+ t=""
+
+ if test `echo "$x" | grep -c glog ` -eq 1; then
+ continue;
+ fi
+
+ if stat $x/*.cpp > /dev/null 2>&1; then
+ t="src += env.Glob('`echo $x'/*.cpp'`')"
+ fi
+
+ if stat $x/*.c > /dev/null 2>&1; then
+ if [ -z "$t" ]; then
+ t="src += env.Glob('`echo $x'/*.c'`')"
+ else
+ t="$t + env.Glob('`echo $x'/*.c'`')"
+ fi
+ fi
+
+ if stat $x/*.cc > /dev/null 2>&1; then
+ if [ -z "$t" ]; then
+ t="src += env.Glob('`echo $x'/*.cc'`')"
+ else
+ t="$t + env.Glob('`echo $x'/*.cc'`')"
+ fi
+ fi
+
+ if [ -z "$src" ]; then
+ src=$t
+ else
+ src=`echo "$src\n$t"`
+ fi
+done
+
+cat > CMakeLists.txt << EOF
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2012, Blender Foundation
+# All rights reserved.
+#
+# Contributor(s): Blender Foundation,
+# Sergey Sharybin
+#
+# ***** END GPL LICENSE BLOCK *****
+
+# 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
+
+set(INC
+ .
+ ../../../Eigen3
+ include
+ internal
+ ../gflags
+)
+
+set(INC_SYS
+)
+
+set(SRC
+${sources}
+
+${headers}
+)
+
+if(WIN32)
+ list(APPEND INC
+ ../glog/src/windows
+ )
+
+ if(NOT MINGW)
+ list(APPEND INC
+ third_party/msinttypes
+ )
+ endif()
+else()
+ list(APPEND INC
+ ../glog/src
+ )
+endif()
+
+add_definitions(
+ -DCERES_HAVE_PTHREAD
+ -D"CERES_HASH_NAMESPACE_START=namespace std { namespace tr1 {"
+ -D"CERES_HASH_NAMESPACE_END=}}"
+ -DCERES_NO_SUITESPARSE
+ -DCERES_DONT_HAVE_PROTOCOL_BUFFERS
+)
+
+blender_add_lib(extern_ceres "\${SRC}" "\${INC}" "\${INC_SYS}")
+EOF
+
+cat > SConscript << EOF
+#!/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
+
+defs.append('CERES_HAVE_PTHREAD')
+defs.append('CERES_HASH_NAMESPACE_START=namespace std { namespace tr1 {')
+defs.append('CERES_HASH_NAMESPACE_END=}}')
+defs.append('CERES_NO_SUITESPARSE')
+defs.append('CERES_DONT_HAVE_PROTOCOL_BUFFERS')
+
+incs = '. ../../ ../../../Eigen3 ./include ./internal ../gflags'
+
+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])
+EOF