[SCONS] Optimisation flags for msvc
[blender-staging.git] / SConstruct
1 import string
2 import os
3 import time
4 import sys
5 from distutils import sysconfig
6
7 # Build directory.
8 root_build_dir = '..' + os.sep + 'build' + os.sep + sys.platform + os.sep
9
10 # Create the build directory. SCons does this automatically, but since we
11 # don't want to put scons-generated .sconsign files in the source tree, but in
12 # the root_build_dir, we have to create that dir ourselves before SCons tries
13 # to access/create the file containing .sconsign data.
14 if os.path.isdir (root_build_dir) == 0:
15     os.makedirs (root_build_dir)
16
17 # User configurable options file. This can be controlled by the user by running
18 # scons with the following argument: CONFIG=user_config_options_file
19 config_file = ARGUMENTS.get('CONFIG', 'config.opts')
20
21 # Blender version.
22 version='2.32'
23
24 sdl_env = Environment ()
25 freetype_env = Environment ()
26 env = Environment ()
27
28 if sys.platform == 'linux2' or sys.platform == 'linux-i386':
29     use_international = 'false'
30     use_gameengine = 'false'
31     use_openal = 'false'
32     use_fmod = 'false'
33     use_quicktime = 'false'
34     use_sumo = 'false'
35     use_ode = 'false'
36     use_buildinfo = 'false'
37     build_blender_dynamic = 'true'
38     build_blender_static = 'false'
39     build_blender_player = 'false'
40     build_blender_plugin = 'false'
41     release_flags = ['-O2']
42     debug_flags = ['-O2', '-g']
43     extra_flags = ['-pipe', '-fPIC', '-funsigned-char']
44     cxxflags = []
45     defines = []
46     warn_flags = ['-Wall']
47     window_system = 'X11'
48     platform_libs = ['m', 'util', 'stdc++']
49     platform_libpath = []
50     platform_linkflags = []
51     extra_includes = []
52     # z library information
53     z_lib = ['z']
54     z_libpath = ['/usr/lib']
55     z_include = ['/usr/include']
56     # png library information
57     png_lib = ['png']
58     png_libpath = ['/usr/lib']
59     png_include = ['/usr/include']
60     # jpeg library information
61     jpeg_lib = ['jpeg']
62     jpeg_libpath = ['/usr/lib']
63     jpeg_include = ['/usr/include']
64     # OpenGL library information
65     opengl_lib = ['GL', 'GLU']
66     opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
67     opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
68     opengl_include = ['/usr/include']
69     # SDL library information
70     sdl_env.ParseConfig ('sdl-config --cflags --libs')
71     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
72     sdl_include = sdl_env.Dictionary()['CPPPATH']
73     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
74     sdl_lib = sdl_env.Dictionary()['LIBS']
75     # SOLID library information
76     solid_lib = []                                              # TODO
77     solid_libpath = []                                          # TODO
78     solid_include = ['#extern/solid']
79     qhull_lib = []                                              # TODO
80     qhull_libpath = []                                          # TODO
81     qhull_include = ['#extern/qhull/include']
82     # ODE library information
83     ode_lib = ['ode']
84     ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
85     ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
86     # Python library information
87     python_lib = ['python%d.%d' % sys.version_info[0:2]]
88     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
89     python_include = [sysconfig.get_python_inc ()]
90     python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
91     # International support information
92     ftgl_lib = ['ftgl']
93     ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
94     ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
95     freetype_env.ParseConfig ('freetype-config --cflags --libs')
96     freetype_lib = freetype_env.Dictionary()['LIBS']
97     freetype_libpath = freetype_env.Dictionary()['LIBPATH']
98     freetype_include = freetype_env.Dictionary()['CPPPATH']
99     gettext_lib = []
100     gettext_libpath = []
101     gettext_include = []
102     # OpenAL library information
103     openal_lib = ['openal']
104     openal_libpath = ['/usr/lib']
105     openal_include = ['/usr/include']
106
107 elif sys.platform == 'darwin':
108     use_international = 'false'
109     use_gameengine = 'false'
110     use_openal = 'false'
111     use_fmod = 'false'
112     use_quicktime = 'true'
113     use_precomp = 'true'
114     use_sumo = 'false'
115     use_ode = 'false'
116     use_buildinfo = 'false'
117     build_blender_dynamic = 'true'
118     build_blender_static = 'false'
119     build_blender_player = 'false'
120     build_blender_plugin = 'false'
121     # TODO: replace darwin-6.8-powerpc with the actual directiory on the
122     #       build machine
123     darwin_precomp = '#../lib/darwin-6.8-powerpc'
124     extra_flags = ['-pipe', '-fPIC', '-funsigned-char']
125     cxxflags = []
126     defines = ['_THREAD_SAFE']
127     if use_quicktime == 'true':
128         defines += ['WITH_QUICKTIME']
129     warn_flags = ['-Wall', '-W']
130     release_flags = []
131     debug_flags = ['-g']
132     window_system = 'CARBON'
133     # z library information
134     z_lib = ['z']
135     z_libpath = []
136     z_include = []
137     # png library information
138     png_lib = ['png']
139     png_libpath = []
140     png_include = []
141     # jpeg library information
142     jpeg_lib = ['jpeg']
143     jpeg_libpath = []
144     jpeg_include = []
145     # OpenGL library information
146     opengl_lib = ['GL', 'GLU']
147     opengl_static = []
148     opengl_libpath = []
149     opengl_include = []
150     # SDL specific stuff.
151     sdl_env.ParseConfig ('sdl-config --cflags --libs')
152     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
153     # Want to use precompiled libraries?
154     if use_precomp == 'true':
155         sdl_include = [darwin_precomp + '/sdl/include']
156         sdl_libpath = [darwin_precomp + '/sdl/lib']
157         sdl_lib = ['libSDL.a']
158
159     platform_libs = ['stdc++'] 
160     extra_includes = ['/sw/include']
161     platform_libpath = ['/System/Library/Frameworks/OpenGL.framework/Libraries']
162     platform_linkflags = []
163     # SOLID library information
164     solid_lib = []                                              # TODO
165     solid_libpath = []                                          # TODO
166     solid_include = ['#extern/solid']
167     qhull_lib = []                                              # TODO
168     qhull_libpath = []                                          # TODO
169     qhull_include = ['#extern/qhull/include']
170     # ODE library information
171     ode_lib = []                                                # TODO
172     ode_libpath = []                                            # TODO
173     ode_include = ['#extern/ode/dist/include/ode']
174     # Python variables.
175     python_lib = ['python%d.%d' % sys.version_info[0:2]]
176     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
177     python_include = [sysconfig.get_python_inc ()]
178     python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
179     # International stuff
180     ftgl_lib = ['ftgl']
181     ftgl_libpath = [darwin_precomp + '/ftgl/lib']
182     ftgl_include = [darwin_precomp + '/ftgl/include']
183     freetype_lib = ['freetype']
184     freetype_libpath = [darwin_precomp + '/freetype/lib']
185     freetype_include = [darwin_precomp + '/freetype/include']
186     gettext_lib = []
187     gettext_libpath = []
188     gettext_include = []
189     # OpenAL library information
190     openal_lib = []
191     openal_libpath = []
192     openal_include = []
193
194 elif sys.platform == 'cygwin':
195     use_international = 'false'
196     use_gameengine = 'false'
197     use_openal = 'false'
198     use_fmod = 'false'
199     use_quicktime = 'false'
200     use_sumo = 'false'
201     use_ode = 'false'
202     use_buildinfo = 'false'
203     build_blender_dynamic = 'true'
204     build_blender_static = 'false'
205     build_blender_player = 'false'
206     build_blender_plugin = 'false'
207     release_flags = ['-O2']
208     debug_flags = ['-O2', '-g']
209     extra_flags = ['-pipe', '-mno-cygwin', '-mwindows', '-funsigned-char']
210     cxxflags = []
211     defines = ['FREE_WINDOWS', 'NDEBUG']
212     warn_flags = ['-Wall', '-Wno-char-subscripts']
213     platform_libs = ['png', 'jpeg', 'netapi32',
214                      'opengl32', 'glu32', 'winmm',
215                      'mingw32']
216     platform_libpath = ['/usr/lib/w32api', '/lib/w32api']
217     platform_linkflags = ['-mwindows', '-mno-cygwin', '-mconsole']
218     window_system = 'WIN32'
219     extra_includes = []
220     # z library information
221     z_lib = ['z']
222     z_libpath = ['#../lib/windows/zlib/lib']
223     z_include = ['#../lib/windows/zlib/include']
224     # png library information
225     png_lib = ['png']
226     png_libpath = ['#../lib/windows/png/lib']
227     png_include = ['#../lib/windows/png/include']
228     # jpeg library information
229     jpeg_lib = ['jpeg']
230     jpeg_libpath = ['#../lib/windows/jpeg/lib']
231     jpeg_include = ['#../lib/windows/jpeg/include']
232     # OpenGL library information
233     opengl_lib = ['opengl32', 'glu32']
234     opengl_static = []
235     opengl_libpath = []
236     opengl_include = []
237     # SDL specific stuff.
238     sdl_include = ['#../lib/windows/sdl/include']
239     sdl_libpath = ['#../lib/windows/sdl/lib']
240     sdl_lib = ['SDL']
241     sdl_cflags = []
242     #sdl_cflags = '-DWIN32'
243     # SOLID library information
244     solid_lib = []                                              # TODO
245     solid_libpath = []                                          # TODO
246     solid_include = ['#extern/solid']
247     qhull_lib = []                                              # TODO
248     qhull_libpath = []                                          # TODO
249     qhull_include = ['#extern/qhull/include']
250     # ODE library information
251     ode_lib = ['ode']
252     ode_libpath = ['#../lib/windows/gcc/ode/lib']
253     ode_include = ['#../lib/windows/gcc/ode/include']
254     # Python library information
255     python_include = ['#../lib/windows/python/include/python2.2']
256     python_libpath = ['#../lib/windows/python/lib']
257     python_lib = ['python22']
258     python_linkflags = []
259     # International stuff
260     ftgl_lib = ['ftgl']
261     ftgl_libpath = ['#../lib/windows/gcc/ftgl/lib']
262     ftgl_include = ['#../lib/windows/gcc/ftgl/include']
263     freetype_lib = ['freetype']
264     freetype_libpath = ['#../lib/windows/gcc/freetype/lib']
265     freetype_include = ['#../lib/windows/gcc/freetype/include']
266     gettext_lib = []
267     gettext_libpath = []
268     gettext_include = []
269     # OpenAL library information
270     openal_lib = []
271     openal_libpath = []
272     openal_include = []
273
274 elif sys.platform == 'win32':
275     use_international = 'true'
276     use_gameengine = 'true'
277     use_openal = 'true'
278     use_fmod = 'false'
279     use_quicktime = 'true'
280     use_sumo = 'true'
281     use_ode = 'false'
282     use_buildinfo = 'false'
283     build_blender_dynamic = 'true'
284     build_blender_static = 'false'
285     build_blender_player = 'false'
286     build_blender_plugin = 'false'
287     release_flags = ['/Og', '/Ot', '/Ob1', '/Op', '/G6']
288     debug_flags = ['/Zi', '/Fr${TARGET.base}.sbr']
289     extra_flags = ['/EHsc', '/J', '/W3', '/Gd', '/MT']
290     cxxflags = []
291     defines = ['WIN32', '_CONSOLE']
292     defines += ['WITH_QUICKTIME']
293     defines += ['_LIB', 'USE_OPENAL']
294     defines += ['FTGL_LIBRARY_STATIC']
295     warn_flags = []
296     platform_libs = [ 'qtmlClient', 'soundsystem',
297                      'ws2_32', 'dxguid', 'vfw32', 'winmm',
298                      'iconv', 'kernel32', 'user32', 'gdi32',
299                      'winspool', 'comdlg32', 'advapi32', 'shell32',
300                      'ole32', 'oleaut32', 'uuid', 'odbc32', 'odbccp32',
301                      'libcmt', 'libc']
302     platform_libpath = ['#../lib/windows/iconv/lib',
303                         '#../lib/windows/QTDevWin/Libraries']
304     platform_linkflags = [
305                         '/SUBSYSTEM:CONSOLE',
306                         '/MACHINE:IX86',
307                         '/ENTRY:mainCRTStartup',
308                         '/INCREMENTAL:NO',
309                         '/NODEFAULTLIB:"msvcprt.lib"',
310                         '/NODEFAULTLIB:"glut32.lib"',
311                         '/NODEFAULTLIB:"libcd.lib"',
312                         #'/NODEFAULTLIB:"libc.lib"',
313                         '/NODEFAULTLIB:"libcpd.lib"',
314                         '/NODEFAULTLIB:"libcp.lib"',
315                         '/NODEFAULTLIB:"libcmtd.lib"',
316                         ]
317     window_system = 'WIN32'
318     extra_includes = []
319     if use_quicktime == 'true':
320         extra_includes += ['#../lib/windows/QTDevWin/CIncludes']
321     # z library information
322     z_lib = ['libz_st']
323     z_libpath = ['#../lib/windows/zlib/lib']
324     z_include = ['#../lib/windows/zlib/include']
325     # png library information
326     png_lib = ['libpng_st']
327     png_libpath = ['#../lib/windows/png/lib']
328     png_include = ['#../lib/windows/png/include']
329     # jpeg library information
330     jpeg_lib = ['libjpeg']
331     jpeg_libpath = ['#../lib/windows/jpeg/lib']
332     jpeg_include = ['#../lib/windows/jpeg/include']
333     # OpenGL library information
334     opengl_lib = ['opengl32', 'glu32']
335     opengl_static = []
336     opengl_libpath = []
337     opengl_include = ['/usr/include']
338     # SDL library information
339     sdl_include = ['#../lib/windows/sdl/include']
340     sdl_libpath = ['#../lib/windows/sdl/lib']
341     sdl_lib = ['SDL']
342     sdl_cflags = []
343     window_system = 'WIN32'
344     # SOLID library information
345     solid_lib = ['extern/solid']
346     solid_libpath = ['#../lib/windows/solid/lib']
347     solid_include = ['#extern/solid']
348     qhull_lib = ['qhull']
349     qhull_libpath = ['#../lib/windows/qhull/lib']
350     qhull_include = ['#extern/qhull/include']
351     # ODE library information
352     ode_lib = []                                                # TODO
353     ode_libpath = ['#../lib/windows/ode/lib']
354     ode_include = ['#../lib/windows/ode/include']
355     # Python lib name
356     python_include = ['#../lib/windows/python/include/python2.2']
357     python_libpath = ['#../lib/windows/python/lib']
358     python_lib = ['python22']
359     python_linkflags = []
360     # International stuff
361     ftgl_lib = ['ftgl_static_ST']
362     ftgl_libpath = ['#../lib/windows/ftgl/lib']
363     ftgl_include = ['#../lib/windows/ftgl/include']
364     freetype_lib = ['freetype2ST']
365     freetype_libpath = ['#../lib/windows/freetype/lib']
366     freetype_include = ['#../lib/windows/freetype/include']
367     gettext_lib = ['gnu_gettext']
368     gettext_libpath = ['#../lib/windows/gettext/lib']
369     gettext_include = ['#../lib/windows/gettext/include']
370     # OpenAL library information
371     openal_lib = ['openal_static']
372     openal_libpath = ['#../lib/windows/openal/lib']
373     openal_include = ['#../lib/windows/openal/include']
374
375 elif string.find (sys.platform, 'sunos') != -1:
376     use_international = 'true'
377     use_gameengine = 'false'
378     use_openal = 'false'
379     use_fmod = 'false'
380     use_quicktime = 'false'
381     use_sumo = 'false'
382     use_ode = 'false'
383     use_buildinfo = 'false'
384     build_blender_dynamic = 'true'
385     build_blender_static = 'false'
386     build_blender_player = 'false'
387     build_blender_plugin = 'false'
388     release_flags = ['-O2']
389     debug_flags = ['-O2', '-g']
390     extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-DSUN_OGL_NO_VERTEX_MACROS']
391     cxxflags = []
392     defines = []
393     warn_flags = ['-Wall', '-W']
394     window_system = 'X11'
395     platform_libs = ['stdc++', 'dl', 'm']
396     platform_libpath = []
397     platform_linkflags = []
398     extra_includes = []
399     # z library information
400     z_lib = ['z']
401     z_libpath = []
402     z_include = []
403     # png library information
404     png_lib = ['png']
405     png_libpath = []
406     png_include = []
407     # jpeg library information
408     jpeg_lib = ['jpeg']
409     jpeg_libpath = []
410     jpeg_include = []
411     # OpenGL library information
412     opengl_lib = ['GL', 'GLU', 'X11']
413     opengl_static = []
414     opengl_libpath = ['/usr/openwin/include']
415     opengl_include = ['/usr/openwin/lib']
416     # SDL library information
417     sdl_env.ParseConfig ('sdl-config --cflags --libs')
418     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
419     sdl_include = sdl_env.Dictionary()['CPPPATH']
420     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
421     sdl_lib = sdl_env.Dictionary()['LIBS']
422     # SOLID library information
423     solid_lib = []                                              # TODO
424     solid_libpath = []                                          # TODO
425     solid_include = ['#extern/solid']
426     qhull_lib = []                                              # TODO
427     qhull_libpath = []                                          # TODO
428     qhull_include = ['#extern/qhull/include']
429     # ODE library information
430     ode_lib = []                                                # TODO
431     ode_libpath = []                                            # TODO
432     ode_include = ['#extern/ode/dist/include/ode']
433     # Python variables.
434     python_lib = ['python%d.%d' % sys.version_info[0:2]]
435     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
436     python_include = [sysconfig.get_python_inc ()]
437     python_linkflags = []
438     # International support information
439     ftgl_lib = ['ftgl']
440     ftgl_libpath = ['#../lib/solaris-2.8-sparc/ftgl/lib']
441     ftgl_include = ['#../lib/solaris-2.8-sparc/ftgl/include']
442     freetype_lib = ['freetype']
443     freetype_libpath = ['#../lib/solaris-2.8-sparc/freetype/lib']
444     freetype_include = ['#../lib/solaris-2.8-sparc/freetype/include']
445     gettext_lib = []
446     gettext_libpath = []
447     gettext_include = []
448     # OpenAL library information
449     openal_lib = []
450     openal_libpath = []
451     openal_include = []
452
453 elif string.find (sys.platform, 'irix') != -1:
454     use_international = 'false'
455     use_gameengine = 'false'
456     use_openal = 'false'
457     use_fmod = 'false'
458     use_quicktime = 'false'
459     use_sumo = 'false'
460     use_ode = 'false'
461     use_buildinfo = 'false'
462     build_blender_dynamic = 'true'
463     build_blender_static = 'false'
464     build_blender_player = 'false'
465     build_blender_plugin = 'false'
466     irix_precomp = '#../lib/irix-6.5-mips'
467     extra_flags = ['-n32', '-mips3', '-Xcpluscomm']
468     cxxflags = ['-n32', '-mips3', '-Xcpluscomm', '-LANG:std']
469     cxxflags += ['-LANG:libc_in_namespace_std=off']
470     
471     window_system = 'X11'
472     release_flags = ['-O2', '-OPT:Olimit=0']
473     debug_flags = ['-O2', '-g']
474     defines = []
475     warn_flags = ['-fullwarn', '-woff', '1001,1110,1201,1209,1355,1424,1681,3201']
476     platform_libs = ['movieGL', 'Xmu', 'Xext', 'X11',
477                      'c', 'm', 'dmedia', 'cl', 'audio',
478                      'Cio', 'pthread']
479     platform_libpath = ['/usr/lib32/mips3',
480                         '/lib/freeware/lib32',
481                         '/usr/lib32']
482     platform_linkflags = ['-mips3', '-n32']
483     extra_includes = ['/usr/freeware/include',
484                       '/usr/include']
485     # z library information
486     z_lib = ['z']
487     z_libpath = []
488     z_include = []
489     # png library information
490     png_lib = ['png']
491     png_libpath = [irix_precomp + '/png/lib']
492     png_include = [irix_precomp + '/png/include']
493     # jpeg library information
494     jpeg_lib = ['jpeg']
495     jpeg_libpath = [irix_precomp + '/jpeg/lib']
496     jpeg_include = [irix_precomp + '/jpeg/include']
497     # OpenGL library information
498     opengl_lib = ['GL', 'GLU']
499     opengl_static = []
500     opengl_libpath = []
501     opengl_include = []
502     # SDL library information
503     sdl_cflags = []
504     sdl_include = [irix_precomp + '/sdl/include/SDL']
505     sdl_libpath = [irix_precomp + '/sdl/lib']
506     sdl_lib = ['SDL', 'libSDL.a']
507     # SOLID library information
508     solid_lib = []                                              # TODO
509     solid_libpath = []                                          # TODO
510     solid_include = [irix_precomp + '/solid/include']
511     qhull_lib = []                                              # TODO
512     qhull_libpath = []                                          # TODO
513     qhull_include = ['#extern/qhull/include']
514     # ODE library information
515     ode_lib = []                                                # TODO
516     ode_libpath = []                                            # TODO
517     ode_include = [irix_precomp + '/ode/include']
518     # Python library information
519     python_libpath = [irix_precomp + '/python/lib/python2.2/config']
520     python_include = [irix_precomp + '/python/include/python2.2']
521     python_lib = ['python2.2']
522     python_linkflags = []
523     # International support information
524     ftgl_lib = ['ftgl']
525     ftgl_libpath = [irix_precomp + '/ftgl/lib']
526     ftgl_include = [irix_precomp + '/ftgl/include']
527     freetype_lib = ['freetype']
528     freetype_libpath = [irix_precomp + '/freetype/lib']
529     freetype_include = [irix_precomp + '/freetype/include']
530     gettext_lib = []
531     gettext_libpath = []
532     gettext_include = []
533     # OpenAL library information
534     openal_lib = []
535     openal_libpath = []
536     openal_include = []
537
538 elif string.find (sys.platform, 'hp-ux') != -1:
539     window_system = 'X11'
540     defines = []
541
542 elif sys.platform=='openbsd3':
543     print "Building for OpenBSD 3.x"
544     use_international = 'false'
545     use_gameengine = 'false'
546     use_openal = 'false'
547     use_fmod = 'false'
548     use_quicktime = 'false'
549     use_sumo = 'false'
550     use_ode = 'false'
551     use_buildinfo = 'true'
552     build_blender_dynamic = 'true'
553     build_blender_static = 'false'
554     build_blender_player = 'false'
555     build_blender_plugin = 'false'
556     release_flags = ['-O2']
557     debug_flags = ['-O2', '-g']
558     extra_flags = ['-pipe', '-fPIC', '-funsigned-char']
559     cxxflags = []
560     defines = []
561     warn_flags = ['-Wall','-W']
562     window_system = 'X11'
563     platform_libs = ['m', 'stdc++', 'pthread', 'util']
564     platform_libpath = []
565     platform_linkflags = []
566     extra_includes = []
567     z_lib = ['z']
568     z_libpath = ['/usr/lib']
569     z_include = ['/usr/include']
570     # png library information
571     png_lib = ['png']
572     png_libpath = ['/usr/local/lib']
573     png_include = ['/usr/local/include']
574     # jpeg library information
575     jpeg_lib = ['jpeg']
576     jpeg_libpath = ['/usr/local/lib']
577     jpeg_include = ['/usr/local/include']
578     # OpenGL library information
579     opengl_lib = ['GL', 'GLU']
580     opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
581     opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
582     opengl_include = ['/usr/X11R6/include/']
583     # SDL library information
584     sdl_env.ParseConfig ('sdl-config --cflags --libs')
585     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
586     sdl_include = sdl_env.Dictionary()['CPPPATH']
587     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
588     sdl_lib = sdl_env.Dictionary()['LIBS']
589     # SOLID library information
590     solid_lib = []                     # TODO
591     solid_libpath = []        # TODO
592     solid_include = ['#extern/solid']
593     qhull_lib = []       # TODO
594     qhull_libpath = []  # TODO
595     qhull_include = ['#extern/qhull/include']
596     # ODE library information
597     ode_lib = ['ode']
598     ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
599     ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
600     # Python library information
601     python_lib = ['python%d.%d' % sys.version_info[0:2]]
602     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
603     python_include = [sysconfig.get_python_inc ()]
604     python_linkflags = []
605     # International support information
606     ftgl_lib = ['ftgl']
607     ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
608     ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
609     freetype_env.ParseConfig('pkg-config --cflags --libs freetype2')
610     freetype_lib = freetype_env.Dictionary()['LIBS']
611     freetype_libpath = freetype_env.Dictionary()['LIBPATH']
612     freetype_include = freetype_env.Dictionary()['CPPPATH']
613     gettext_lib = []
614     gettext_libpath = []
615     gettext_include = []
616     # OpenAL library information
617     openal_lib = ['openal']
618     openal_libpath = ['/usr/lib']
619     openal_include = ['/usr/include']
620
621 else:
622     print "Unknown platform %s"%sys.platform
623     exit
624
625 #-----------------------------------------------------------------------------
626 # End of platform specific section
627 #-----------------------------------------------------------------------------
628
629 #-----------------------------------------------------------------------------
630 # User configurable options to be saved in a config file.
631 #-----------------------------------------------------------------------------
632 # Checking for an existing config file - use that one if it exists,
633 # otherwise create one.
634 if os.path.exists (config_file):
635     print "Using config file: " + config_file
636 else:
637     print "Creating new config file: " + config_file
638     env_dict = env.Dictionary()
639     config=open (config_file, 'w')
640     config.write ("# Configuration file containing user definable options.\n")
641     config.write ("VERSION = '2.32-cvs'\n")
642     config.write ("BUILD_BINARY = 'release'\n")
643     config.write ("USE_BUILDINFO = %r\n"%(use_buildinfo))
644     config.write ("BUILD_BLENDER_DYNAMIC = %r\n"%(build_blender_dynamic))
645     config.write ("BUILD_BLENDER_STATIC = %r\n"%(build_blender_static))
646     config.write ("BUILD_BLENDER_PLAYER = %r\n"%(build_blender_player))
647     config.write ("BUILD_BLENDER_PLUGIN = %r\n"%(build_blender_plugin))
648     config.write ("BUILD_DIR = %r\n"%(root_build_dir))
649     config.write ("USE_INTERNATIONAL = %r\n"%(use_international))
650     config.write ("BUILD_GAMEENGINE = %r\n"%(use_gameengine))
651     if use_ode == 'true':
652         config.write ("USE_PHYSICS = 'ode'\n")
653     else:
654         config.write ("USE_PHYSICS = 'solid'\n")
655     config.write ("USE_OPENAL = %r\n"%(use_openal))
656     config.write ("USE_FMOD = %r\n"%(use_fmod))
657     config.write ("USE_QUICKTIME = %r\n"%(use_quicktime))
658     config.write ("\n# Compiler information.\n")
659     config.write ("HOST_CC = %r\n"%(env_dict['CC']))
660     config.write ("HOST_CXX = %r\n"%(env_dict['CXX']))
661     config.write ("TARGET_CC = %r\n"%(env_dict['CC']))
662     config.write ("TARGET_CXX = %r\n"%(env_dict['CXX']))
663     config.write ("TARGET_AR = %r\n"%(env_dict['AR']))
664     config.write ("PATH = %r\n"%(os.environ['PATH']))
665     config.write ("\n# External library information.\n")
666     config.write ("PLATFORM_LIBS = %r\n"%(platform_libs))
667     config.write ("PLATFORM_LIBPATH = %r\n"%(platform_libpath))
668     config.write ("PLATFORM_LINKFLAGS = %r\n"%(platform_linkflags))
669     config.write ("PYTHON_INCLUDE = %r\n"%(python_include))
670     config.write ("PYTHON_LIBPATH = %r\n"%(python_libpath))
671     config.write ("PYTHON_LIBRARY = %r\n"%(python_lib))
672     config.write ("PYTHON_LINKFLAGS = %r\n"%(python_linkflags))
673     config.write ("SDL_CFLAGS = %r\n"%(sdl_cflags))
674     config.write ("SDL_INCLUDE = %r\n"%(sdl_include))
675     config.write ("SDL_LIBPATH = %r\n"%(sdl_libpath))
676     config.write ("SDL_LIBRARY = %r\n"%(sdl_lib))
677     config.write ("Z_INCLUDE = %r\n"%(z_include))
678     config.write ("Z_LIBPATH = %r\n"%(z_libpath))
679     config.write ("Z_LIBRARY = %r\n"%(z_lib))
680     config.write ("PNG_INCLUDE = %r\n"%(png_include))
681     config.write ("PNG_LIBPATH = %r\n"%(png_libpath))
682     config.write ("PNG_LIBRARY = %r\n"%(png_lib))
683     config.write ("JPEG_INCLUDE = %r\n"%(jpeg_include))
684     config.write ("JPEG_LIBPATH = %r\n"%(jpeg_libpath))
685     config.write ("JPEG_LIBRARY = %r\n"%(jpeg_lib))
686     config.write ("OPENGL_INCLUDE = %r\n"%(opengl_include))
687     config.write ("OPENGL_LIBPATH = %r\n"%(opengl_libpath))
688     config.write ("OPENGL_LIBRARY = %r\n"%(opengl_lib))
689     config.write ("OPENGL_STATIC = %r\n"%(opengl_static))
690     config.write ("\n# The following information is only necessary when you've enabled support for\n")
691     config.write ("# the game engine.\n")
692     config.write ("SOLID_INCLUDE = %r\n"%(solid_include))
693     config.write ("SOLID_LIBPATH = %r\n"%(solid_libpath))
694     config.write ("SOLID_LIBRARY = %r\n"%(solid_lib))
695     config.write ("QHULL_INCLUDE = %r\n"%(qhull_include))
696     config.write ("QHULL_LIBPATH = %r\n"%(qhull_libpath))
697     config.write ("QHULL_LIBRARY = %r\n"%(qhull_lib))
698     config.write ("ODE_INCLUDE = %r\n"%(ode_include))
699     config.write ("ODE_LIBPATH = %r\n"%(ode_libpath))
700     config.write ("ODE_LIBRARY = %r\n"%(ode_lib))
701     config.write ("OPENAL_INCLUDE = %r\n"%(openal_include))
702     config.write ("OPENAL_LIBPATH = %r\n"%(openal_libpath))
703     config.write ("OPENAL_LIBRARY = %r\n"%(openal_lib))
704     config.write ("\n# The following information is only necessary when building with\n")
705     config.write ("# internationalization support.\n");
706     config.write ("FTGL_INCLUDE = %r\n"%(ftgl_include))
707     config.write ("FTGL_LIBPATH = %r\n"%(ftgl_libpath))
708     config.write ("FTGL_LIBRARY = %r\n"%(ftgl_lib))
709     config.write ("FREETYPE_INCLUDE = %r\n"%(freetype_include))
710     config.write ("FREETYPE_LIBPATH = %r\n"%(freetype_libpath))
711     config.write ("FREETYPE_LIBRARY = %r\n"%(freetype_lib))
712     config.write ("GETTEXT_INCLUDE = %r\n"%(gettext_include))
713     config.write ("GETTEXT_LIBPATH = %r\n"%(gettext_libpath))
714     config.write ("GETTEXT_LIBRARY = %r\n"%(gettext_lib))
715     config.close ()
716
717 #-----------------------------------------------------------------------------
718 # Read the options from the config file and update the various necessary flags
719 #-----------------------------------------------------------------------------
720 list_opts = []
721 user_options_env = Environment ()
722 user_options = Options (config_file)
723 user_options.AddOptions (
724         ('VERSION', 'Blender version', version),
725         (EnumOption ('BUILD_BINARY', 'release',
726                      'Select a release or debug binary.',
727                      allowed_values = ('release', 'debug'))),
728         (BoolOption ('USE_BUILDINFO',
729                      'Set to 1 if you want to add build information.',
730                      'false')),
731         (BoolOption ('BUILD_BLENDER_DYNAMIC',
732                      'Set to 1 if you want to build blender with hardware accellerated OpenGL support.',
733                      'true')),
734         (BoolOption ('BUILD_BLENDER_STATIC',
735                      'Set to 1 if you want to build blender with software OpenGL support.',
736                      'false')),
737         (BoolOption ('BUILD_BLENDER_PLAYER',
738                      'Set to 1 if you want to build the blender player.',
739                      'false')),
740         (BoolOption ('BUILD_BLENDER_PLUGIN',
741                      'Set to 1 if you want to build the blender plugin.',
742                      'false')),
743         ('BUILD_DIR', 'Target directory for intermediate files.',
744                      root_build_dir),
745         (BoolOption ('USE_INTERNATIONAL',
746                      'Set to 1 to have international support.',
747                      'false')),
748         (EnumOption ('USE_PHYSICS', 'solid',
749                      'Select which physics engine to use.',
750                      allowed_values = ('ode', 'solid'))),
751         (BoolOption ('BUILD_GAMEENGINE',
752                      'Set to 1 to build blender with game engine support.',
753                      'false')),
754         (BoolOption ('USE_OPENAL',
755                      'Set to 1 to build the game engine with OpenAL support.',
756                      'false')),
757         (BoolOption ('USE_FMOD',
758                      'Set to 1 to build the game engine with FMod support.',
759                      'false')),
760         (BoolOption ('USE_QUICKTIME',
761                      'Set to 1 to add support for QuickTime.',
762                      'false')),
763         ('HOST_CC', 'C compiler for the host platfor. This is the same as target platform when not cross compiling.'),
764         ('HOST_CXX', 'C++ compiler for the host platform. This is the same as target platform when not cross compiling.'),
765         ('TARGET_CC', 'C compiler for the target platform.'),
766         ('TARGET_CXX', 'C++ compiler for the target platform.'),
767         ('TARGET_AR', 'Linker command for linking libraries.'),
768         ('PATH', 'Standard search path'),
769         ('PLATFORM_LIBS', 'Platform specific libraries.'),
770         ('PLATFORM_LIBPATH', 'Platform specific library link path.'),
771         ('PLATFORM_LINKFLAGS', 'Platform specific linkflags'),
772         ('PYTHON_INCLUDE', 'Include directory for Python header files.'),
773         ('PYTHON_LIBPATH', 'Library path where the Python lib is located.'),
774         ('PYTHON_LIBRARY', 'Python library name.'),
775         ('PYTHON_LINKFLAGS', 'Python specific linkflags.'),
776         ('SDL_CFLAGS', 'Necessary CFLAGS when using sdl functionality.'),
777         ('SDL_INCLUDE', 'Include directory for SDL header files.'),
778         ('SDL_LIBPATH', 'Library path where the SDL library is located.'),
779         ('SDL_LIBRARY', 'SDL library name.'),
780         ('Z_INCLUDE', 'Include directory for zlib header files.'),
781         ('Z_LIBPATH', 'Library path where the zlib library is located.'),
782         ('Z_LIBRARY', 'Z library name.'),
783         ('PNG_INCLUDE', 'Include directory for png header files.'),
784         ('PNG_LIBPATH', 'Library path where the png library is located.'),
785         ('PNG_LIBRARY', 'png library name.'),
786         ('JPEG_INCLUDE', 'Include directory for jpeg header files.'),
787         ('JPEG_LIBPATH', 'Library path where the jpeg library is located.'),
788         ('JPEG_LIBRARY', 'jpeg library name.'),
789         ('OPENGL_INCLUDE', 'Include directory for OpenGL header files.'),
790         ('OPENGL_LIBPATH', 'Library path where the OpenGL libraries are located.'),
791         ('OPENGL_LIBRARY', 'OpenGL library names.'),
792         ('OPENGL_STATIC', 'Linker flags for static linking of Open GL.'),
793         ('SOLID_INCLUDE', 'Include directory for SOLID header files.'),
794         ('SOLID_LIBPATH', 'Library path where the SOLID library is located.'),
795         ('SOLID_LIBRARY', 'SOLID library name.'),
796         ('QHULL_INCLUDE', 'Include directory for QHULL header files.'),
797         ('QHULL_LIBPATH', 'Library path where the QHULL library is located.'),
798         ('QHULL_LIBRARY', 'QHULL library name.'),
799         ('ODE_INCLUDE', 'Include directory for ODE header files.'),
800         ('ODE_LIBPATH', 'Library path where the ODE library is located.'),
801         ('ODE_LIBRARY', 'ODE library name.'),
802         ('OPENAL_INCLUDE', 'Include directory for OpenAL header files.'),
803         ('OPENAL_LIBPATH', 'Library path where the OpenAL library is located.'),
804         ('OPENAL_LIBRARY', 'OpenAL library name.'),
805         ('FTGL_INCLUDE', 'Include directory for ftgl header files.'),
806         ('FTGL_LIBPATH', 'Library path where the ftgl library is located.'),
807         ('FTGL_LIBRARY', 'ftgl library name.'),
808         ('FREETYPE_INCLUDE', 'Include directory for freetype2 header files.'),
809         ('FREETYPE_LIBPATH', 'Library path where the freetype2 library is located.'),
810         ('FREETYPE_LIBRARY', 'Freetype2 library name.'),
811         ('GETTEXT_INCLUDE', 'Include directory for gettext header files.'),
812         ('GETTEXT_LIBPATH', 'Library path where the gettext library is located.'),
813         ('GETTEXT_LIBRARY', 'gettext library name.')
814     )
815 user_options.Update (user_options_env)
816 user_options_dict = user_options_env.Dictionary()
817
818 root_build_dir = user_options_dict['BUILD_DIR']
819     
820 if user_options_dict['BUILD_GAMEENGINE'] == 1:
821     defines += ['GAMEBLENDER=1']
822     if user_options_dict['USE_PHYSICS'] == 'ode':
823         defines += ['USE_ODE']
824     else:
825         defines += ['USE_SUMO_SOLID']
826 else:
827     defines += ['GAMEBLENDER=0']
828
829 if user_options_dict['BUILD_BINARY'] == 'release':
830     cflags = extra_flags + release_flags + warn_flags
831     if sys.platform == 'win32':
832         defines += ['NDEBUG']
833 else:
834     cflags = extra_flags + debug_flags + warn_flags
835     if sys.platform == 'win32':
836         #defines += ['_DEBUG'] specifying this makes msvc want to link to python22_d.lib??
837         platform_linkflags += ['/DEBUG','/PDB:blender.pdb']
838
839 #-----------------------------------------------------------------------------
840 # Generic library generation environment. This one is the basis for each
841 # library.
842 #-----------------------------------------------------------------------------
843 library_env = env.Copy ()
844 library_env.Replace (CC = user_options_dict['TARGET_CC'])
845 library_env.Replace (CXX = user_options_dict['TARGET_CXX'])
846 library_env.Replace (PATH = user_options_dict['PATH'])
847 library_env.Replace (AR = user_options_dict['TARGET_AR'])
848 library_env.Append (CCFLAGS = cflags)
849 library_env.Append (CXXFLAGS = cxxflags)
850 library_env.Append (CPPDEFINES = defines)
851 library_env.SConsignFile (root_build_dir+'scons-signatures')
852
853 #-----------------------------------------------------------------------------
854 # Settings to be exported to other SConscript files
855 #-----------------------------------------------------------------------------
856
857 Export ('cflags')
858 Export ('defines')
859 Export ('window_system')
860 Export ('extra_includes')
861 Export ('user_options_dict')
862 Export ('library_env')
863
864 BuildDir (root_build_dir+'/extern', 'extern', duplicate=0)
865 SConscript (root_build_dir+'extern/SConscript')
866 BuildDir (root_build_dir+'/intern', 'intern', duplicate=0)
867 SConscript (root_build_dir+'intern/SConscript')
868 BuildDir (root_build_dir+'/source', 'source', duplicate=0)
869 SConscript (root_build_dir+'source/SConscript')
870
871 libpath = (['#'+root_build_dir+'/lib'])
872
873 libraries = (['blender_creator',
874               'blender_render',
875               'blender_yafray',
876               'blender_blendersrc',
877               'blender_renderconverter',
878               'blender_blenloader',
879               'blender_readblenfile',
880               'blender_img',
881               'blender_radiosity',
882               'blender_blenkernel',
883               'blender_blenpluginapi',
884               'blender_imbuf',
885               'blender_avi',
886               'blender_blenlib',
887               'blender_makesdna',
888               'blender_kernel',
889               'blender_BSP',
890               'blender_LOD',
891               'blender_GHOST',
892               'blender_STR',
893               'blender_guardedalloc',
894               'blender_BMF',
895               'blender_CTR',
896               'blender_MEM',
897               'blender_IK',
898               'blender_MT',
899               'soundsystem'])
900
901 link_env = library_env.Copy ()
902 link_env.Append (LIBS=libraries)
903 link_env.Append (LIBPATH=libpath)
904
905 if user_options_dict['USE_INTERNATIONAL'] == 1:
906     link_env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
907     link_env.Append (LIBPATH=user_options_dict['FREETYPE_LIBPATH'])
908     link_env.Append (LIBS=['blender_FTF'])
909     link_env.Append (LIBS=user_options_dict['FTGL_LIBRARY'])
910     link_env.Append (LIBPATH=user_options_dict['FTGL_LIBPATH'])
911     link_env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
912 if user_options_dict['USE_QUICKTIME'] == 1:
913     link_env.Append (LIBS=['blender_quicktime'])
914
915 if user_options_dict['BUILD_GAMEENGINE'] == 1:
916         link_env.Append (LIBS=['KX_blenderhook',
917                                                    'KX_converter',
918                                                    'PHY_Dummy',
919                                                    'PHY_Physics',
920                                                    'KX_ketsji',
921                                                    'SCA_GameLogic',
922                                                    'RAS_rasterizer',
923                                                    'RAS_OpenGLRasterizer',
924                                                    'blender_expressions',
925                                                    'SG_SceneGraph',
926                                                    'blender_MT',
927                                                    'KX_blenderhook',
928                                                    'KX_network',
929                                                    'blender_kernel',
930                                                    'NG_network',
931                                                    'NG_loopbacknetwork'])
932         if user_options_dict['USE_PHYSICS'] == 'solid':
933                 link_env.Append (LIBS=['PHY_Sumo', 'PHY_Physics', 'blender_MT', 'extern_solid', 'extern_qhull'])
934         else:
935                 link_env.Append (LIBS=['PHY_Ode',
936                                                            'PHY_Physics'])
937                 link_env.Append (LIBS=user_options_dict['ODE_LIBRARY'])
938                 link_env.Append (LIBPATH=user_options_dict['ODE_LIBPATH'])
939
940 link_env.Append (LIBS=['blender_python'])
941 link_env.Append (LIBS=user_options_dict['PYTHON_LIBRARY'])
942 link_env.Append (LIBPATH=user_options_dict['PYTHON_LIBPATH'])
943 link_env.Append (LINKFLAGS=user_options_dict['PYTHON_LINKFLAGS'])
944 link_env.Append (LIBS=user_options_dict['SDL_LIBRARY'])
945 link_env.Append (LIBPATH=user_options_dict['SDL_LIBPATH'])
946 link_env.Append (LIBS=user_options_dict['PNG_LIBRARY'])
947 link_env.Append (LIBPATH=user_options_dict['PNG_LIBPATH'])
948 link_env.Append (LIBS=user_options_dict['JPEG_LIBRARY'])
949 link_env.Append (LIBPATH=user_options_dict['JPEG_LIBPATH'])
950 link_env.Append (LIBS=user_options_dict['GETTEXT_LIBRARY'])
951 link_env.Append (LIBPATH=user_options_dict['GETTEXT_LIBPATH'])
952 link_env.Append (LIBS=user_options_dict['Z_LIBRARY'])
953 link_env.Append (LIBPATH=user_options_dict['Z_LIBPATH'])
954 if user_options_dict['USE_OPENAL'] == 1:
955     link_env.Append (LIBS=user_options_dict['OPENAL_LIBRARY'])
956     link_env.Append (LIBPATH=user_options_dict['OPENAL_LIBPATH'])
957 link_env.Append (LIBS=user_options_dict['PLATFORM_LIBS'])
958 link_env.Append (LIBPATH=user_options_dict['PLATFORM_LIBPATH'])
959 if sys.platform == 'darwin':
960     link_env.Append (LINKFLAGS='-framework')
961     link_env.Append (LINKFLAGS='Carbon')
962     link_env.Append (LINKFLAGS='-framework')
963     link_env.Append (LINKFLAGS='AGL')
964     if user_options_dict['USE_QUICKTIME'] == 1:
965         link_env.Append (LINKFLAGS='-framework')
966         link_env.Append (LINKFLAGS='QuickTime')
967 else:
968     link_env.Append (LINKFLAGS=user_options_dict['PLATFORM_LINKFLAGS'])
969
970 if sys.platform == 'win32':
971     link_env.RES(['source/icons/winblender.rc'])
972
973 link_env.BuildDir (root_build_dir, '.', duplicate=0)
974
975 build_date = time.strftime ("%Y-%m-%d")
976 build_time = time.strftime ("%H:%M:%S")
977
978 if user_options_dict['BUILD_BLENDER_DYNAMIC'] == 1:
979     dy_blender = link_env.Copy ()
980     dy_blender.Append (LIBS=user_options_dict['OPENGL_LIBRARY'])
981     dy_blender.Append (LIBPATH=user_options_dict['OPENGL_LIBPATH'])
982     dy_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
983     if user_options_dict['USE_BUILDINFO'] == 1:
984         if sys.platform=='win32':
985             build_info_file = open("source/creator/winbuildinfo.h", 'w')
986             build_info_file.write("char *build_date=\"%s\";\n"%build_date)
987             build_info_file.write("char *build_time=\"%s\";\n"%build_time)
988             build_info_file.write("char *build_platform=\"win32\";\n")
989             build_info_file.write("char *build_type=\"dynamic\";\n")
990             build_info_file.close()
991             dy_blender.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
992         else:
993             dy_blender.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
994                                          'BUILD_DATE=\'"%s"\''%(build_date),
995                                          'BUILD_TYPE=\'"dynamic"\'',
996                                          'NAN_BUILDINFO',
997                                          'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
998     d_obj = [dy_blender.Object (root_build_dir+'source/creator/d_buildinfo',
999                                 [root_build_dir+'source/creator/buildinfo.c'])]
1000     if sys.platform == 'win32':
1001         dy_blender.Program (target='blender',
1002                             source=d_obj + ['source/icons/winblender.res'])
1003     else:
1004         if sys.platform == 'cygwin':
1005             dy_blender.Replace (CC='g++')
1006         dy_blender.Program (target='blender', source=d_obj)
1007 if user_options_dict['BUILD_BLENDER_STATIC'] == 1:
1008     st_blender = link_env.Copy ()
1009     # The next line is to make sure that the LINKFLAGS are appended at the end
1010     # of the link command. This 'trick' is needed because the GL and GLU static
1011     # libraries need to be at the end of the command.
1012     st_blender.Replace(LINKCOM="$LINK -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS")
1013     if user_options_dict['USE_BUILDINFO'] == 1:
1014         if sys.platform=='win32':
1015             build_info_file = open("source/creator/winbuildinfo.h", 'w')
1016             build_info_file.write("char *build_date=\"%s\";\n"%build_date)
1017             build_info_file.write("char *build_time=\"%s\";\n"%build_time)
1018             build_info_file.write("char *build_platform=\"win32\";\n")
1019             build_info_file.write("char *build_type=\"static\";\n")
1020             build_info_file.close()
1021             st_blender.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
1022         else:
1023             st_blender.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
1024                                          'BUILD_DATE=\'"%s"\''%(build_date),
1025                                          'BUILD_TYPE=\'"static"\'',
1026                                          'NAN_BUILDINFO',
1027                                          'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
1028     st_blender.Append (LINKFLAGS=user_options_dict['OPENGL_STATIC'])
1029     st_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1030     s_obj = [st_blender.Object (root_build_dir+'source/creator/s_buildinfo',
1031                                 [root_build_dir+'source/creator/buildinfo.c'])]
1032     st_blender.Prepend (LIBPATH=['/usr/lib/opengl/xfree/lib'])
1033     st_blender.Program (target='blenderstatic', source=s_obj)
1034
1035 if sys.platform == 'darwin':
1036     bundle = Environment ()
1037     blender_app = 'blender'
1038     bundle.Depends ('#/blender.app/Contents/MacOS/' + blender_app, blender_app)
1039     bundle.Command ('#/blender.app/Contents/Info.plist',
1040                     '#/source/darwin/blender.app/Contents/Info.plist',
1041                     "rm -rf blender.app && " + \
1042                     "cp -R source/darwin/blender.app . && " +
1043                     "cat $SOURCE | sed s/VERSION/`cat release/VERSION`/ | \
1044                                    sed s/DATE/`date +'%Y-%b-%d'`/ \
1045                                    > $TARGET")
1046     bundle.Command ('blender.app/Contents/MacOS/' + blender_app, blender_app,
1047                     'cp $SOURCE $TARGET && ' + \
1048                     'chmod +x $TARGET && ' + \
1049                     'find $SOURCE -name CVS -prune -exec rm -rf {} \; && ' +
1050                     'find $SOURCE -name .DS_Store -exec rm -rf {} \;')
1051 elif sys.platform=='win32':
1052     if user_options_dict['BUILD_BINARY']=='debug':
1053         browser = Environment()
1054         browser_tmp = root_build_dir+'bscmake.tmp'
1055         browser.Command ('blender.bsc', 'blender$PROGSUFFIX',
1056             ['dir /b/s '+root_build_dir+'*.sbr >'+browser_tmp,
1057              'bscmake /nologo /n /oblender.bsc @'+browser_tmp,
1058              'del '+browser_tmp])