Fix #30622: documentation example code for bge.types.KX_MeshProxy did not work,
[blender.git] / extern / libmv / bundle.sh
1 #!/bin/sh
2
3 #BRANCH="keir"
4 #BRANCH="Matthias-Fauconneau"
5 BRANCH="Nazg-Gul"
6
7 if [ -d ./.svn ]; then
8   echo "This script is supposed to work only when using git-svn"
9   exit 1
10 fi
11
12 repo="git://github.com/${BRANCH}/libmv.git"
13 tmp=`mktemp -d`
14
15 git clone $repo $tmp/libmv
16
17 #git --git-dir $tmp/libmv/.git --work-tree $tmp/libmv log --since="1 month ago" > ChangeLog
18 git --git-dir $tmp/libmv/.git --work-tree $tmp/libmv log -n 50 > ChangeLog
19
20 for p in `cat ./patches/series`; do
21   echo "Applying patch $p..."
22   cat ./patches/$p | patch -d $tmp/libmv -p1
23 done
24
25 rm -rf libmv
26 rm -rf third_party
27
28 cat "files.txt" | while read f; do
29   mkdir -p `dirname $f`
30   cp $tmp/libmv/src/$f $f
31 done
32
33 rm -rf $tmp
34
35 chmod 664 ./third_party/glog/src/windows/*.cc ./third_party/glog/src/windows/*.h ./third_party/glog/src/windows/glog/*.h
36
37 sources=`find ./libmv -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/' | sort -d`
38 headers=`find ./libmv -type f -iname '*.h' | sed -r 's/^\.\//\t/' | sort -d`
39
40 third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | sed -r 's/^\.\//\t/' | sort -d`
41 third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | sed -r 's/^\.\//\t/' | sort -d`
42
43 third_glog_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort -d`
44 third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort -d`
45
46 src_dir=`find ./libmv -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort -d | uniq`
47 src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/'  | sort -d | uniq`
48 src=""
49 win_src=""
50 for x in $src_dir $src_third_dir; do
51   t=""
52
53   if test  `echo "$x" | grep -c glog ` -eq 1; then
54     continue;
55   fi
56
57   if stat $x/*.cpp > /dev/null 2>&1; then
58     t="src += env.Glob('`echo $x'/*.cpp'`')"
59   fi
60
61   if stat $x/*.c > /dev/null 2>&1; then
62     if [ -z "$t" ]; then
63       t="src += env.Glob('`echo $x'/*.c'`')"
64     else
65       t="$t + env.Glob('`echo $x'/*.c'`')"
66     fi
67   fi
68
69   if stat $x/*.cc > /dev/null 2>&1; then
70     if [ -z "$t" ]; then
71       t="src += env.Glob('`echo $x'/*.cc'`')"
72     else
73       t="$t + env.Glob('`echo $x'/*.cc'`')"
74     fi
75   fi
76
77   if test `echo $x | grep -c windows ` -eq 0; then
78     if [ -z "$src" ]; then
79       src=$t
80     else
81       src=`echo "$src\n$t"`
82     fi
83   else
84     if [ -z "$win_src" ]; then
85       win_src=`echo "    $t"`
86     else
87       win_src=`echo "$win_src\n    $t"`
88     fi
89   fi
90 done
91
92 cat > CMakeLists.txt << EOF
93 # ***** BEGIN GPL LICENSE BLOCK *****
94 #
95 # This program is free software; you can redistribute it and/or
96 # modify it under the terms of the GNU General Public License
97 # as published by the Free Software Foundation; either version 2
98 # of the License, or (at your option) any later version.
99 #
100 # This program is distributed in the hope that it will be useful,
101 # but WITHOUT ANY WARRANTY; without even the implied warranty of
102 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
103 # GNU General Public License for more details.
104 #
105 # You should have received a copy of the GNU General Public License
106 # along with this program; if not, write to the Free Software Foundation,
107 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
108 #
109 # The Original Code is Copyright (C) 2011, Blender Foundation
110 # All rights reserved.
111 #
112 # Contributor(s): Blender Foundation,
113 #                 Sergey Sharybin
114 #
115 # ***** END GPL LICENSE BLOCK *****
116
117 # NOTE: This file is automatically generated by bundle.sh script
118 #       If you're doing changes in this file, please update template
119 #       in that script too
120
121 set(INC
122         .
123         ../Eigen3
124         third_party/ssba
125         third_party/ldl/Include
126         ../colamd/Include
127 )
128
129 set(INC_SYS
130         \${PNG_INCLUDE_DIR}
131         \${ZLIB_INCLUDE_DIRS}
132 )
133
134
135 # XXX - FIXME
136 # this is a momentary hack to find unwind.h in 10.6.sdk
137 if(\${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.6")
138         list(APPEND INC_SYS
139                 \${CMAKE_OSX_SYSROOT}/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include
140         )
141 endif()
142 # XXX - END
143
144
145 set(SRC
146         libmv-capi.cpp
147 ${sources}
148
149 ${third_sources}
150
151         libmv-capi.h
152 ${headers}
153
154 ${third_headers}
155 )
156
157 if(WIN32)
158         list(APPEND SRC
159                 third_party/glog/src/logging.cc
160                 third_party/glog/src/raw_logging.cc
161                 third_party/glog/src/utilities.cc
162                 third_party/glog/src/vlog_is_on.cc
163                 third_party/glog/src/windows/port.cc
164
165                 third_party/glog/src/utilities.h
166                 third_party/glog/src/stacktrace_generic-inl.h
167                 third_party/glog/src/stacktrace.h
168                 third_party/glog/src/stacktrace_x86_64-inl.h
169                 third_party/glog/src/base/googleinit.h
170                 third_party/glog/src/base/mutex.h
171                 third_party/glog/src/base/commandlineflags.h
172                 third_party/glog/src/stacktrace_powerpc-inl.h
173                 third_party/glog/src/stacktrace_x86-inl.h
174                 third_party/glog/src/config.h
175                 third_party/glog/src/stacktrace_libunwind-inl.h
176                 third_party/glog/src/windows/glog/raw_logging.h
177                 third_party/glog/src/windows/glog/vlog_is_on.h
178                 third_party/glog/src/windows/glog/logging.h
179                 third_party/glog/src/windows/glog/log_severity.h
180                 third_party/glog/src/windows/port.h
181                 third_party/glog/src/windows/config.h
182         )
183
184         list(APPEND INC
185                 third_party/glog/src/windows
186         )
187
188         if(NOT MINGW)
189                 list(APPEND INC
190                         third_party/msinttypes
191                 )
192         endif()
193
194         if(MSVC)
195                 set(MSVC_OFLAGS O1 O2 Ox)
196                 foreach(FLAG \${MSVC_OFLAGS})
197                         string(REPLACE "\${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "\${CMAKE_CXX_FLAGS_RELEASE}")
198                         string(REPLACE "\${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "\${CMAKE_C_FLAGS_RELWITHDEBINFO}")
199                 endforeach()
200         endif()
201 else()
202         list(APPEND SRC
203 ${third_glog_sources}
204
205 ${third_glog_headers}
206         )
207
208         list(APPEND INC
209                 third_party/glog/src
210         )
211 endif()
212
213 add_definitions(
214         -DV3DLIB_ENABLE_SUITESPARSE
215         -DGOOGLE_GLOG_DLL_DECL=
216 )
217
218 blender_add_lib(extern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}")
219 EOF
220
221 cat > SConscript << EOF
222 #!/usr/bin/python
223
224 # NOTE: This file is automatically generated by bundle.sh script
225 #       If you're doing changes in this file, please update template
226 #       in that script too
227
228 import sys
229 import os
230
231 Import('env')
232
233 defs = []
234
235 cflags_libmv = Split(env['CFLAGS'])
236 ccflags_libmv = Split(env['CCFLAGS'])
237 cxxflags_libmv = Split(env['CXXFLAGS'])
238
239 defs.append('V3DLIB_ENABLE_SUITESPARSE')
240 defs.append('GOOGLE_GLOG_DLL_DECL=')
241
242 src = env.Glob("*.cpp")
243 $src
244
245 incs = '. ../Eigen3'
246 incs += ' ' + env['BF_PNG_INC']
247 incs += ' ' + env['BF_ZLIB_INC']
248
249 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
250     incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
251     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
252         incs += ' ./third_party/msinttypes'
253 ${win_src}
254     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']
255     src += ['./third_party/glog/src/windows/port.cc']
256
257     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
258         cflags_libmv.append('/Od')
259         ccflags_libmv.append('/Od')
260         cxxflags_libmv.append('/Od')
261
262         if not env['BF_DEBUG']:
263             defs.append('NDEBUG')
264     else:
265         if not env['BF_DEBUG']:
266             cflags_libmv += Split(env['REL_CFLAGS'])
267             ccflags_libmv += Split(env['REL_CCFLAGS'])
268             cxxflags_libmv += Split(env['REL_CXXFLAGS'])
269 else:
270     src += env.Glob("third_party/glog/src/*.cc")
271     incs += ' ./third_party/glog/src'
272     if not env['BF_DEBUG']:
273         cflags_libmv += Split(env['REL_CFLAGS'])
274         ccflags_libmv += Split(env['REL_CCFLAGS'])
275         cxxflags_libmv += Split(env['REL_CXXFLAGS'])
276
277 incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include'
278
279 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 )
280 EOF