uh should have read the patch better, i did test it and it works :)
[blender.git] / SConstruct
1 #!/usr/bin/env python
2 import string
3 import os
4 import time
5 import sys
6 from distutils import sysconfig
7 from tools.scons.bs import *
8
9 bs_globals.arguments = ARGUMENTS
10 bs_globals.targets = COMMAND_LINE_TARGETS
11
12 print 'targets = ',bs_globals.targets
13 print 'arguments = ', bs_globals.arguments
14 print os.getcwd()
15
16 appname = ''
17 playername = ''
18 config_guess = ''
19
20 bs_config.checkPyVersion()
21
22 if sys.platform != 'win32':
23         #~ sys.stdout = os.popen("tee build.log", "w")
24         #~ sys.stderr = sys.stdout
25         # guess at the platform, used to maintain the tarball naming scheme
26         config_guess = os.popen("SRCHOME=source/ source/tools/guess/guessconfig").read()[:-1]
27 else:
28         config_guess = "windows"
29
30 #the above check is not enough for darwin. we way want to build for darwin/X11
31 #more, now even for Os X, we need to check and take in account arch 
32 #(PPC, x86, universal binaries) 
33 if sys.platform == 'darwin':
34         appname = 'blender'
35         playername = 'blenderplayer'
36 else:
37         appname = 'blender$PROGSUFFIX'
38         playername = 'blenderplayer$PROGSUFFIX'
39
40 # Build directory.
41 # root_build_dir = '..' + os.sep + 'build' + os.sep + sys.platform + os.sep
42
43 bs_config.parseOpts()
44
45 # Create the build directory. SCons does this automatically, but since we
46 # don't want to put scons-generated .sconsign files in the source tree, but in
47 # the root_build_dir, we have to create that dir ourselves before SCons tries
48 # to access/create the file containing .sconsign data.
49 # we need to create the top level hierarchy too (at least on Os X) 
50 if os.path.isdir (bs_globals.root_build_dir) == 0:
51         os.makedirs (bs_globals.root_build_dir)
52         os.makedirs (bs_globals.root_build_dir+os.sep+'extern')
53         os.makedirs (bs_globals.root_build_dir+os.sep+'intern')
54         os.makedirs (bs_globals.root_build_dir+os.sep+'source')
55
56 # Blender version.
57 version='2.40-alpha1'
58 shortversion = '240alpha1' # for wininst target -> nsis installer creation
59
60 sdl_env = Environment (ENV = os.environ)
61 freetype_env = Environment (ENV = os.environ)
62 env = Environment (ENV = os.environ)
63
64 if sys.platform == 'linux2' or sys.platform == 'linux-i386':
65         use_international = 'true'
66         use_gameengine = 'true'
67         use_openal = 'false'
68         use_fmod = 'false'
69         use_quicktime = 'false'
70         use_sumo = 'true'
71         use_ode = 'false'
72         use_bullet = 'true'
73         use_buildinfo = 'true'
74         use_fluidsim = 'true'
75         build_blender_dynamic = 'true'
76         build_blender_static = 'false'
77         build_blender_player = 'true'
78         build_blender_plugin = 'false'
79         release_flags = ['-O2']
80         debug_flags = ['-O2', '-g']
81         extra_flags = ['-pipe', '-funsigned-char']
82         cxxflags = []
83         defines = []
84         warn_flags = ['-Wall', '-W']
85         window_system = 'X11'
86         platform_libs = ['m', 'util', 'stdc++']
87         platform_libpath = []
88         platform_linkflags = ['-pthread']
89         extra_includes = []
90         # z library information
91         z_lib = ['z']
92         z_libpath = ['/usr/lib']
93         z_include = ['/usr/include']
94         # png library information
95         png_lib = ['png']
96         png_libpath = ['/usr/lib']
97         png_include = ['/usr/include']
98         # jpeg library information
99         jpeg_lib = ['jpeg']
100         jpeg_libpath = ['/usr/lib']
101         jpeg_include = ['/usr/include']
102         #tiff library information
103         tiff_lib = ['tiff']
104         tiff_libpath = ['/usr/lib']
105         tiff_include = ['/usr/include']
106         # OpenGL library information
107         opengl_lib = ['GL', 'GLU']
108         opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
109         opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
110         opengl_include = ['/usr/include', '/usr/X11R6/include']
111         # SDL library information
112         sdl_env.ParseConfig ('sdl-config --cflags --libs')
113         sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
114         sdl_include = sdl_env.Dictionary()['CPPPATH']
115         sdl_libpath = sdl_env.Dictionary()['LIBPATH']
116         sdl_lib = sdl_env.Dictionary()['LIBS']
117         # SOLID library information
118         solid_lib = []
119         solid_libpath = []
120         solid_include = ['#extern/solid']
121         qhull_lib = []
122         qhull_libpath = []
123         qhull_include = ['#extern/qhull/include']
124         # Bullet library information
125         bullet_lib = []
126         bullet_libpath = []
127         bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
128         # ODE library information
129         ode_lib = ['ode']
130         ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
131         ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
132         # Python library information
133         python_lib = ['python%d.%d' % sys.version_info[0:2]]
134         python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
135         python_include = [sysconfig.get_python_inc ()]
136         python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
137         # International support information
138         ftgl_lib = []
139         ftgl_libpath = []
140         ftgl_include = ['#extern/bFTGL/include']
141         freetype_env.ParseConfig ('pkg-config --cflags --libs freetype2 2>/dev/null || freetype-config --cflags --libs 2>/dev/null')
142         freetype_lib = freetype_env.Dictionary()['LIBS']
143         freetype_libpath = freetype_env.Dictionary()['LIBPATH']
144         freetype_include = freetype_env.Dictionary()['CPPPATH']
145         gettext_lib = []
146         gettext_libpath = []
147         gettext_include = []
148         # OpenAL library information
149         openal_lib = ['openal']
150         openal_libpath = ['/usr/lib']
151         openal_include = ['/usr/include']
152
153 elif sys.platform == 'darwin':
154         use_international = 'true'
155         use_gameengine = 'true'
156         use_openal = 'true'
157         use_fmod = 'false'
158         use_openal = 'false'
159         use_quicktime = 'true'
160         use_precomp = 'true'
161         use_sumo = 'true'
162         use_ode = 'false'
163         use_bullet = 'true'
164         use_buildinfo = 'true'
165         use_fluidsim = 'true'
166         build_blender_dynamic = 'true'
167         build_blender_static = 'false'
168         build_blender_player = 'true'
169         build_blender_plugin = 'false'
170         # TODO: replace darwin-6.1-powerpc with the actual directiory on the
171         #       build machine
172         # darwin-6.1 is the name of cvs precomp folder
173         # a symbolic link named darwin-X.Y-powerpc must be manually done
174         #for now. X-Y is darwin kernel rev number
175         darwin_precomp = '#../lib/darwin-6.1-powerpc/'
176         fink_path = '/sw/'
177         # TODO : try -mpowerpc -mpowerpc-gopt -mpowerpc-gfxopt optims
178         #           doing actual profiling
179         extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-ffast-math', '-mpowerpc', '-mtune=G4']
180         
181         # , '-malign-natural'] malign is causing problems with jpeg lib but worth a 1-2% speedup
182         #'-force_cpusubtype_ALL', '-mpowerpc-gpopt', 
183         cxxflags = []
184         defines = ['_THREAD_SAFE' ]
185         if use_quicktime == 'true':
186                 defines += ['WITH_QUICKTIME']
187         warn_flags = ['-Wall']    # , '-W'
188         release_flags = ['-O2']
189         debug_flags = ['-g']
190         window_system = 'CARBON'
191         # z library information
192         z_lib = ['z']
193         z_libpath = []
194         z_include = []
195         # TODO : add a flag to allow each lib to be build from fink or precomp
196         #        without having to have to specify the path manually in config.opts.    
197         # png library information
198         png_lib = ['libpng']
199         png_libpath = [darwin_precomp + 'png/lib']
200         png_include = [darwin_precomp + 'png/include']
201         # jpeg library information
202         jpeg_lib = ['libjpeg']
203         jpeg_libpath = [darwin_precomp + 'jpeg/lib']
204         jpeg_include = [darwin_precomp + 'jpeg/include']
205         # TIFF library information
206         tiff_lib = ['libtiff']
207         tiff_libpath = [darwin_precomp + 'tiff/lib']
208         tiff_include = [darwin_precomp + 'tiff/include']
209         # OpenGL library information
210         opengl_lib = ['GL', 'GLU']
211         opengl_static = []
212         opengl_libpath = []
213         opengl_include = []
214         # SDL specific stuff.
215         #sdl_env.ParseConfig ('sdl-config --cflags --libs')
216         # Want to use precompiled libraries?
217         if use_precomp == 'true':
218                 sdl_include = [darwin_precomp + 'sdl/include']
219                 sdl_libpath = [darwin_precomp + 'sdl/lib']
220                 sdl_lib = ['libSDL.a']
221                 sdl_cflags = [ '-I' + darwin_precomp + 'sdl/include' ]
222                 sdl_env.Append (CCFLAGS = sdl_cflags )
223                 sdl_env.Append (CPPPATH = [darwin_precomp + 'sdl/include'] )
224
225         platform_libs = ['stdc++'] 
226         extra_includes = ['/sw/include']
227         platform_libpath = ['/System/Library/Frameworks/OpenGL.framework/Libraries']
228         platform_linkflags = []
229         # SOLID library information
230         solid_lib = []                                          
231         solid_libpath = []                                          
232         solid_include = ['#/extern/solid']
233         qhull_lib = []                                          
234         qhull_libpath = []                                          
235         qhull_include = ['#/extern/qhull/include']
236         # Bullet library information
237         bullet_lib = []
238         bullet_libpath = []
239         bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
240         # ODE library information
241         ode_lib = ['libode']                                             
242         ode_libpath = [darwin_precomp + 'ode/lib']                                          
243         ode_include = [darwin_precomp + 'ode/include/ode']
244         # Python variables.
245         # TODO : fill vars differently if we are on 10.2 or 10.3
246         # python_lib = ['python%d.%d' % sys.version_info[0:2]]
247         # python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
248         # python_include = [sysconfig.get_python_inc ()]
249         # python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
250         python_lib = []
251         python_libpath = ['/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config']
252         python_include = ['/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3']
253         python_linkflags = ['-u', '__dummy', '-u', '_PyMac_Error', 
254                                                 '-framework', 'System',
255                                                 '-framework', 'Python',
256                                                 '-framework', 'CoreServices',
257                                                 '-framework', 'Foundation',
258                                                 '-framework', 'OpenGL',
259                                                 '-framework', 'IOKit' , 
260                                                 '-framework', 'AppKit']
261         # International stuff
262         ftgl_lib = ['libftgl']
263         ftgl_libpath = [darwin_precomp + 'ftgl/lib']
264         ftgl_include = ['#extern/bFTGL/include']
265         freetype_lib = ['libfreetype']
266         freetype_libpath = [darwin_precomp + 'freetype/lib']
267         freetype_include = [darwin_precomp + 'freetype/include']
268         gettext_lib = ['libintl']
269         gettext_libpath = [darwin_precomp + 'gettext/lib']
270         gettext_include = [darwin_precomp + 'gettext/include']
271         # OpenAL library information
272         openal_lib = ['libopenal']
273         openal_libpath = [darwin_precomp + 'openal/lib']
274         openal_include = [darwin_precomp + 'openal/include']
275
276 elif sys.platform == 'cygwin':
277         use_international = 'false'
278         use_gameengine = 'false'
279         use_openal = 'false'
280         use_fmod = 'false'
281         use_quicktime = 'false'
282         use_sumo = 'false'
283         use_ode = 'false'
284         use_bullet = 'false'
285         use_buildinfo = 'false'
286         use_fluidsim = 'true'
287         build_blender_dynamic = 'true'
288         build_blender_static = 'false'
289         build_blender_player = 'false'
290         build_blender_plugin = 'false'
291         release_flags = ['-O2']
292         debug_flags = ['-O2', '-g']
293         extra_flags = ['-pipe', '-mno-cygwin', '-mwindows', '-funsigned-char']
294         cxxflags = []
295         defines = ['FREE_WINDOWS']
296         warn_flags = ['-Wall', '-Wno-char-subscripts']
297         platform_libs = ['png', 'jpeg', 'netapi32',
298                                          'opengl32', 'glu32', 'winmm',
299                                          'mingw32']
300         platform_libpath = ['/usr/lib/w32api', '/lib/w32api']
301         platform_linkflags = ['-mwindows', '-mno-cygwin', '-mconsole']
302         window_system = 'WIN32'
303         extra_includes = []
304         # z library information
305         z_lib = ['z']
306         z_libpath = ['#../lib/windows/zlib/lib']
307         z_include = ['#../lib/windows/zlib/include']
308         # png library information
309         png_lib = ['png']
310         png_libpath = ['#../lib/windows/png/lib']
311         png_include = ['#../lib/windows/png/include']
312         # jpeg library information
313         jpeg_lib = ['jpeg']
314         jpeg_libpath = ['#../lib/windows/jpeg/lib']
315         jpeg_include = ['#../lib/windows/jpeg/include']
316         # OpenGL library information
317         opengl_lib = ['opengl32', 'glu32']
318         opengl_static = []
319         opengl_libpath = []
320         opengl_include = []
321         # SDL specific stuff.
322         sdl_include = ['#../lib/windows/sdl/include']
323         sdl_libpath = ['#../lib/windows/sdl/lib']
324         sdl_lib = ['SDL']
325         sdl_cflags = []
326         #sdl_cflags = '-DWIN32'
327         # SOLID library information
328         solid_lib = []
329         solid_libpath = []
330         solid_include = ['#extern/solid']
331         qhull_lib = []
332         qhull_libpath = []
333         qhull_include = ['#extern/qhull/include']
334         # Bullet library information
335         bullet_lib = []
336         bullet_libpath = []
337         bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
338         # ODE library information
339         ode_lib = ['ode']
340         ode_libpath = ['#../lib/windows/gcc/ode/lib']
341         ode_include = ['#../lib/windows/gcc/ode/include']
342         # Python library information
343         python_include = ['#../lib/windows/python/include/python2.2']
344         python_libpath = ['#../lib/windows/python/lib']
345         python_lib = ['python22']
346         python_linkflags = []
347         # International stuff
348         ftgl_lib = []
349         ftgl_libpath = []
350         ftgl_include = ['#extern/bFTGL/include']
351         freetype_lib = ['freetype']
352         freetype_libpath = ['#../lib/windows/gcc/freetype/lib']
353         freetype_include = ['#../lib/windows/gcc/freetype/include']
354         gettext_lib = []
355         gettext_libpath = []
356         gettext_include = []
357         # OpenAL library information
358         openal_lib = []
359         openal_libpath = []
360         openal_include = []
361
362 elif sys.platform == 'win32':
363         use_international = 'true'
364         use_gameengine = 'true'
365         use_openal = 'true'
366         use_fmod = 'false'
367         use_quicktime = 'true'
368         use_bullet = 'true'
369         use_sumo = 'true'
370         use_ode = 'false'
371         use_buildinfo = 'true'
372         use_fluidsim = 'true'
373         build_blender_dynamic = 'true'
374         build_blender_static = 'false'
375         build_blender_player = 'true'
376         build_blender_plugin = 'false'
377         release_flags = ['/Og', '/Ot', '/Ob1', '/Op', '/G6']
378         debug_flags = ['/Zi', '/Fr${TARGET.base}.sbr']
379         extra_flags = ['/EHsc', '/J', '/W3', '/Gd', '/MT']
380         cxxflags = []
381         defines = ['WIN32', '_CONSOLE']
382         if use_quicktime == 'true':
383                 defines += ['WITH_QUICKTIME']
384         defines += ['_LIB', 'USE_OPENAL']
385         defines += ['FTGL_LIBRARY_STATIC']
386         warn_flags = []
387         platform_libs = [ 'qtmlClient', 'soundsystem',
388                                          'ws2_32', 'dxguid', 'vfw32', 'winmm',
389                                          'iconv', 'kernel32', 'user32', 'gdi32',
390                                          'winspool', 'comdlg32', 'advapi32', 'shell32',
391                                          'ole32', 'oleaut32', 'uuid', 
392                                          'libcmt', 'libc']
393         platform_libpath = ['#../lib/windows/iconv/lib',
394                                                 '#../lib/windows/QTDevWin/Libraries']
395         platform_linkflags = [
396                                                 '/SUBSYSTEM:CONSOLE',
397                                                 '/MACHINE:IX86',
398                                                 '/ENTRY:mainCRTStartup',
399                                                 '/INCREMENTAL:NO',
400                                                 '/NODEFAULTLIB:"msvcprt.lib"',
401                                                 '/NODEFAULTLIB:"glut32.lib"',
402                                                 '/NODEFAULTLIB:"libcd.lib"',
403                                                 #'/NODEFAULTLIB:"libc.lib"',
404                                                 '/NODEFAULTLIB:"libcpd.lib"',
405                                                 '/NODEFAULTLIB:"libcp.lib"',
406                                                 '/NODEFAULTLIB:"libcmtd.lib"',
407                                                 ]
408         window_system = 'WIN32'
409         extra_includes = []
410         if use_quicktime == 'true':
411                 extra_includes += ['#../lib/windows/QTDevWin/CIncludes']
412         # z library information
413         z_lib = ['zlib']
414         z_libpath = ['#../lib/windows/zlib/lib']
415         z_include = ['#../lib/windows/zlib/include']
416         # png library information
417         png_lib = ['libpng_st']
418         png_libpath = ['#../lib/windows/png/lib']
419         png_include = ['#../lib/windows/png/include']
420         # jpeg library information
421         jpeg_lib = ['libjpeg']
422         jpeg_libpath = ['#../lib/windows/jpeg/lib']
423         jpeg_include = ['#../lib/windows/jpeg/include']
424         # OpenGL library information
425         opengl_lib = ['opengl32', 'glu32']
426         opengl_static = []
427         opengl_libpath = []
428         opengl_include = ['/usr/include']
429         # SDL library information
430         sdl_include = ['#../lib/windows/sdl/include']
431         sdl_libpath = ['#../lib/windows/sdl/lib']
432         sdl_lib = ['SDL']
433         sdl_cflags = []
434         window_system = 'WIN32'
435         # SOLID library information
436         solid_lib = ['extern/solid']
437         solid_libpath = ['#../lib/windows/solid/lib']
438         solid_include = ['#extern/solid']
439         qhull_lib = ['qhull']
440         qhull_libpath = ['#../lib/windows/qhull/lib']
441         qhull_include = ['#extern/qhull/include']
442         # Bullet library information
443         bullet_lib = []
444         bullet_libpath = []
445         bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
446         # ODE library information
447         ode_lib = []                                                                                            # TODO
448         ode_libpath = ['#../lib/windows/ode/lib']
449         ode_include = ['#../lib/windows/ode/include']
450         # Python lib name
451         python_include = ['#../lib/windows/python/include/python2.4']
452         python_libpath = ['#../lib/windows/python/lib']
453         python_lib = ['python24']
454         python_linkflags = []
455         # International stuff
456         ftgl_lib = []
457         ftgl_libpath = []
458         ftgl_include = ['#extern/bFTGL/include']
459         freetype_lib = ['freetype2ST']
460         freetype_libpath = ['#../lib/windows/freetype/lib']
461         freetype_include = ['#../lib/windows/freetype/include']
462         gettext_lib = ['gnu_gettext']
463         gettext_libpath = ['#../lib/windows/gettext/lib']
464         gettext_include = ['#../lib/windows/gettext/include']
465         # OpenAL library information
466         openal_lib = ['openal_static']
467         openal_libpath = ['#../lib/windows/openal/lib']
468         openal_include = ['#../lib/windows/openal/include']
469
470 elif string.find (sys.platform, 'sunos') != -1:
471         use_international = 'true'
472         use_gameengine = 'false'
473         use_openal = 'false'
474         use_fmod = 'false'
475         use_quicktime = 'false'
476         use_sumo = 'false'
477         use_ode = 'false'
478         use_bullet = 'false'
479         use_buildinfo = 'false'
480         use_fluidsim = 'true'
481         build_blender_dynamic = 'true'
482         build_blender_static = 'false'
483         build_blender_player = 'false'
484         build_blender_plugin = 'false'
485         release_flags = ['-O2']
486         debug_flags = ['-O2', '-g']
487         extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-DSUN_OGL_NO_VERTEX_MACROS']
488         cxxflags = []
489         defines = []
490         warn_flags = ['-Wall', '-W']
491         window_system = 'X11'
492         platform_libs = ['stdc++', 'dl', 'm']
493         platform_libpath = []
494         platform_linkflags = []
495         extra_includes = []
496         # z library information
497         z_lib = ['z']
498         z_libpath = []
499         z_include = []
500         # png library information
501         png_lib = ['png']
502         png_libpath = []
503         png_include = []
504         # jpeg library information
505         jpeg_lib = ['jpeg']
506         jpeg_libpath = []
507         jpeg_include = []
508         # OpenGL library information
509         opengl_lib = ['GL', 'GLU', 'X11']
510         opengl_static = []
511         opengl_libpath = ['/usr/openwin/include']
512         opengl_include = ['/usr/openwin/lib']
513         # SDL library information
514         sdl_env.ParseConfig ('sdl-config --cflags --libs')
515         sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
516         sdl_include = sdl_env.Dictionary()['CPPPATH']
517         sdl_libpath = sdl_env.Dictionary()['LIBPATH']
518         sdl_lib = sdl_env.Dictionary()['LIBS']
519         # SOLID library information
520         solid_lib = []
521         solid_libpath = []
522         solid_include = ['#extern/solid']
523         qhull_lib = []
524         qhull_libpath = []
525         qhull_include = ['#extern/qhull/include']
526         # ODE library information
527         ode_lib = []
528         ode_libpath = []
529         ode_include = ['#extern/ode/dist/include/ode']
530         # Bullet library information
531         bullet_lib = []
532         bullet_libpath = []
533         bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
534         # Python variables.
535         python_lib = ['python%d.%d' % sys.version_info[0:2]]
536         python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
537         python_include = [sysconfig.get_python_inc ()]
538         python_linkflags = []
539         # International support information
540         ftgl_lib = []
541         ftgl_libpath = []
542         ftgl_include = ['#extern/bFTGL/include']
543         freetype_lib = ['freetype']
544         freetype_libpath = ['#../lib/solaris-2.8-sparc/freetype/lib']
545         freetype_include = ['#../lib/solaris-2.8-sparc/freetype/include']
546         gettext_lib = []
547         gettext_libpath = []
548         gettext_include = []
549         # OpenAL library information
550         openal_lib = []
551         openal_libpath = []
552         openal_include = []
553
554 elif string.find (sys.platform, 'irix') != -1:
555         use_international = 'false'
556         use_gameengine = 'false'
557         use_openal = 'false'
558         use_fmod = 'false'
559         use_quicktime = 'false'
560         use_sumo = 'false'
561         use_ode = 'false'
562         use_bullet = 'false'
563         use_buildinfo = 'false'
564         use_fluidsim = 'true'
565         build_blender_dynamic = 'true'
566         build_blender_static = 'false'
567         build_blender_player = 'false'
568         build_blender_plugin = 'false'
569         irix_precomp = '#../lib/irix-6.5-mips'
570         extra_flags = ['-n32', '-mips3', '-Xcpluscomm']
571         cxxflags = ['-n32', '-mips3', '-Xcpluscomm', '-LANG:std']
572         cxxflags += ['-LANG:libc_in_namespace_std=off']
573         
574         window_system = 'X11'
575         release_flags = ['-O2', '-OPT:Olimit=0']
576         debug_flags = ['-O2', '-g']
577         defines = []
578         warn_flags = ['-fullwarn', '-woff', '1001,1110,1201,1209,1355,1424,1681,3201']
579         platform_libs = ['movieGL', 'Xmu', 'Xext', 'X11',
580                                          'c', 'm', 'dmedia', 'cl', 'audio',
581                                          'Cio', 'pthread']
582         platform_libpath = ['/usr/lib32/mips3',
583                                                 '/lib/freeware/lib32',
584                                                 '/usr/lib32']
585         platform_linkflags = ['-mips3', '-n32']
586         extra_includes = ['/usr/freeware/include',
587                                           '/usr/include']
588         # z library information
589         z_lib = ['z']
590         z_libpath = []
591         z_include = []
592         # png library information
593         png_lib = ['png']
594         png_libpath = [irix_precomp + '/png/lib']
595         png_include = [irix_precomp + '/png/include']
596         # jpeg library information
597         jpeg_lib = ['jpeg']
598         jpeg_libpath = [irix_precomp + '/jpeg/lib']
599         jpeg_include = [irix_precomp + '/jpeg/include']
600         # OpenGL library information
601         opengl_lib = ['GL', 'GLU']
602         opengl_static = []
603         opengl_libpath = []
604         opengl_include = []
605         # SDL library information
606         sdl_cflags = []
607         sdl_include = [irix_precomp + '/sdl/include/SDL']
608         sdl_libpath = [irix_precomp + '/sdl/lib']
609         sdl_lib = ['SDL', 'libSDL.a']
610         # SOLID library information
611         solid_lib = []
612         solid_libpath = []
613         solid_include = [irix_precomp + '/solid/include']
614         qhull_lib = []
615         qhull_libpath = []
616         qhull_include = ['#extern/qhull/include']
617         # Bullet library information
618         bullet_lib = []
619         bullet_libpath = []
620         bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
621         # ODE library information
622         ode_lib = []
623         ode_libpath = []
624         ode_include = [irix_precomp + '/ode/include']
625         # Python library information
626         python_libpath = [irix_precomp + '/python/lib/python2.2/config']
627         python_include = [irix_precomp + '/python/include/python2.2']
628         python_lib = ['python2.2']
629         python_linkflags = []
630         # International support information
631         ftgl_lib = []
632         ftgl_libpath = []
633         ftgl_include = ['#extern/bFTGL/include']
634         freetype_lib = ['freetype']
635         freetype_libpath = [irix_precomp + '/freetype/lib']
636         freetype_include = [irix_precomp + '/freetype/include']
637         gettext_lib = []
638         gettext_libpath = []
639         gettext_include = []
640         # OpenAL library information
641         openal_lib = []
642         openal_libpath = []
643         openal_include = []
644
645 elif string.find (sys.platform, 'hp-ux') != -1:
646         window_system = 'X11'
647         defines = []
648
649 elif sys.platform=='openbsd3':
650         print "Building for OpenBSD 3.x"
651         use_international = 'false'
652         use_gameengine = 'false'
653         use_openal = 'false'
654         use_fmod = 'false'
655         use_quicktime = 'false'
656         use_sumo = 'false'
657         use_ode = 'false'
658         use_bullet = 'false'
659         use_buildinfo = 'true'
660         use_fluidsim = 'true'
661         build_blender_dynamic = 'true'
662         build_blender_static = 'false'
663         build_blender_player = 'false'
664         build_blender_plugin = 'false'
665         release_flags = ['-O2']
666         debug_flags = ['-O2', '-g']
667         extra_flags = ['-pipe', '-fPIC', '-funsigned-char']
668         cxxflags = []
669         defines = []
670         warn_flags = ['-Wall','-W']
671         window_system = 'X11'
672         platform_libs = ['m', 'stdc++', 'pthread', 'util']
673         platform_libpath = []
674         platform_linkflags = []
675         extra_includes = []
676         z_lib = ['z']
677         z_libpath = ['/usr/lib']
678         z_include = ['/usr/include']
679         # png library information
680         png_lib = ['png']
681         png_libpath = ['/usr/local/lib']
682         png_include = ['/usr/local/include/libpng']
683         # jpeg library information
684         jpeg_lib = ['jpeg']
685         jpeg_libpath = ['/usr/local/lib']
686         jpeg_include = ['/usr/local/include']
687         # OpenGL library information
688         opengl_lib = ['GL', 'GLU']
689         opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
690         opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
691         opengl_include = ['/usr/X11R6/include/']
692         # SDL library information
693         sdl_env.ParseConfig ('sdl-config --cflags --libs')
694         sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
695         sdl_include = sdl_env.Dictionary()['CPPPATH']
696         sdl_libpath = sdl_env.Dictionary()['LIBPATH']
697         sdl_lib = sdl_env.Dictionary()['LIBS']
698         # SOLID library information
699         solid_lib = []
700         solid_libpath = []
701         solid_include = ['#extern/solid']
702         qhull_lib = []
703         qhull_libpath = []
704         qhull_include = ['#extern/qhull/include']
705         # Bullet library information
706         bullet_lib = []
707         bullet_libpath = []
708         bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
709         # ODE library information
710         ode_lib = ['ode']
711         ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
712         ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
713         # Python library information
714         python_lib = ['python%d.%d' % sys.version_info[0:2]]
715         python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
716         python_include = [sysconfig.get_python_inc ()]
717         python_linkflags = []
718         # International support information
719         ftgl_lib = []
720         ftgl_libpath = []
721         ftgl_include = ['#extern/bFTGL/include']
722         freetype_env.ParseConfig('pkg-config --cflags --libs freetype2')
723         freetype_lib = freetype_env.Dictionary()['LIBS']
724         freetype_libpath = freetype_env.Dictionary()['LIBPATH']
725         freetype_include = freetype_env.Dictionary()['CPPPATH']
726         gettext_lib = []
727         gettext_libpath = []
728         gettext_include = []
729         # OpenAL library information
730         openal_lib = ['openal']
731         openal_libpath = ['/usr/lib']
732         openal_include = ['/usr/include']
733         
734 elif sys.platform=='freebsd4' or sys.platform=='freebsd5':
735         print "Building for FreeBSD"
736         use_international = 'false'
737         use_gameengine = 'false'
738         use_openal = 'false'
739         use_fmod = 'false'
740         use_quicktime = 'false'
741         use_sumo = 'false'
742         use_ode = 'false'
743         use_bullet = 'false'
744         use_buildinfo = 'true'
745         use_fluidsim = 'true'
746         build_blender_dynamic = 'true'
747         build_blender_static = 'false'
748         build_blender_player = 'false'
749         build_blender_plugin = 'false'
750         release_flags = ['-O2']
751         debug_flags = ['-O2', '-g']
752         extra_flags = ['-pipe', '-fPIC', '-funsigned-char']
753         cxxflags = []
754         defines = []
755         warn_flags = ['-Wall','-W']
756         window_system = 'X11'
757         platform_libs = ['m', 'stdc++', 'util']
758         platform_libpath = []
759         platform_linkflags = ['-pthread']
760         extra_includes = []
761         z_lib = ['z']
762         z_libpath = ['/usr/lib']
763         z_include = ['/usr/include']
764         # png library information
765         png_lib = ['png']
766         png_libpath = ['/usr/local/lib']
767         png_include = ['/usr/local/include']
768         # jpeg library information
769         jpeg_lib = ['jpeg']
770         jpeg_libpath = ['/usr/local/lib']
771         jpeg_include = ['/usr/local/include']
772         # OpenGL library information
773         opengl_lib = ['GL', 'GLU']
774         opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
775         opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
776         opengl_include = ['/usr/X11R6/include/']
777         # SDL library information
778         sdl_env.ParseConfig ('sdl11-config --cflags --libs')
779         sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
780         sdl_include = sdl_env.Dictionary()['CPPPATH']
781         sdl_libpath = ['/usr/local/include/SDL11']
782         sdl_lib = sdl_env.Dictionary()['LIBS']
783         # SOLID library information
784         solid_lib = []
785         solid_libpath = []
786         solid_include = ['#extern/solid']
787         qhull_lib = []
788         qhull_libpath = []
789         qhull_include = ['#extern/qhull/include']
790         # Bullet library information
791         bullet_lib = []
792         bullet_libpath = []
793         bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
794         # ODE library information
795         ode_lib = ['ode']
796         ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
797         ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
798         # Python library information
799         python_lib = ['python%d.%d' % sys.version_info[0:2]]
800         python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
801         python_include = [sysconfig.get_python_inc ()]
802         python_linkflags = []
803         # International support information
804         ftgl_lib = []
805         ftgl_libpath = []
806         ftgl_include = ['#extern/bFTGL/include']
807         freetype_env.ParseConfig('pkg-config --cflags --libs freetype2')
808         freetype_lib = freetype_env.Dictionary()['LIBS']
809         freetype_libpath = freetype_env.Dictionary()['LIBPATH']
810         freetype_include = freetype_env.Dictionary()['CPPPATH']
811         gettext_lib = []
812         gettext_libpath = []
813         gettext_include = []
814         # OpenAL library information
815         openal_lib = ['openal']
816         openal_libpath = ['/usr/lib']
817         openal_include = ['/usr/include']
818
819 else:
820         print "Unknown platform %s"%sys.platform
821         exit
822
823 #-----------------------------------------------------------------------------
824 # End of platform specific section
825 #-----------------------------------------------------------------------------
826
827 #-----------------------------------------------------------------------------
828 # User configurable options to be saved in a config file.
829 #-----------------------------------------------------------------------------
830 # Checking for an existing config file - use that one if it exists,
831 # otherwise create one.
832 my_defines = []
833 my_ccflags = []
834 my_cxxflags = []
835 my_ldflags = []
836 if os.path.exists (bs_globals.config_file):
837         print "Using config file: " + bs_globals.config_file
838 else:
839         print "Creating new config file: " + bs_globals.config_file
840         env_dict = env.Dictionary()
841         config=open (bs_globals.config_file, 'w')
842         config.write ("# Configuration file containing user definable options.\n")
843         config.write ("VERSION = %r\n"%(version))
844         config.write ("BUILD_BINARY = 'release'\n")
845         config.write ("USE_BUILDINFO = %r\n"%(use_buildinfo))
846         config.write ("BUILD_BLENDER_DYNAMIC = %r\n"%(build_blender_dynamic))
847         config.write ("BUILD_BLENDER_STATIC = %r\n"%(build_blender_static))
848         config.write ("BUILD_BLENDER_PLAYER = %r\n"%(build_blender_player))
849         config.write ("BUILD_BLENDER_PLUGIN = %r\n"%(build_blender_plugin))
850         config.write ("BUILD_DIR = %r\n"%(bs_globals.root_build_dir))
851         
852         config.write ("\n# Extra compiler flags can be defined here.\n")
853         config.write ("DEFINES = %s\n"%(my_defines))
854         config.write ("CCFLAGS = %s\n"%(my_ccflags))
855         config.write ("CXXFLAGS = %s\n"%(my_cxxflags))
856         config.write ("LDFLAGS = %s\n"%(my_ldflags))
857
858         config.write ("USE_INTERNATIONAL = %r\n"%(use_international))
859         config.write ("BUILD_GAMEENGINE = %r\n"%(use_gameengine))
860         if use_ode == 'true':
861                 config.write ("USE_PHYSICS = 'ode'\n")
862         elif (use_bullet == 'true') and (use_sumo == 'false'):
863                 config.write("USE_PHYSICS = 'bullet'\n")
864         else:
865                 config.write ("USE_PHYSICS = 'solid'\n")
866         config.write ("USE_OPENAL = %r\n"%(use_openal))
867         config.write ("USE_FMOD = %r\n"%(use_fmod))
868         config.write ("USE_QUICKTIME = %r\n"%(use_quicktime))
869         config.write ("USE_FLUIDSIM = %r\n"%(use_fluidsim))
870         config.write ("\n# Compiler information.\n")
871         config.write ("HOST_CC = %r\n"%(env_dict['CC']))
872         config.write ("HOST_CXX = %r\n"%(env_dict['CXX']))
873         config.write ("TARGET_CC = %r\n"%(env_dict['CC']))
874         config.write ("TARGET_CXX = %r\n"%(env_dict['CXX']))
875         config.write ("TARGET_AR = %r\n"%(env_dict['AR']))
876         config.write ("PATH = %r\n"%(os.environ['PATH']))
877         config.write ("\n# External library information.\n")
878         config.write ("PLATFORM_LIBS = %r\n"%(platform_libs))
879         config.write ("PLATFORM_LIBPATH = %r\n"%(platform_libpath))
880         config.write ("PLATFORM_LINKFLAGS = %r\n"%(platform_linkflags))
881         config.write ("PYTHON_INCLUDE = %r\n"%(python_include))
882         config.write ("PYTHON_LIBPATH = %r\n"%(python_libpath))
883         config.write ("PYTHON_LIBRARY = %r\n"%(python_lib))
884         config.write ("PYTHON_LINKFLAGS = %r\n"%(python_linkflags))
885         config.write ("SDL_CFLAGS = %r\n"%(sdl_cflags))
886         config.write ("SDL_INCLUDE = %r\n"%(sdl_include))
887         config.write ("SDL_LIBPATH = %r\n"%(sdl_libpath))
888         config.write ("SDL_LIBRARY = %r\n"%(sdl_lib))
889         config.write ("Z_INCLUDE = %r\n"%(z_include))
890         config.write ("Z_LIBPATH = %r\n"%(z_libpath))
891         config.write ("Z_LIBRARY = %r\n"%(z_lib))
892         config.write ("PNG_INCLUDE = %r\n"%(png_include))
893         config.write ("PNG_LIBPATH = %r\n"%(png_libpath))
894         config.write ("PNG_LIBRARY = %r\n"%(png_lib))
895         config.write ("JPEG_INCLUDE = %r\n"%(jpeg_include))
896         config.write ("JPEG_LIBPATH = %r\n"%(jpeg_libpath))
897         config.write ("JPEG_LIBRARY = %r\n"%(jpeg_lib))
898         config.write ("TIFF_INCLUDE = %r\n"%(tiff_include))
899         config.write ("TIFF_LIBPATH = %r\n"%(tiff_libpath))
900         config.write ("TIFF_LIBRARY = %r\n"%(tiff_lib))
901         config.write ("OPENGL_INCLUDE = %r\n"%(opengl_include))
902         config.write ("OPENGL_LIBPATH = %r\n"%(opengl_libpath))
903         config.write ("OPENGL_LIBRARY = %r\n"%(opengl_lib))
904         config.write ("OPENGL_STATIC = %r\n"%(opengl_static))
905         config.write ("\n# The following information is only necessary when you've enabled support for\n")
906         config.write ("# the game engine.\n")
907         config.write ("SOLID_INCLUDE = %r\n"%(solid_include))
908         config.write ("SOLID_LIBPATH = %r\n"%(solid_libpath))
909         config.write ("SOLID_LIBRARY = %r\n"%(solid_lib))
910         config.write ("QHULL_INCLUDE = %r\n"%(qhull_include))
911         config.write ("QHULL_LIBPATH = %r\n"%(qhull_libpath))
912         config.write ("QHULL_LIBRARY = %r\n"%(qhull_lib))
913         config.write ("ODE_INCLUDE = %r\n"%(ode_include))
914         config.write ("ODE_LIBPATH = %r\n"%(ode_libpath))
915         config.write ("ODE_LIBRARY = %r\n"%(ode_lib))
916         config.write ("BULLET_INCLUDE = %r\n"%(bullet_include))
917         config.write ("BULLET_LIBPATH = %r\n"%(bullet_libpath))
918         config.write ("BULLET_LIBRARY = %r\n"%(bullet_lib))
919         config.write ("OPENAL_INCLUDE = %r\n"%(openal_include))
920         config.write ("OPENAL_LIBPATH = %r\n"%(openal_libpath))
921         config.write ("OPENAL_LIBRARY = %r\n"%(openal_lib))
922         config.write ("\n# The following information is only necessary when building with\n")
923         config.write ("# internationalization support.\n");
924         config.write ("FTGL_INCLUDE = %r\n"%(ftgl_include))
925         config.write ("FTGL_LIBPATH = %r\n"%(ftgl_libpath))
926         config.write ("FTGL_LIBRARY = %r\n"%(ftgl_lib))
927         config.write ("FREETYPE_INCLUDE = %r\n"%(freetype_include))
928         config.write ("FREETYPE_LIBPATH = %r\n"%(freetype_libpath))
929         config.write ("FREETYPE_LIBRARY = %r\n"%(freetype_lib))
930         config.write ("GETTEXT_INCLUDE = %r\n"%(gettext_include))
931         config.write ("GETTEXT_LIBPATH = %r\n"%(gettext_libpath))
932         config.write ("GETTEXT_LIBRARY = %r\n"%(gettext_lib))
933         config.close ()
934
935 #-----------------------------------------------------------------------------
936 # Read the options from the config file and update the various necessary flags
937 #-----------------------------------------------------------------------------
938 list_opts = []
939 user_options = Options (bs_globals.config_file)
940 user_options_env = Environment (ENV = os.environ, options = user_options)
941 user_options.AddOptions (
942                 ('VERSION', 'Blender version', version),
943                 (EnumOption ('BUILD_BINARY', 'release',
944                                         'Select a release or debug binary.',
945                                          allowed_values = ('release', 'debug'))),
946                 (BoolOption ('USE_BUILDINFO',
947                                         'Set to 1 if you want to add build information.',
948                                         'false')),
949                 (BoolOption ('BUILD_BLENDER_DYNAMIC',
950                                         'Set to 1 if you want to build blender with hardware accellerated OpenGL support.',
951                                         'true')),
952                 (BoolOption ('BUILD_BLENDER_STATIC',
953                                         'Set to 1 if you want to build blender with software OpenGL support.',
954                                         'false')),
955                 (BoolOption ('BUILD_BLENDER_PLAYER',
956                                         'Set to 1 if you want to build the blender player.',
957                                         'false')),
958                 (BoolOption ('BUILD_BLENDER_PLUGIN',
959                                         'Set to 1 if you want to build the blender plugin.',
960                                         'false')),
961                 ('BUILD_DIR', 'Target directory for intermediate files.',
962                                         bs_globals.root_build_dir),
963                 (BoolOption ('USE_INTERNATIONAL',
964                                         'Set to 1 to have international support.',
965                                         'false')),
966                 (EnumOption ('USE_PHYSICS', 'solid',
967                                         'Select which physics engine to use.',
968                                         allowed_values = ('ode', 'solid', 'bullet'))),
969                 (BoolOption ('BUILD_GAMEENGINE',
970                                         'Set to 1 to build blender with game engine support.',
971                                         'false')),
972                 (BoolOption ('USE_OPENAL',
973                                         'Set to 1 to build the game engine with OpenAL support.',
974                                         'false')),
975                 (BoolOption ('USE_FMOD',
976                                         'Set to 1 to build the game engine with FMod support.',
977                                         'false')),
978                 (BoolOption ('USE_QUICKTIME',
979                                         'Set to 1 to add support for QuickTime.',
980                                         'false')),
981                 (BoolOption ('USE_FLUIDSIM', # NT test new
982                                         'Set to 0 to disable compilation of fluid simulation library El\'Beem.',
983                                         'true')),
984                 ('HOST_CC', 'C compiler for the host platfor. This is the same as target platform when not cross compiling.'),
985                 ('HOST_CXX', 'C++ compiler for the host platform. This is the same as target platform when not cross compiling.'),
986                 ('TARGET_CC', 'C compiler for the target platform.'),
987                 ('TARGET_CXX', 'C++ compiler for the target platform.'),
988                 ('TARGET_AR', 'Linker command for linking libraries.'),
989                 ('PATH', 'Standard search path'),
990                 ('PLATFORM_LIBS', 'Platform specific libraries.'),
991                 ('PLATFORM_LIBPATH', 'Platform specific library link path.'),
992                 ('PLATFORM_LINKFLAGS', 'Platform specific linkflags'),
993                 ('PYTHON_INCLUDE', 'Include directory for Python header files.'),
994                 ('PYTHON_LIBPATH', 'Library path where the Python lib is located.'),
995                 ('PYTHON_LIBRARY', 'Python library name.'),
996                 ('PYTHON_LINKFLAGS', 'Python specific linkflags.'),
997                 ('SDL_CFLAGS', 'Necessary CFLAGS when using sdl functionality.'),
998                 ('SDL_INCLUDE', 'Include directory for SDL header files.'),
999                 ('SDL_LIBPATH', 'Library path where the SDL library is located.'),
1000                 ('SDL_LIBRARY', 'SDL library name.'),
1001                 ('Z_INCLUDE', 'Include directory for zlib header files.'),
1002                 ('Z_LIBPATH', 'Library path where the zlib library is located.'),
1003                 ('Z_LIBRARY', 'Z library name.'),
1004                 ('PNG_INCLUDE', 'Include directory for png header files.'),
1005                 ('PNG_LIBPATH', 'Library path where the png library is located.'),
1006                 ('PNG_LIBRARY', 'png library name.'),
1007                 ('JPEG_INCLUDE', 'Include directory for jpeg header files.'),
1008                 ('JPEG_LIBPATH', 'Library path where the jpeg library is located.'),
1009                 ('JPEG_LIBRARY', 'jpeg library name.'),
1010                 ('TIFF_INCLUDE', 'Include directory for TIFF header files.'),
1011                 ('TIFF_LIBPATH', 'Library path where the TIFF library is located.'),
1012                 ('TIFF_LIBRARY', 'TIFF library name.'),
1013                 ('OPENGL_INCLUDE', 'Include directory for OpenGL header files.'),
1014                 ('OPENGL_LIBPATH', 'Library path where the OpenGL libraries are located.'),
1015                 ('OPENGL_LIBRARY', 'OpenGL library names.'),
1016                 ('OPENGL_STATIC', 'Linker flags for static linking of Open GL.'),
1017                 ('SOLID_INCLUDE', 'Include directory for SOLID header files.'),
1018                 ('SOLID_LIBPATH', 'Library path where the SOLID library is located.'),
1019                 ('SOLID_LIBRARY', 'SOLID library name.'),
1020                 ('QHULL_INCLUDE', 'Include directory for QHULL header files.'),
1021                 ('QHULL_LIBPATH', 'Library path where the QHULL library is located.'),
1022                 ('QHULL_LIBRARY', 'QHULL library name.'),
1023                 ('ODE_INCLUDE', 'Include directory for ODE header files.'),
1024                 ('ODE_LIBPATH', 'Library path where the ODE library is located.'),
1025                 ('ODE_LIBRARY', 'ODE library name.'),
1026                 ('BULLET_INCLUDE', 'Include directory for BULLET header files.'),
1027                 ('BULLET_LIBPATH', 'Library path where the BULLET library is located.'),
1028                 ('BULLET_LIBRARY', 'BULLET library name'),
1029                 ('OPENAL_INCLUDE', 'Include directory for OpenAL header files.'),
1030                 ('OPENAL_LIBPATH', 'Library path where the OpenAL library is located.'),
1031                 ('OPENAL_LIBRARY', 'OpenAL library name.'),
1032                 ('FTGL_INCLUDE', 'Include directory for ftgl header files.'),
1033                 ('FTGL_LIBPATH', 'Library path where the ftgl library is located.'),
1034                 ('FTGL_LIBRARY', 'ftgl library name.'),
1035                 ('FREETYPE_INCLUDE', 'Include directory for freetype2 header files.'),
1036                 ('FREETYPE_LIBPATH', 'Library path where the freetype2 library is located.'),
1037                 ('FREETYPE_LIBRARY', 'Freetype2 library name.'),
1038                 ('GETTEXT_INCLUDE', 'Include directory for gettext header files.'),
1039                 ('GETTEXT_LIBPATH', 'Library path where the gettext library is located.'),
1040                 ('GETTEXT_LIBRARY', 'gettext library name.'),
1041                 ('DEFINES', 'Extra Preprocessor defines.'),
1042                 ('CCFLAGS', 'Extra C Compiler flags.'),
1043                 ('CXXFLAGS','Extra C++ Compiler flags.'),
1044                 ('LDFLAGS', 'Extra Linker flags.')
1045         )
1046 user_options.Update (user_options_env)
1047 user_options_dict = user_options_env.Dictionary()
1048 Help(user_options.GenerateHelpText(user_options_env))
1049 bs_globals.root_build_dir = user_options_dict['BUILD_DIR']
1050 # SET MODULE VARS #
1051 init_env = Environment(ENV = os.environ)
1052
1053 bs_globals.user_options_dict = user_options_dict
1054 bs_globals.init_env = init_env
1055 bs_globals.version = version
1056 bs_globals.shortversion = shortversion
1057 bs_globals.appname = appname
1058 bs_globals.playername = playername
1059 bs_globals.config_guess = config_guess
1060 # END SET MODULE VARS #
1061
1062 if user_options_dict['BUILD_GAMEENGINE'] == 1:
1063         defines += ['GAMEBLENDER=1']
1064         defines += ['USE_BULLET']
1065         if user_options_dict['USE_PHYSICS'] == 'ode':
1066                 defines += ['USE_ODE']
1067         else:
1068                 defines += ['USE_SUMO_SOLID']
1069 else:
1070         defines += ['GAMEBLENDER=0']
1071
1072 if user_options_dict['BUILD_BINARY'] == 'release':
1073         cflags = extra_flags + release_flags + warn_flags
1074         defines += ['NDEBUG']
1075 else:
1076         cflags = extra_flags + debug_flags + warn_flags
1077         if sys.platform == 'win32':
1078                 platform_linkflags = ['/DEBUG','/PDB:blender.pdb'] + platform_linkflags
1079
1080 defines += user_options_dict['DEFINES']
1081 cflags += user_options_dict['CCFLAGS']
1082 cxxflags += user_options_dict['CXXFLAGS']
1083 platform_linkflags += user_options_dict['LDFLAGS'] 
1084
1085 user_options_dict['PLATFORM_LINKFLAGS'] = platform_linkflags
1086
1087 if user_options_dict['USE_FLUIDSIM'] == 0: # NT test new
1088         use_fluidsim='false';
1089
1090 #-----------------------------------------------------------------------------
1091 # Generic library generation environment. This one is the basis for each
1092 # library.
1093 #-----------------------------------------------------------------------------
1094 library_env = env.Copy ()
1095 library_env.Replace (CC = user_options_dict['TARGET_CC'])
1096 library_env.Replace (CXX = user_options_dict['TARGET_CXX'])
1097 library_env.Replace (PATH = user_options_dict['PATH'])
1098 library_env.Replace (AR = user_options_dict['TARGET_AR'])
1099 library_env.Append (CCFLAGS = cflags)
1100 library_env.Append (CXXFLAGS = cxxflags)
1101 library_env.Append (CPPDEFINES = defines)
1102 library_env.SConsignFile (bs_globals.root_build_dir+'scons-signatures')
1103
1104 #-----------------------------------------------------------------------------
1105 # Settings to be exported to other SConscript files
1106 #-----------------------------------------------------------------------------
1107
1108 if bs_globals.enable_clean==0: # only read SConscripts when not cleaning, this to cut overhead
1109         Export ('cflags')
1110         Export ('defines')
1111         Export ('window_system')
1112         Export ('extra_includes')
1113         Export ('user_options_dict')
1114         Export ('library_env')
1115         Export ('sdl_env')
1116         Export ('use_fluidsim') # NT test
1117         
1118         BuildDir (bs_globals.root_build_dir+'/extern', 'extern', duplicate=0)
1119         SConscript (bs_globals.root_build_dir+'extern/SConscript')
1120         BuildDir (bs_globals.root_build_dir+'/intern', 'intern', duplicate=0)
1121         SConscript (bs_globals.root_build_dir+'intern/SConscript')
1122         BuildDir (bs_globals.root_build_dir+'/source', 'source', duplicate=0)
1123         SConscript (bs_globals.root_build_dir+'source/SConscript')
1124         
1125         libpath = (['#'+bs_globals.root_build_dir+'/lib'])
1126         
1127         link_env = library_env.Copy ()
1128         link_env.Append (LIBPATH=libpath)
1129
1130 def buildinfo(env, build_type):
1131         """
1132         Generate a buildinfo object
1133         """
1134         build_date = time.strftime ("%Y-%m-%d")
1135         build_time = time.strftime ("%H:%M:%S")
1136         obj = []
1137         if user_options_dict['USE_BUILDINFO'] == 1:
1138                 if sys.platform=='win32':
1139                         build_info_file = open("source/creator/winbuildinfo.h", 'w')
1140                         build_info_file.write("char *build_date=\"%s\";\n"%build_date)
1141                         build_info_file.write("char *build_time=\"%s\";\n"%build_time)
1142                         build_info_file.write("char *build_platform=\"win32\";\n")
1143                         build_info_file.write("char *build_type=\"dynamic\";\n")
1144                         build_info_file.close()
1145                         env.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
1146                 else:
1147                         env.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
1148                                                         'BUILD_DATE=\'"%s"\''%(build_date),
1149                                                         'BUILD_TYPE=\'"dynamic"\'',
1150                                                         'NAN_BUILDINFO',
1151                                                         'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
1152                 obj = [env.Object (bs_globals.root_build_dir+'source/creator/%s_buildinfo'%build_type,
1153                                                 [bs_globals.root_build_dir+'source/creator/buildinfo.c'])]
1154         return obj
1155
1156 if bs_globals.enable_clean == 0:
1157         if user_options_dict['BUILD_BLENDER_DYNAMIC'] == 1:
1158                 dy_blender = link_env.Copy ()
1159                 if sys.platform=='win32':
1160                         bs_libs.winblenderres(dy_blender)
1161                 bs_libs.blender_libs(dy_blender)
1162                 bs_libs.common_libs(dy_blender)
1163                 bs_libs.international_libs(dy_blender)
1164                 bs_libs.ketsji_libs(dy_blender)
1165                 bs_libs.system_libs(dy_blender)
1166                 dy_blender.Append (LIBS=user_options_dict['OPENGL_LIBRARY'])
1167                 dy_blender.Append (LIBPATH=user_options_dict['OPENGL_LIBPATH'])
1168                 dy_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1169                 d_obj = buildinfo(dy_blender, "dynamic")
1170                 if sys.platform == 'win32':
1171                         dy_blender.Program (target='blender',
1172                                                 source=d_obj + ['source/icons/winblender.res'])
1173                 else:
1174                         if sys.platform == 'cygwin':
1175                                 dy_blender.Replace (CC='g++')
1176                         dy_blender.Program (target='blender', source=d_obj)
1177         
1178         if user_options_dict['BUILD_BLENDER_STATIC'] == 1:
1179                 st_blender = link_env.Copy ()
1180                 if sys.platform=='win32':
1181                         bs_libs.winblenderres(st_blender)
1182                 bs_libs.blender_libs(st_blender)
1183                 bs_libs.common_libs(st_blender)
1184                 bs_libs.international_libs(st_blender)
1185                 bs_libs.ketsji_libs(st_blender)
1186                 bs_libs.system_libs(st_blender)
1187                 # The next line is to make sure that the LINKFLAGS are appended at the end
1188                 # of the link command. This 'trick' is needed because the GL and GLU static
1189                 # libraries need to be at the end of the command.
1190                 st_blender.Replace(LINKCOM="$LINK -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS")
1191                 s_obj = buildinfo(st_blender, "static")
1192                 st_blender.Append (LINKFLAGS=user_options_dict['OPENGL_STATIC'])
1193                 st_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1194                 st_blender.Prepend (LIBPATH=['/usr/lib/opengl/xfree/lib'])
1195                 st_blender.Program (target='blenderstatic', source=s_obj)
1196         
1197         if sys.platform=='win32':
1198                 if user_options_dict['BUILD_BINARY']=='debug':
1199                         browser = Environment(ENV = os.environ)
1200                         browser_tmp = bs_globals.root_build_dir+'bscmake.tmp'
1201                         browser.Command ('blender.bsc', 'blender$PROGSUFFIX',
1202                                 ['dir /b/s '+bs_globals.root_build_dir+'*.sbr >'+browser_tmp,
1203                                  'bscmake /nologo /n /oblender.bsc @'+browser_tmp,
1204                                  'del '+browser_tmp])
1205         
1206         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1 and user_options_dict['BUILD_GAMEENGINE'] == 1:
1207                 player_blender = link_env.Copy()
1208                 bs_libs.player_libs(player_blender)
1209                 bs_libs.common_libs(player_blender)
1210                 bs_libs.international_libs(player_blender)
1211                 bs_libs.ketsji_libs(player_blender)
1212                 bs_libs.player_libs2(player_blender)
1213                 bs_libs.system_libs(player_blender)
1214                 player_blender.Append (LIBS=user_options_dict['OPENGL_LIBRARY'])
1215                 player_blender.Append (LIBPATH=user_options_dict['OPENGL_LIBPATH'])
1216                 player_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1217                 d_obj = buildinfo(player_blender, "player")
1218                 if sys.platform == 'win32':
1219                         player_blender.Program (target='blenderplayer',
1220                                                 source=d_obj + ['source/icons/winblender.res'])
1221                 else:
1222                         if sys.platform == 'cygwin':
1223                                 player_blender.Replace (CC='g++')
1224                         player_blender.Program (target='blenderplayer', source=d_obj)
1225                 if sys.platform=='win32':
1226                         if user_options_dict['BUILD_BINARY']=='debug':
1227                                 browser = Environment(ENV = os.environ)
1228                                 browser_tmp = bs_globals.root_build_dir+'bscmake.tmp'
1229                                 browser.Command ('blenderplayer.bsc', 'blenderplayer$PROGSUFFIX',
1230                                 ['dir /b/s '+bs_globals.root_build_dir+'*.sbr >'+browser_tmp,
1231                                 'bscmake /nologo /n /oblenderplayer.bsc @'+browser_tmp,
1232                                 'del '+browser_tmp])
1233
1234         release_target = env.Alias("release", bs_arc.BlenderRelease(appname))
1235         default_target = env.Alias("default", bs_default.BlenderDefault(appname))
1236         wininst_target = env.Alias("winist", bs_nsis.BlenderNSIS(appname))
1237         if bs_globals.docopy == 1:
1238                 bincopy_target = env.Alias("bincopy", bs_bincopy.BlenderCopy(appname))
1239                 
1240 else: # only clean target to prevent any building
1241         clean_target = env.Alias("clean", bs_clean.DoClean(bs_globals.root_build_dir))
1242         Default("clean")
1243
1244 if bs_globals.enable_clean == 0: # only set up dependencies when not cleaning
1245         if sys.platform == 'darwin':
1246                 Default("release")
1247         else:
1248                 Default("default")
1249
1250         if sys.platform == 'win32':
1251                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1252                         env.Depends(wininst_target, playername)
1253                 env.Depends(wininst_target, appname)
1254         
1255         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1256                 env.Depends(release_target, playername)
1257                 env.Depends(default_target, playername)
1258                 if bs_globals.docopy == 1:
1259                         env.Depends(bincopy_target, playername)
1260         env.Depends(release_target, appname)
1261         env.Depends(default_target, appname)
1262         if bs_globals.docopy == 1:
1263                 env.Depends(bincopy_target, appname)