code cleanup: naming - BKE_mesh_*
[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(APPLE)
138         if(\${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.6")
139                 list(APPEND INC_SYS
140                         \${CMAKE_OSX_SYSROOT}/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include
141                 )
142         endif()
143 endif()
144 # XXX - END
145
146
147 set(SRC
148         libmv-capi.cpp
149 ${sources}
150
151 ${third_sources}
152
153         libmv-capi.h
154 ${headers}
155
156 ${third_headers}
157 )
158
159 if(WIN32)
160         list(APPEND SRC
161                 third_party/glog/src/logging.cc
162                 third_party/glog/src/raw_logging.cc
163                 third_party/glog/src/utilities.cc
164                 third_party/glog/src/vlog_is_on.cc
165                 third_party/glog/src/windows/port.cc
166
167                 third_party/glog/src/utilities.h
168                 third_party/glog/src/stacktrace_generic-inl.h
169                 third_party/glog/src/stacktrace.h
170                 third_party/glog/src/stacktrace_x86_64-inl.h
171                 third_party/glog/src/base/googleinit.h
172                 third_party/glog/src/base/mutex.h
173                 third_party/glog/src/base/commandlineflags.h
174                 third_party/glog/src/stacktrace_powerpc-inl.h
175                 third_party/glog/src/stacktrace_x86-inl.h
176                 third_party/glog/src/config.h
177                 third_party/glog/src/stacktrace_libunwind-inl.h
178                 third_party/glog/src/windows/glog/raw_logging.h
179                 third_party/glog/src/windows/glog/vlog_is_on.h
180                 third_party/glog/src/windows/glog/logging.h
181                 third_party/glog/src/windows/glog/log_severity.h
182                 third_party/glog/src/windows/port.h
183                 third_party/glog/src/windows/config.h
184         )
185
186         list(APPEND INC
187                 third_party/glog/src/windows
188         )
189
190         if(NOT MINGW)
191                 list(APPEND INC
192                         third_party/msinttypes
193                 )
194         endif()
195
196         if(MSVC)
197                 set(MSVC_OFLAGS O1 O2 Ox)
198                 foreach(FLAG \${MSVC_OFLAGS})
199                         string(REPLACE "\${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "\${CMAKE_CXX_FLAGS_RELEASE}")
200                         string(REPLACE "\${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "\${CMAKE_C_FLAGS_RELWITHDEBINFO}")
201                 endforeach()
202         endif()
203 else()
204         list(APPEND SRC
205 ${third_glog_sources}
206
207 ${third_glog_headers}
208         )
209
210         list(APPEND INC
211                 third_party/glog/src
212         )
213 endif()
214
215 add_definitions(
216         -DV3DLIB_ENABLE_SUITESPARSE
217         -DGOOGLE_GLOG_DLL_DECL=
218 )
219
220 blender_add_lib(extern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}")
221 EOF
222
223 cat > SConscript << EOF
224 #!/usr/bin/python
225
226 # NOTE: This file is automatically generated by bundle.sh script
227 #       If you're doing changes in this file, please update template
228 #       in that script too
229
230 import sys
231 import os
232
233 Import('env')
234
235 defs = []
236
237 cflags_libmv = Split(env['CFLAGS'])
238 ccflags_libmv = Split(env['CCFLAGS'])
239 cxxflags_libmv = Split(env['CXXFLAGS'])
240
241 defs.append('V3DLIB_ENABLE_SUITESPARSE')
242 defs.append('GOOGLE_GLOG_DLL_DECL=')
243
244 src = env.Glob("*.cpp")
245 $src
246
247 incs = '. ../Eigen3'
248 incs += ' ' + env['BF_PNG_INC']
249 incs += ' ' + env['BF_ZLIB_INC']
250
251 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
252     incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
253     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
254         incs += ' ./third_party/msinttypes'
255 ${win_src}
256     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']
257     src += ['./third_party/glog/src/windows/port.cc']
258
259     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
260         cflags_libmv.append('/Od')
261         ccflags_libmv.append('/Od')
262         cxxflags_libmv.append('/Od')
263
264         if not env['BF_DEBUG']:
265             defs.append('NDEBUG')
266     else:
267         if not env['BF_DEBUG']:
268             cflags_libmv += Split(env['REL_CFLAGS'])
269             ccflags_libmv += Split(env['REL_CCFLAGS'])
270             cxxflags_libmv += Split(env['REL_CXXFLAGS'])
271 else:
272     src += env.Glob("third_party/glog/src/*.cc")
273     incs += ' ./third_party/glog/src'
274     if not env['BF_DEBUG']:
275         cflags_libmv += Split(env['REL_CFLAGS'])
276         ccflags_libmv += Split(env['REL_CCFLAGS'])
277         cxxflags_libmv += Split(env['REL_CXXFLAGS'])
278
279 incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include'
280
281 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 )
282 EOF