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