New BPython files missing from MSVC 6.0 projectfiles
[blender.git] / SConstruct
1 import string
2 import os
3 import time
4 import sys
5 from distutils import sysconfig
6 import SCons.Script
7
8 appname = ''
9 playername = ''
10
11 if hex(sys.hexversion) < 0x2030000:
12         print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
13         print
14         print "You need at least Python 2.3 to build Blender with SCons"
15         print
16         print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
17         sys.exit()
18
19 if sys.platform != 'win32':
20         sys.stdout = os.popen("tee build.log", "w")
21         sys.stderr = sys.stdout
22         
23 if sys.platform == 'darwin':
24         appname = 'blender'
25         playername = 'blenderplayer'
26 else:
27         appname = 'blender$PROGSUFFIX'
28         playername = 'blenderplayer$PROGSUFFIX'
29
30 # This is a flag to determine whether to read all sconscripts and
31 # set up the build environments or not
32 # when issuing 'scons clean' this is set to 1
33 # and all reading is skipped and a 'clean' target
34 # will clean the root_build_dir from all
35 # object files
36 enable_clean = 0
37
38 all_args = sys.argv[1:]
39 parser =  SCons.Script.OptParser()
40 options, targets = parser.parse_args(all_args)
41 if ('clean' in targets):
42         enable_clean = 1
43         
44 # Build directory.
45 root_build_dir = '..' + os.sep + 'build' + os.sep + sys.platform + os.sep
46
47 # Create the build directory. SCons does this automatically, but since we
48 # don't want to put scons-generated .sconsign files in the source tree, but in
49 # the root_build_dir, we have to create that dir ourselves before SCons tries
50 # to access/create the file containing .sconsign data.
51 if os.path.isdir (root_build_dir) == 0:
52     os.makedirs (root_build_dir)
53
54 # User configurable options file. This can be controlled by the user by running
55 # scons with the following argument: CONFIG=user_config_options_file
56 config_file = ARGUMENTS.get('CONFIG', 'config.opts')
57
58 # Blender version.
59 version='2.33a'
60 shortversion = '233a' # for wininst target -> nsis installer creation
61
62 sdl_env = Environment ()
63 freetype_env = Environment ()
64 env = Environment ()
65
66 if sys.platform == 'linux2' or sys.platform == 'linux-i386':
67     use_international = 'false'
68     use_gameengine = 'true'
69     use_openal = 'false'
70     use_fmod = 'false'
71     use_quicktime = 'false'
72     use_sumo = 'true'
73     use_ode = 'false'
74     use_buildinfo = '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     # OpenGL library information
103     opengl_lib = ['GL', 'GLU']
104     opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
105     opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
106     opengl_include = ['/usr/include']
107     # SDL library information
108     sdl_env.ParseConfig ('sdl-config --cflags --libs')
109     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
110     sdl_include = sdl_env.Dictionary()['CPPPATH']
111     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
112     sdl_lib = sdl_env.Dictionary()['LIBS']
113     # SOLID library information
114     solid_lib = []                                              # TODO
115     solid_libpath = []                                          # TODO
116     solid_include = ['#extern/solid']
117     qhull_lib = []                                              # TODO
118     qhull_libpath = []                                          # TODO
119     qhull_include = ['#extern/qhull/include']
120     # ODE library information
121     ode_lib = ['ode']
122     ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
123     ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
124     # Python library information
125     python_lib = ['python%d.%d' % sys.version_info[0:2]]
126     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
127     python_include = [sysconfig.get_python_inc ()]
128     python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
129     # International support information
130     ftgl_lib = ['ftgl']
131     ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
132     ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
133     freetype_env.ParseConfig ('pkg-config --cflags --libs freetype2 2>/dev/null || freetype-config --cflags --libs 2>/dev/null')
134     freetype_lib = freetype_env.Dictionary()['LIBS']
135     freetype_libpath = freetype_env.Dictionary()['LIBPATH']
136     freetype_include = freetype_env.Dictionary()['CPPPATH']
137     gettext_lib = []
138     gettext_libpath = []
139     gettext_include = []
140     # OpenAL library information
141     openal_lib = ['openal']
142     openal_libpath = ['/usr/lib']
143     openal_include = ['/usr/include']
144
145 elif sys.platform == 'darwin':
146     use_international = 'true'
147     use_gameengine = 'true'
148     use_openal = 'true'
149     use_fmod = 'false'
150     use_quicktime = 'true'
151     use_precomp = 'true'
152     use_sumo = 'true'
153     use_ode = 'false'
154     use_buildinfo = 'true'
155     build_blender_dynamic = 'true'
156     build_blender_static = 'false'
157     build_blender_player = 'true'
158     build_blender_plugin = 'false'
159     # TODO: replace darwin-6.1-powerpc with the actual directiory on the
160     #       build machine
161     # darwin-6.1 is the name of cvs precomp folder
162     # a symbolic link named darwin-X.Y-powerpc must be manually done
163     #for now. X-Y is darwin kernel rev number
164     darwin_precomp = '#../lib/darwin-6.1-powerpc/'
165     fink_path = '/sw/'
166     # TODO : try -mpowerpc -mpowerpc-gopt -mpowerpc-gfxopt optims
167     #           doing actual profiling
168     extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-ffast-math', '-mpowerpc' , '-malign-natural']
169
170 #'-force_cpusubtype_ALL', '-mpowerpc-gpopt', 
171     cxxflags = []
172     defines = ['_THREAD_SAFE']
173     if use_quicktime == 'true':
174         defines += ['WITH_QUICKTIME']
175     warn_flags = ['-Wall']    # , '-W'
176     release_flags = ['-O3']
177     debug_flags = ['-g']
178     window_system = 'CARBON'
179     # z library information
180     z_lib = ['z']
181     z_libpath = []
182     z_include = []
183     # TODO : add a flag to allow each lib to be build from fink or precomp
184     #        without having to have to specify the path manually in config.opts.    
185     # png library information
186     png_lib = ['libpng']
187     png_libpath = [darwin_precomp + 'png/lib']
188     png_include = [darwin_precomp + 'png/include']
189     # jpeg library information
190     jpeg_lib = ['libjpeg']
191     jpeg_libpath = [darwin_precomp + 'jpeg/lib']
192     jpeg_include = [darwin_precomp + 'jpeg/include']
193     # OpenGL library information
194     opengl_lib = ['GL', 'GLU']
195     opengl_static = []
196     opengl_libpath = []
197     opengl_include = []
198     # SDL specific stuff.
199     sdl_env.ParseConfig ('sdl-config --cflags --libs')
200     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
201     # Want to use precompiled libraries?
202     if use_precomp == 'true':
203         sdl_include = [darwin_precomp + 'sdl/include']
204         sdl_libpath = [darwin_precomp + 'sdl/lib']
205         sdl_lib = ['libSDL.a']
206     platform_libs = ['stdc++'] 
207     extra_includes = ['/sw/include']
208     platform_libpath = ['/System/Library/Frameworks/OpenGL.framework/Libraries']
209     platform_linkflags = []
210     # SOLID library information
211     solid_lib = ['libsolid']                                          
212     solid_libpath = [darwin_precomp + 'solid/lib']                                          
213     solid_include = [darwin_precomp + 'solid/include']
214     qhull_lib = ['libqhull']                                          
215     qhull_libpath = [darwin_precomp + 'qhull/lib']                                          
216     qhull_include = [darwin_precomp + 'qhull/include']
217     # ODE library information
218     ode_lib = ['libode']                                             
219     ode_libpath = [darwin_precomp + 'ode/lib']                                          
220     ode_include = [darwin_precomp + 'ode/include/ode']
221     # Python variables.
222     # TODO : fill vars differently if we are on 10.2 or 10.3
223     # python_lib = ['python%d.%d' % sys.version_info[0:2]]
224     # python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
225     # python_include = [sysconfig.get_python_inc ()]
226     # python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
227     python_lib = []
228     python_libpath = ['/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config']
229     python_include = ['/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3']
230     python_linkflags = ['-u', '__dummy', '-u', '_PyMac_Error', 
231                         '-framework', 'System',
232                         '-framework', 'Python',
233                         '-framework', 'CoreServices',
234                         '-framework', 'Foundation']
235     # International stuff
236     ftgl_lib = ['ftgl']
237     ftgl_libpath = [darwin_precomp + 'ftgl/lib']
238     ftgl_include = [darwin_precomp + 'ftgl/include']
239     freetype_lib = ['libfreetype']
240     freetype_libpath = [darwin_precomp + 'freetype/lib']
241     freetype_include = [darwin_precomp + 'freetype/include']
242     gettext_lib = ['libintl']
243     gettext_libpath = [darwin_precomp + 'gettext/lib']
244     gettext_include = [darwin_precomp + 'gettext/include']
245     # OpenAL library information
246     openal_lib = ['libopenal']
247     openal_libpath = [darwin_precomp + 'openal/lib']
248     openal_include = [darwin_precomp + 'openal/include']
249
250 elif sys.platform == 'cygwin':
251     use_international = 'false'
252     use_gameengine = 'false'
253     use_openal = 'false'
254     use_fmod = 'false'
255     use_quicktime = 'false'
256     use_sumo = 'false'
257     use_ode = 'false'
258     use_buildinfo = 'false'
259     build_blender_dynamic = 'true'
260     build_blender_static = 'false'
261     build_blender_player = 'false'
262     build_blender_plugin = 'false'
263     release_flags = ['-O2']
264     debug_flags = ['-O2', '-g']
265     extra_flags = ['-pipe', '-mno-cygwin', '-mwindows', '-funsigned-char']
266     cxxflags = []
267     defines = ['FREE_WINDOWS']
268     warn_flags = ['-Wall', '-Wno-char-subscripts']
269     platform_libs = ['png', 'jpeg', 'netapi32',
270                      'opengl32', 'glu32', 'winmm',
271                      'mingw32']
272     platform_libpath = ['/usr/lib/w32api', '/lib/w32api']
273     platform_linkflags = ['-mwindows', '-mno-cygwin', '-mconsole']
274     window_system = 'WIN32'
275     extra_includes = []
276     # z library information
277     z_lib = ['z']
278     z_libpath = ['#../lib/windows/zlib/lib']
279     z_include = ['#../lib/windows/zlib/include']
280     # png library information
281     png_lib = ['png']
282     png_libpath = ['#../lib/windows/png/lib']
283     png_include = ['#../lib/windows/png/include']
284     # jpeg library information
285     jpeg_lib = ['jpeg']
286     jpeg_libpath = ['#../lib/windows/jpeg/lib']
287     jpeg_include = ['#../lib/windows/jpeg/include']
288     # OpenGL library information
289     opengl_lib = ['opengl32', 'glu32']
290     opengl_static = []
291     opengl_libpath = []
292     opengl_include = []
293     # SDL specific stuff.
294     sdl_include = ['#../lib/windows/sdl/include']
295     sdl_libpath = ['#../lib/windows/sdl/lib']
296     sdl_lib = ['SDL']
297     sdl_cflags = []
298     #sdl_cflags = '-DWIN32'
299     # SOLID library information
300     solid_lib = []                                              # TODO
301     solid_libpath = []                                          # TODO
302     solid_include = ['#extern/solid']
303     qhull_lib = []                                              # TODO
304     qhull_libpath = []                                          # TODO
305     qhull_include = ['#extern/qhull/include']
306     # ODE library information
307     ode_lib = ['ode']
308     ode_libpath = ['#../lib/windows/gcc/ode/lib']
309     ode_include = ['#../lib/windows/gcc/ode/include']
310     # Python library information
311     python_include = ['#../lib/windows/python/include/python2.2']
312     python_libpath = ['#../lib/windows/python/lib']
313     python_lib = ['python22']
314     python_linkflags = []
315     # International stuff
316     ftgl_lib = ['ftgl']
317     ftgl_libpath = ['#../lib/windows/gcc/ftgl/lib']
318     ftgl_include = ['#../lib/windows/gcc/ftgl/include']
319     freetype_lib = ['freetype']
320     freetype_libpath = ['#../lib/windows/gcc/freetype/lib']
321     freetype_include = ['#../lib/windows/gcc/freetype/include']
322     gettext_lib = []
323     gettext_libpath = []
324     gettext_include = []
325     # OpenAL library information
326     openal_lib = []
327     openal_libpath = []
328     openal_include = []
329
330 elif sys.platform == 'win32':
331     use_international = 'true'
332     use_gameengine = 'true'
333     use_openal = 'true'
334     use_fmod = 'false'
335     use_quicktime = 'true'
336     use_sumo = 'true'
337     use_ode = 'false'
338     use_buildinfo = 'true'
339     build_blender_dynamic = 'true'
340     build_blender_static = 'false'
341     build_blender_player = 'true'
342     build_blender_plugin = 'false'
343     release_flags = ['/Og', '/Ot', '/Ob1', '/Op', '/G6']
344     debug_flags = ['/Zi', '/Fr${TARGET.base}.sbr']
345     extra_flags = ['/EHsc', '/J', '/W3', '/Gd', '/MT']
346     cxxflags = []
347     defines = ['WIN32', '_CONSOLE']
348     defines += ['WITH_QUICKTIME']
349     defines += ['_LIB', 'USE_OPENAL']
350     defines += ['FTGL_LIBRARY_STATIC']
351     warn_flags = []
352     platform_libs = [ 'qtmlClient', 'soundsystem',
353                      'ws2_32', 'dxguid', 'vfw32', 'winmm',
354                      'iconv', 'kernel32', 'user32', 'gdi32',
355                      'winspool', 'comdlg32', 'advapi32', 'shell32',
356                      'ole32', 'oleaut32', 'uuid', 'odbc32', 'odbccp32',
357                      'libcmt', 'libc']
358     platform_libpath = ['#../lib/windows/iconv/lib',
359                         '#../lib/windows/QTDevWin/Libraries']
360     platform_linkflags = [
361                         '/SUBSYSTEM:CONSOLE',
362                         '/MACHINE:IX86',
363                         '/ENTRY:mainCRTStartup',
364                         '/INCREMENTAL:NO',
365                         '/NODEFAULTLIB:"msvcprt.lib"',
366                         '/NODEFAULTLIB:"glut32.lib"',
367                         '/NODEFAULTLIB:"libcd.lib"',
368                         #'/NODEFAULTLIB:"libc.lib"',
369                         '/NODEFAULTLIB:"libcpd.lib"',
370                         '/NODEFAULTLIB:"libcp.lib"',
371                         '/NODEFAULTLIB:"libcmtd.lib"',
372                         ]
373     window_system = 'WIN32'
374     extra_includes = []
375     if use_quicktime == 'true':
376         extra_includes += ['#../lib/windows/QTDevWin/CIncludes']
377     # z library information
378     z_lib = ['libz_st']
379     z_libpath = ['#../lib/windows/zlib/lib']
380     z_include = ['#../lib/windows/zlib/include']
381     # png library information
382     png_lib = ['libpng_st']
383     png_libpath = ['#../lib/windows/png/lib']
384     png_include = ['#../lib/windows/png/include']
385     # jpeg library information
386     jpeg_lib = ['libjpeg']
387     jpeg_libpath = ['#../lib/windows/jpeg/lib']
388     jpeg_include = ['#../lib/windows/jpeg/include']
389     # OpenGL library information
390     opengl_lib = ['opengl32', 'glu32']
391     opengl_static = []
392     opengl_libpath = []
393     opengl_include = ['/usr/include']
394     # SDL library information
395     sdl_include = ['#../lib/windows/sdl/include']
396     sdl_libpath = ['#../lib/windows/sdl/lib']
397     sdl_lib = ['SDL']
398     sdl_cflags = []
399     window_system = 'WIN32'
400     # SOLID library information
401     solid_lib = ['extern/solid']
402     solid_libpath = ['#../lib/windows/solid/lib']
403     solid_include = ['#extern/solid']
404     qhull_lib = ['qhull']
405     qhull_libpath = ['#../lib/windows/qhull/lib']
406     qhull_include = ['#extern/qhull/include']
407     # ODE library information
408     ode_lib = []                                                # TODO
409     ode_libpath = ['#../lib/windows/ode/lib']
410     ode_include = ['#../lib/windows/ode/include']
411     # Python lib name
412     python_include = ['#../lib/windows/python/include/python2.3']
413     python_libpath = ['#../lib/windows/python/lib']
414     python_lib = ['python23']
415     python_linkflags = []
416     # International stuff
417     ftgl_lib = ['ftgl_static_ST']
418     ftgl_libpath = ['#../lib/windows/ftgl/lib']
419     ftgl_include = ['#../lib/windows/ftgl/include']
420     freetype_lib = ['freetype2ST']
421     freetype_libpath = ['#../lib/windows/freetype/lib']
422     freetype_include = ['#../lib/windows/freetype/include']
423     gettext_lib = ['gnu_gettext']
424     gettext_libpath = ['#../lib/windows/gettext/lib']
425     gettext_include = ['#../lib/windows/gettext/include']
426     # OpenAL library information
427     openal_lib = ['openal_static']
428     openal_libpath = ['#../lib/windows/openal/lib']
429     openal_include = ['#../lib/windows/openal/include']
430
431 elif string.find (sys.platform, 'sunos') != -1:
432     use_international = 'true'
433     use_gameengine = 'false'
434     use_openal = 'false'
435     use_fmod = 'false'
436     use_quicktime = 'false'
437     use_sumo = 'false'
438     use_ode = 'false'
439     use_buildinfo = 'false'
440     build_blender_dynamic = 'true'
441     build_blender_static = 'false'
442     build_blender_player = 'false'
443     build_blender_plugin = 'false'
444     release_flags = ['-O2']
445     debug_flags = ['-O2', '-g']
446     extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-DSUN_OGL_NO_VERTEX_MACROS']
447     cxxflags = []
448     defines = []
449     warn_flags = ['-Wall', '-W']
450     window_system = 'X11'
451     platform_libs = ['stdc++', 'dl', 'm']
452     platform_libpath = []
453     platform_linkflags = []
454     extra_includes = []
455     # z library information
456     z_lib = ['z']
457     z_libpath = []
458     z_include = []
459     # png library information
460     png_lib = ['png']
461     png_libpath = []
462     png_include = []
463     # jpeg library information
464     jpeg_lib = ['jpeg']
465     jpeg_libpath = []
466     jpeg_include = []
467     # OpenGL library information
468     opengl_lib = ['GL', 'GLU', 'X11']
469     opengl_static = []
470     opengl_libpath = ['/usr/openwin/include']
471     opengl_include = ['/usr/openwin/lib']
472     # SDL library information
473     sdl_env.ParseConfig ('sdl-config --cflags --libs')
474     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
475     sdl_include = sdl_env.Dictionary()['CPPPATH']
476     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
477     sdl_lib = sdl_env.Dictionary()['LIBS']
478     # SOLID library information
479     solid_lib = []                                              # TODO
480     solid_libpath = []                                          # TODO
481     solid_include = ['#extern/solid']
482     qhull_lib = []                                              # TODO
483     qhull_libpath = []                                          # TODO
484     qhull_include = ['#extern/qhull/include']
485     # ODE library information
486     ode_lib = []                                                # TODO
487     ode_libpath = []                                            # TODO
488     ode_include = ['#extern/ode/dist/include/ode']
489     # Python variables.
490     python_lib = ['python%d.%d' % sys.version_info[0:2]]
491     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
492     python_include = [sysconfig.get_python_inc ()]
493     python_linkflags = []
494     # International support information
495     ftgl_lib = ['ftgl']
496     ftgl_libpath = ['#../lib/solaris-2.8-sparc/ftgl/lib']
497     ftgl_include = ['#../lib/solaris-2.8-sparc/ftgl/include']
498     freetype_lib = ['freetype']
499     freetype_libpath = ['#../lib/solaris-2.8-sparc/freetype/lib']
500     freetype_include = ['#../lib/solaris-2.8-sparc/freetype/include']
501     gettext_lib = []
502     gettext_libpath = []
503     gettext_include = []
504     # OpenAL library information
505     openal_lib = []
506     openal_libpath = []
507     openal_include = []
508
509 elif string.find (sys.platform, 'irix') != -1:
510     use_international = 'false'
511     use_gameengine = 'false'
512     use_openal = 'false'
513     use_fmod = 'false'
514     use_quicktime = 'false'
515     use_sumo = 'false'
516     use_ode = 'false'
517     use_buildinfo = 'false'
518     build_blender_dynamic = 'true'
519     build_blender_static = 'false'
520     build_blender_player = 'false'
521     build_blender_plugin = 'false'
522     irix_precomp = '#../lib/irix-6.5-mips'
523     extra_flags = ['-n32', '-mips3', '-Xcpluscomm']
524     cxxflags = ['-n32', '-mips3', '-Xcpluscomm', '-LANG:std']
525     cxxflags += ['-LANG:libc_in_namespace_std=off']
526     
527     window_system = 'X11'
528     release_flags = ['-O2', '-OPT:Olimit=0']
529     debug_flags = ['-O2', '-g']
530     defines = []
531     warn_flags = ['-fullwarn', '-woff', '1001,1110,1201,1209,1355,1424,1681,3201']
532     platform_libs = ['movieGL', 'Xmu', 'Xext', 'X11',
533                      'c', 'm', 'dmedia', 'cl', 'audio',
534                      'Cio', 'pthread']
535     platform_libpath = ['/usr/lib32/mips3',
536                         '/lib/freeware/lib32',
537                         '/usr/lib32']
538     platform_linkflags = ['-mips3', '-n32']
539     extra_includes = ['/usr/freeware/include',
540                       '/usr/include']
541     # z library information
542     z_lib = ['z']
543     z_libpath = []
544     z_include = []
545     # png library information
546     png_lib = ['png']
547     png_libpath = [irix_precomp + '/png/lib']
548     png_include = [irix_precomp + '/png/include']
549     # jpeg library information
550     jpeg_lib = ['jpeg']
551     jpeg_libpath = [irix_precomp + '/jpeg/lib']
552     jpeg_include = [irix_precomp + '/jpeg/include']
553     # OpenGL library information
554     opengl_lib = ['GL', 'GLU']
555     opengl_static = []
556     opengl_libpath = []
557     opengl_include = []
558     # SDL library information
559     sdl_cflags = []
560     sdl_include = [irix_precomp + '/sdl/include/SDL']
561     sdl_libpath = [irix_precomp + '/sdl/lib']
562     sdl_lib = ['SDL', 'libSDL.a']
563     # SOLID library information
564     solid_lib = []                                              # TODO
565     solid_libpath = []                                          # TODO
566     solid_include = [irix_precomp + '/solid/include']
567     qhull_lib = []                                              # TODO
568     qhull_libpath = []                                          # TODO
569     qhull_include = ['#extern/qhull/include']
570     # ODE library information
571     ode_lib = []                                                # TODO
572     ode_libpath = []                                            # TODO
573     ode_include = [irix_precomp + '/ode/include']
574     # Python library information
575     python_libpath = [irix_precomp + '/python/lib/python2.2/config']
576     python_include = [irix_precomp + '/python/include/python2.2']
577     python_lib = ['python2.2']
578     python_linkflags = []
579     # International support information
580     ftgl_lib = ['ftgl']
581     ftgl_libpath = [irix_precomp + '/ftgl/lib']
582     ftgl_include = [irix_precomp + '/ftgl/include']
583     freetype_lib = ['freetype']
584     freetype_libpath = [irix_precomp + '/freetype/lib']
585     freetype_include = [irix_precomp + '/freetype/include']
586     gettext_lib = []
587     gettext_libpath = []
588     gettext_include = []
589     # OpenAL library information
590     openal_lib = []
591     openal_libpath = []
592     openal_include = []
593
594 elif string.find (sys.platform, 'hp-ux') != -1:
595     window_system = 'X11'
596     defines = []
597
598 elif sys.platform=='openbsd3':
599     print "Building for OpenBSD 3.x"
600     use_international = 'false'
601     use_gameengine = 'false'
602     use_openal = 'false'
603     use_fmod = 'false'
604     use_quicktime = 'false'
605     use_sumo = 'false'
606     use_ode = 'false'
607     use_buildinfo = 'true'
608     build_blender_dynamic = 'true'
609     build_blender_static = 'false'
610     build_blender_player = 'false'
611     build_blender_plugin = 'false'
612     release_flags = ['-O2']
613     debug_flags = ['-O2', '-g']
614     extra_flags = ['-pipe', '-fPIC', '-funsigned-char']
615     cxxflags = []
616     defines = []
617     warn_flags = ['-Wall','-W']
618     window_system = 'X11'
619     platform_libs = ['m', 'stdc++', 'pthread', 'util']
620     platform_libpath = []
621     platform_linkflags = []
622     extra_includes = []
623     z_lib = ['z']
624     z_libpath = ['/usr/lib']
625     z_include = ['/usr/include']
626     # png library information
627     png_lib = ['png']
628     png_libpath = ['/usr/local/lib']
629     png_include = ['/usr/local/include']
630     # jpeg library information
631     jpeg_lib = ['jpeg']
632     jpeg_libpath = ['/usr/local/lib']
633     jpeg_include = ['/usr/local/include']
634     # OpenGL library information
635     opengl_lib = ['GL', 'GLU']
636     opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
637     opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
638     opengl_include = ['/usr/X11R6/include/']
639     # SDL library information
640     sdl_env.ParseConfig ('sdl-config --cflags --libs')
641     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
642     sdl_include = sdl_env.Dictionary()['CPPPATH']
643     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
644     sdl_lib = sdl_env.Dictionary()['LIBS']
645     # SOLID library information
646     solid_lib = []                     # TODO
647     solid_libpath = []        # TODO
648     solid_include = ['#extern/solid']
649     qhull_lib = []       # TODO
650     qhull_libpath = []  # TODO
651     qhull_include = ['#extern/qhull/include']
652     # ODE library information
653     ode_lib = ['ode']
654     ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
655     ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
656     # Python library information
657     python_lib = ['python%d.%d' % sys.version_info[0:2]]
658     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
659     python_include = [sysconfig.get_python_inc ()]
660     python_linkflags = []
661     # International support information
662     ftgl_lib = ['ftgl']
663     ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
664     ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
665     freetype_env.ParseConfig('pkg-config --cflags --libs freetype2')
666     freetype_lib = freetype_env.Dictionary()['LIBS']
667     freetype_libpath = freetype_env.Dictionary()['LIBPATH']
668     freetype_include = freetype_env.Dictionary()['CPPPATH']
669     gettext_lib = []
670     gettext_libpath = []
671     gettext_include = []
672     # OpenAL library information
673     openal_lib = ['openal']
674     openal_libpath = ['/usr/lib']
675     openal_include = ['/usr/include']
676
677 else:
678     print "Unknown platform %s"%sys.platform
679     exit
680
681 #-----------------------------------------------------------------------------
682 # End of platform specific section
683 #-----------------------------------------------------------------------------
684
685 #-----------------------------------------------------------------------------
686 # User configurable options to be saved in a config file.
687 #-----------------------------------------------------------------------------
688 # Checking for an existing config file - use that one if it exists,
689 # otherwise create one.
690 my_defines = []
691 my_ccflags = []
692 my_cxxflags = []
693 my_ldflags = []
694 if os.path.exists (config_file):
695     print "Using config file: " + config_file
696 else:
697     print "Creating new config file: " + config_file
698     env_dict = env.Dictionary()
699     config=open (config_file, 'w')
700     config.write ("# Configuration file containing user definable options.\n")
701     config.write ("VERSION = '2.33-cvs'\n")
702     config.write ("BUILD_BINARY = 'release'\n")
703     config.write ("USE_BUILDINFO = %r\n"%(use_buildinfo))
704     config.write ("BUILD_BLENDER_DYNAMIC = %r\n"%(build_blender_dynamic))
705     config.write ("BUILD_BLENDER_STATIC = %r\n"%(build_blender_static))
706     config.write ("BUILD_BLENDER_PLAYER = %r\n"%(build_blender_player))
707     config.write ("BUILD_BLENDER_PLUGIN = %r\n"%(build_blender_plugin))
708     config.write ("BUILD_DIR = %r\n"%(root_build_dir))
709     
710     config.write ("\n# Extra compiler flags can be defined here.\n")
711     config.write ("DEFINES = %s\n"%(my_defines))
712     config.write ("CCFLAGS = %s\n"%(my_ccflags))
713     config.write ("CXXFLAGS = %s\n"%(my_cxxflags))
714     config.write ("LDFLAGS = %s\n"%(my_ldflags))
715
716     config.write ("USE_INTERNATIONAL = %r\n"%(use_international))
717     config.write ("BUILD_GAMEENGINE = %r\n"%(use_gameengine))
718     if use_ode == 'true':
719         config.write ("USE_PHYSICS = 'ode'\n")
720     else:
721         config.write ("USE_PHYSICS = 'solid'\n")
722     config.write ("USE_OPENAL = %r\n"%(use_openal))
723     config.write ("USE_FMOD = %r\n"%(use_fmod))
724     config.write ("USE_QUICKTIME = %r\n"%(use_quicktime))
725     config.write ("\n# Compiler information.\n")
726     config.write ("HOST_CC = %r\n"%(env_dict['CC']))
727     config.write ("HOST_CXX = %r\n"%(env_dict['CXX']))
728     config.write ("TARGET_CC = %r\n"%(env_dict['CC']))
729     config.write ("TARGET_CXX = %r\n"%(env_dict['CXX']))
730     config.write ("TARGET_AR = %r\n"%(env_dict['AR']))
731     config.write ("PATH = %r\n"%(os.environ['PATH']))
732     config.write ("\n# External library information.\n")
733     config.write ("PLATFORM_LIBS = %r\n"%(platform_libs))
734     config.write ("PLATFORM_LIBPATH = %r\n"%(platform_libpath))
735     config.write ("PLATFORM_LINKFLAGS = %r\n"%(platform_linkflags))
736     config.write ("PYTHON_INCLUDE = %r\n"%(python_include))
737     config.write ("PYTHON_LIBPATH = %r\n"%(python_libpath))
738     config.write ("PYTHON_LIBRARY = %r\n"%(python_lib))
739     config.write ("PYTHON_LINKFLAGS = %r\n"%(python_linkflags))
740     config.write ("SDL_CFLAGS = %r\n"%(sdl_cflags))
741     config.write ("SDL_INCLUDE = %r\n"%(sdl_include))
742     config.write ("SDL_LIBPATH = %r\n"%(sdl_libpath))
743     config.write ("SDL_LIBRARY = %r\n"%(sdl_lib))
744     config.write ("Z_INCLUDE = %r\n"%(z_include))
745     config.write ("Z_LIBPATH = %r\n"%(z_libpath))
746     config.write ("Z_LIBRARY = %r\n"%(z_lib))
747     config.write ("PNG_INCLUDE = %r\n"%(png_include))
748     config.write ("PNG_LIBPATH = %r\n"%(png_libpath))
749     config.write ("PNG_LIBRARY = %r\n"%(png_lib))
750     config.write ("JPEG_INCLUDE = %r\n"%(jpeg_include))
751     config.write ("JPEG_LIBPATH = %r\n"%(jpeg_libpath))
752     config.write ("JPEG_LIBRARY = %r\n"%(jpeg_lib))
753     config.write ("OPENGL_INCLUDE = %r\n"%(opengl_include))
754     config.write ("OPENGL_LIBPATH = %r\n"%(opengl_libpath))
755     config.write ("OPENGL_LIBRARY = %r\n"%(opengl_lib))
756     config.write ("OPENGL_STATIC = %r\n"%(opengl_static))
757     config.write ("\n# The following information is only necessary when you've enabled support for\n")
758     config.write ("# the game engine.\n")
759     config.write ("SOLID_INCLUDE = %r\n"%(solid_include))
760     config.write ("SOLID_LIBPATH = %r\n"%(solid_libpath))
761     config.write ("SOLID_LIBRARY = %r\n"%(solid_lib))
762     config.write ("QHULL_INCLUDE = %r\n"%(qhull_include))
763     config.write ("QHULL_LIBPATH = %r\n"%(qhull_libpath))
764     config.write ("QHULL_LIBRARY = %r\n"%(qhull_lib))
765     config.write ("ODE_INCLUDE = %r\n"%(ode_include))
766     config.write ("ODE_LIBPATH = %r\n"%(ode_libpath))
767     config.write ("ODE_LIBRARY = %r\n"%(ode_lib))
768     config.write ("OPENAL_INCLUDE = %r\n"%(openal_include))
769     config.write ("OPENAL_LIBPATH = %r\n"%(openal_libpath))
770     config.write ("OPENAL_LIBRARY = %r\n"%(openal_lib))
771     config.write ("\n# The following information is only necessary when building with\n")
772     config.write ("# internationalization support.\n");
773     config.write ("FTGL_INCLUDE = %r\n"%(ftgl_include))
774     config.write ("FTGL_LIBPATH = %r\n"%(ftgl_libpath))
775     config.write ("FTGL_LIBRARY = %r\n"%(ftgl_lib))
776     config.write ("FREETYPE_INCLUDE = %r\n"%(freetype_include))
777     config.write ("FREETYPE_LIBPATH = %r\n"%(freetype_libpath))
778     config.write ("FREETYPE_LIBRARY = %r\n"%(freetype_lib))
779     config.write ("GETTEXT_INCLUDE = %r\n"%(gettext_include))
780     config.write ("GETTEXT_LIBPATH = %r\n"%(gettext_libpath))
781     config.write ("GETTEXT_LIBRARY = %r\n"%(gettext_lib))
782     config.close ()
783
784 #-----------------------------------------------------------------------------
785 # Read the options from the config file and update the various necessary flags
786 #-----------------------------------------------------------------------------
787 list_opts = []
788 user_options_env = Environment ()
789 user_options = Options (config_file)
790 user_options.AddOptions (
791         ('VERSION', 'Blender version', version),
792         (EnumOption ('BUILD_BINARY', 'release',
793                      'Select a release or debug binary.',
794                      allowed_values = ('release', 'debug'))),
795         (BoolOption ('USE_BUILDINFO',
796                      'Set to 1 if you want to add build information.',
797                      'false')),
798         (BoolOption ('BUILD_BLENDER_DYNAMIC',
799                      'Set to 1 if you want to build blender with hardware accellerated OpenGL support.',
800                      'true')),
801         (BoolOption ('BUILD_BLENDER_STATIC',
802                      'Set to 1 if you want to build blender with software OpenGL support.',
803                      'false')),
804         (BoolOption ('BUILD_BLENDER_PLAYER',
805                      'Set to 1 if you want to build the blender player.',
806                      'false')),
807         (BoolOption ('BUILD_BLENDER_PLUGIN',
808                      'Set to 1 if you want to build the blender plugin.',
809                      'false')),
810         ('BUILD_DIR', 'Target directory for intermediate files.',
811                      root_build_dir),
812         (BoolOption ('USE_INTERNATIONAL',
813                      'Set to 1 to have international support.',
814                      'false')),
815         (EnumOption ('USE_PHYSICS', 'solid',
816                      'Select which physics engine to use.',
817                      allowed_values = ('ode', 'solid'))),
818         (BoolOption ('BUILD_GAMEENGINE',
819                      'Set to 1 to build blender with game engine support.',
820                      'false')),
821         (BoolOption ('USE_OPENAL',
822                      'Set to 1 to build the game engine with OpenAL support.',
823                      'false')),
824         (BoolOption ('USE_FMOD',
825                      'Set to 1 to build the game engine with FMod support.',
826                      'false')),
827         (BoolOption ('USE_QUICKTIME',
828                      'Set to 1 to add support for QuickTime.',
829                      'false')),
830         ('HOST_CC', 'C compiler for the host platfor. This is the same as target platform when not cross compiling.'),
831         ('HOST_CXX', 'C++ compiler for the host platform. This is the same as target platform when not cross compiling.'),
832         ('TARGET_CC', 'C compiler for the target platform.'),
833         ('TARGET_CXX', 'C++ compiler for the target platform.'),
834         ('TARGET_AR', 'Linker command for linking libraries.'),
835         ('PATH', 'Standard search path'),
836         ('PLATFORM_LIBS', 'Platform specific libraries.'),
837         ('PLATFORM_LIBPATH', 'Platform specific library link path.'),
838         ('PLATFORM_LINKFLAGS', 'Platform specific linkflags'),
839         ('PYTHON_INCLUDE', 'Include directory for Python header files.'),
840         ('PYTHON_LIBPATH', 'Library path where the Python lib is located.'),
841         ('PYTHON_LIBRARY', 'Python library name.'),
842         ('PYTHON_LINKFLAGS', 'Python specific linkflags.'),
843         ('SDL_CFLAGS', 'Necessary CFLAGS when using sdl functionality.'),
844         ('SDL_INCLUDE', 'Include directory for SDL header files.'),
845         ('SDL_LIBPATH', 'Library path where the SDL library is located.'),
846         ('SDL_LIBRARY', 'SDL library name.'),
847         ('Z_INCLUDE', 'Include directory for zlib header files.'),
848         ('Z_LIBPATH', 'Library path where the zlib library is located.'),
849         ('Z_LIBRARY', 'Z library name.'),
850         ('PNG_INCLUDE', 'Include directory for png header files.'),
851         ('PNG_LIBPATH', 'Library path where the png library is located.'),
852         ('PNG_LIBRARY', 'png library name.'),
853         ('JPEG_INCLUDE', 'Include directory for jpeg header files.'),
854         ('JPEG_LIBPATH', 'Library path where the jpeg library is located.'),
855         ('JPEG_LIBRARY', 'jpeg library name.'),
856         ('OPENGL_INCLUDE', 'Include directory for OpenGL header files.'),
857         ('OPENGL_LIBPATH', 'Library path where the OpenGL libraries are located.'),
858         ('OPENGL_LIBRARY', 'OpenGL library names.'),
859         ('OPENGL_STATIC', 'Linker flags for static linking of Open GL.'),
860         ('SOLID_INCLUDE', 'Include directory for SOLID header files.'),
861         ('SOLID_LIBPATH', 'Library path where the SOLID library is located.'),
862         ('SOLID_LIBRARY', 'SOLID library name.'),
863         ('QHULL_INCLUDE', 'Include directory for QHULL header files.'),
864         ('QHULL_LIBPATH', 'Library path where the QHULL library is located.'),
865         ('QHULL_LIBRARY', 'QHULL library name.'),
866         ('ODE_INCLUDE', 'Include directory for ODE header files.'),
867         ('ODE_LIBPATH', 'Library path where the ODE library is located.'),
868         ('ODE_LIBRARY', 'ODE library name.'),
869         ('OPENAL_INCLUDE', 'Include directory for OpenAL header files.'),
870         ('OPENAL_LIBPATH', 'Library path where the OpenAL library is located.'),
871         ('OPENAL_LIBRARY', 'OpenAL library name.'),
872         ('FTGL_INCLUDE', 'Include directory for ftgl header files.'),
873         ('FTGL_LIBPATH', 'Library path where the ftgl library is located.'),
874         ('FTGL_LIBRARY', 'ftgl library name.'),
875         ('FREETYPE_INCLUDE', 'Include directory for freetype2 header files.'),
876         ('FREETYPE_LIBPATH', 'Library path where the freetype2 library is located.'),
877         ('FREETYPE_LIBRARY', 'Freetype2 library name.'),
878         ('GETTEXT_INCLUDE', 'Include directory for gettext header files.'),
879         ('GETTEXT_LIBPATH', 'Library path where the gettext library is located.'),
880         ('GETTEXT_LIBRARY', 'gettext library name.'),
881
882         ('DEFINES', 'Extra Preprocessor defines.'),
883         ('CCFLAGS', 'Extra C Compiler flags.'),
884         ('CXXFLAGS','Extra C++ Compiler flags.'),
885         ('LDFLAGS', 'Extra Linker flags.')
886     )
887 user_options.Update (user_options_env)
888 user_options_dict = user_options_env.Dictionary()
889
890 root_build_dir = user_options_dict['BUILD_DIR']
891     
892 if user_options_dict['BUILD_GAMEENGINE'] == 1:
893     defines += ['GAMEBLENDER=1']
894     if user_options_dict['USE_PHYSICS'] == 'ode':
895         defines += ['USE_ODE']
896     else:
897         defines += ['USE_SUMO_SOLID']
898 else:
899     defines += ['GAMEBLENDER=0']
900
901 if user_options_dict['BUILD_BINARY'] == 'release':
902     cflags = extra_flags + release_flags + warn_flags
903     defines += ['NDEBUG']
904 else:
905     cflags = extra_flags + debug_flags + warn_flags
906     if sys.platform == 'win32':
907         #defines += ['_DEBUG'] specifying this makes msvc want to link to python22_d.lib??
908         platform_linkflags += ['/DEBUG','/PDB:blender.pdb']
909
910 defines += user_options_dict['DEFINES']
911 cflags += user_options_dict['CCFLAGS']
912 cxxflags += user_options_dict['CXXFLAGS']
913 platform_linkflags += user_options_dict['LDFLAGS']
914
915 #-----------------------------------------------------------------------------
916 # Generic library generation environment. This one is the basis for each
917 # library.
918 #-----------------------------------------------------------------------------
919 library_env = env.Copy ()
920 library_env.Replace (CC = user_options_dict['TARGET_CC'])
921 library_env.Replace (CXX = user_options_dict['TARGET_CXX'])
922 library_env.Replace (PATH = user_options_dict['PATH'])
923 library_env.Replace (AR = user_options_dict['TARGET_AR'])
924 library_env.Append (CCFLAGS = cflags)
925 library_env.Append (CXXFLAGS = cxxflags)
926 library_env.Append (CPPDEFINES = defines)
927 library_env.SConsignFile (root_build_dir+'scons-signatures')
928
929 #-----------------------------------------------------------------------------
930 # Settings to be exported to other SConscript files
931 #-----------------------------------------------------------------------------
932
933 if enable_clean==0: # only read SConscripts when not cleaning, this to cut overhead
934         Export ('cflags')
935         Export ('defines')
936         Export ('window_system')
937         Export ('extra_includes')
938         Export ('user_options_dict')
939         Export ('library_env')
940         
941         BuildDir (root_build_dir+'/extern', 'extern', duplicate=0)
942         SConscript (root_build_dir+'extern/SConscript')
943         BuildDir (root_build_dir+'/intern', 'intern', duplicate=0)
944         SConscript (root_build_dir+'intern/SConscript')
945         BuildDir (root_build_dir+'/source', 'source', duplicate=0)
946         SConscript (root_build_dir+'source/SConscript')
947         
948         libpath = (['#'+root_build_dir+'/lib'])
949         
950         link_env = library_env.Copy ()
951         link_env.Append (LIBPATH=libpath)
952
953
954 def common_libs(env):
955         """
956         Append to env all libraries that are common to Blender and Blenderplayer
957         """
958         env.Append (LIBS=[
959                 'blender_blenloader',
960                 'blender_readblenfile',
961                 'blender_img',
962                 'blender_blenkernel',
963                 'blender_blenpluginapi',
964                 'blender_imbuf',
965                 'blender_avi',
966                 'blender_blenlib',
967                 'blender_makesdna',
968                 'blender_kernel',
969                 'blender_GHOST',
970                 'blender_STR',
971                 'blender_guardedalloc',
972                 'blender_CTR',
973                 'blender_MEM',
974                 'blender_MT',
975                 'blender_BMF',
976                 'soundsystem'])
977         if user_options_dict['USE_QUICKTIME'] == 1:
978                 env.Append (LIBS=['blender_quicktime'])
979
980
981 def international_libs(env):
982         """
983         Append international font support libraries
984         """
985         if user_options_dict['USE_INTERNATIONAL'] == 1:
986                 env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
987                 env.Append (LIBPATH=user_options_dict['FREETYPE_LIBPATH'])
988                 env.Append (LIBS=['blender_FTF'])
989                 env.Append (LIBS=user_options_dict['FTGL_LIBRARY'])
990                 env.Append (LIBPATH=user_options_dict['FTGL_LIBPATH'])
991                 env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
992
993 def blender_libs(env):
994         """
995         Blender only libs (not in player)
996         """
997         env.Append( LIBS=['blender_creator',
998                 'blender_blendersrc',
999                 'blender_render',
1000                 'blender_yafray',
1001                 'blender_renderconverter',
1002                 'blender_radiosity',
1003                 'blender_LOD',
1004                 'blender_BSP',
1005                 'blender_blenkernel',
1006                 'blender_IK',
1007                 'blender_ONL'])
1008
1009 def ketsji_libs(env):
1010         """
1011         Game Engine libs
1012         """
1013         if user_options_dict['BUILD_GAMEENGINE'] == 1:
1014                 env.Append (LIBS=['KX_blenderhook',
1015                                 'KX_converter',
1016                                 'PHY_Dummy',
1017                                 'PHY_Physics',
1018                                 'KX_ketsji',
1019                                 'SCA_GameLogic',
1020                                 'RAS_rasterizer',
1021                                 'RAS_OpenGLRasterizer',
1022                                 'blender_expressions',
1023                                 'SG_SceneGraph',
1024                                 'blender_MT',
1025                                 'KX_blenderhook',
1026                                 'KX_network',
1027                                 'blender_kernel',
1028                                 'NG_network',
1029                                 'NG_loopbacknetwork'])
1030                 if user_options_dict['USE_PHYSICS'] == 'solid':
1031                         env.Append (LIBS=['PHY_Sumo', 'PHY_Physics', 'blender_MT', 'extern_solid', 'extern_qhull'])
1032                 else:
1033                         env.Append (LIBS=['PHY_Ode',
1034                                         'PHY_Physics'])
1035                         env.Append (LIBS=user_options_dict['ODE_LIBRARY'])
1036                         env.Append (LIBPATH=user_options_dict['ODE_LIBPATH'])
1037
1038 def player_libs(env):
1039         """
1040         Player libraries
1041         """
1042         env.Append (LIBS=['GPG_ghost',
1043                         'GPC_common'])
1044
1045 def player_libs2(env):
1046         """
1047         Link order shenannigans: these libs are added after common_libs
1048         """
1049         env.Append (LIBS=['blender_blenkernel_blc',
1050                         'soundsystem'])
1051
1052 def winblenderres(env):
1053         """
1054         build the windows icon resource file
1055         """
1056         if sys.platform == 'win32':
1057                 env.RES(['source/icons/winblender.rc'])
1058
1059 def system_libs(env):
1060         """
1061         System libraries: Python, SDL, PNG, JPEG, Gettext, OpenAL, Carbon
1062         """
1063         env.Append (LIBS=['blender_python'])
1064         env.Append (LIBS=user_options_dict['PYTHON_LIBRARY'])
1065         env.Append (LIBPATH=user_options_dict['PYTHON_LIBPATH'])
1066         env.Append (LINKFLAGS=user_options_dict['PYTHON_LINKFLAGS'])
1067         env.Append (LIBS=user_options_dict['SDL_LIBRARY'])
1068         env.Append (LIBPATH=user_options_dict['SDL_LIBPATH'])
1069         env.Append (LIBS=user_options_dict['PNG_LIBRARY'])
1070         env.Append (LIBPATH=user_options_dict['PNG_LIBPATH'])
1071         env.Append (LIBS=user_options_dict['JPEG_LIBRARY'])
1072         env.Append (LIBPATH=user_options_dict['JPEG_LIBPATH'])
1073         env.Append (LIBS=user_options_dict['GETTEXT_LIBRARY'])
1074         env.Append (LIBPATH=user_options_dict['GETTEXT_LIBPATH'])
1075         env.Append (LIBS=user_options_dict['Z_LIBRARY'])
1076         env.Append (LIBPATH=user_options_dict['Z_LIBPATH'])
1077         if user_options_dict['USE_OPENAL'] == 1:
1078                 env.Append (LIBS=user_options_dict['OPENAL_LIBRARY'])
1079                 env.Append (LIBPATH=user_options_dict['OPENAL_LIBPATH'])
1080         env.Append (LIBS=user_options_dict['PLATFORM_LIBS'])
1081         env.Append (LIBPATH=user_options_dict['PLATFORM_LIBPATH'])
1082         if sys.platform == 'darwin':
1083                 env.Append (LINKFLAGS='-framework')
1084                 env.Append (LINKFLAGS='Carbon')
1085                 env.Append (LINKFLAGS='-framework')
1086                 env.Append (LINKFLAGS='AGL')
1087                 env.Append (LINKFLAGS='-framework')
1088                 env.Append (LINKFLAGS='AudioUnit')
1089                 env.Append (LINKFLAGS='-framework')
1090                 env.Append (LINKFLAGS='AudioToolbox')
1091                 env.Append (LINKFLAGS='-framework')
1092                 env.Append (LINKFLAGS='CoreAudio')
1093                 if user_options_dict['USE_QUICKTIME'] == 1:
1094                         env.Append (LINKFLAGS='-framework')
1095                         env.Append (LINKFLAGS='QuickTime')
1096         else:
1097                 env.Append (LINKFLAGS=user_options_dict['PLATFORM_LINKFLAGS'])
1098         env.BuildDir (root_build_dir, '.', duplicate=0)
1099
1100 def buildinfo(env, build_type):
1101         """
1102         Generate a buildinfo object
1103         """
1104         build_date = time.strftime ("%Y-%m-%d")
1105         build_time = time.strftime ("%H:%M:%S")
1106         obj = []
1107         if user_options_dict['USE_BUILDINFO'] == 1:
1108                 if sys.platform=='win32':
1109                         build_info_file = open("source/creator/winbuildinfo.h", 'w')
1110                         build_info_file.write("char *build_date=\"%s\";\n"%build_date)
1111                         build_info_file.write("char *build_time=\"%s\";\n"%build_time)
1112                         build_info_file.write("char *build_platform=\"win32\";\n")
1113                         build_info_file.write("char *build_type=\"%s\";\n"%build_type)
1114                         build_info_file.close()
1115                         env.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
1116                 else:
1117                         env.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
1118                                                         'BUILD_DATE=\'"%s"\''%(build_date),
1119                                                         'BUILD_TYPE=\'"dynamic"\'',
1120                                                         'NAN_BUILDINFO',
1121                                                         'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
1122                 obj = [env.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type,
1123                                                 [root_build_dir+'source/creator/buildinfo.c'])]
1124         return obj
1125         
1126 def cleanCVS():
1127         """
1128         walks the dist dir and removes all CVS dirs
1129         """
1130         
1131         try:
1132                 import shutil
1133         except:
1134                 print "no shutil available"
1135                 print "make sure you use python 2.3"
1136                 print
1137                 return 0
1138         
1139         startdir = os.getcwd()
1140         
1141         for root, dirs, files in os.walk("dist", topdown=False):
1142                 for name in dirs:
1143                         if name in ['CVS']:
1144                                 if os.path.isdir(root + "/" + name):
1145                                         shutil.rmtree(root + "/" + name)
1146         
1147         os.chdir(startdir)
1148         
1149         return 1
1150
1151 def preparedist():
1152         """
1153         Prepare a directory for creating either archives or the installer
1154         """
1155         
1156         try:
1157                 import shutil
1158         except:
1159                 print "no shutil available"
1160                 print "make sure you use python 2.3"
1161                 print
1162                 return 0
1163         
1164         startdir = os.getcwd()
1165         
1166         if os.path.isdir("dist") == 0:
1167                 os.makedirs("dist")
1168         else:
1169                 shutil.rmtree("dist") # make sure we don't get old cruft
1170                 os.makedirs("dist")
1171         
1172         # first copy binaries
1173         
1174         if sys.platform == 'win32':
1175                 shutil.copy("blender.exe", "dist/blender.exe")
1176                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1177                         shutil.copy("blenderplayer.exe", "dist/blenderplayer.exe")
1178                 shutil.copy("../lib/windows/python/lib/python23.dll", "dist/python23.dll")
1179                 shutil.copy("../lib/windows/sdl/lib/SDL.dll", "dist/SDL.dll")
1180                 shutil.copy("../lib/windows/gettext/lib/gnu_gettext.dll", "dist/gnu_gettext.dll")
1181         elif sys.platform in ['linux2', 'linux-i386']:
1182                 shutil.copy("blender", "dist/blender")
1183                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1184                         shutil.copy("blenderplayer", "dist/blenderplayer")
1185         else:
1186                 print "update preparedist() for your platform!"
1187                 return 0
1188         
1189         # now copy .blender and necessary extras for it
1190         if os.path.isdir("dist/.blender"):
1191                 shutil.rmtree("dist/.blender")
1192         os.chdir("bin")
1193         shutil.copytree(".blender/", "../dist/.blender")
1194         os.chdir(startdir)
1195         if os.path.isdir("dist/.blender/scripts"):
1196                 shutil.rmtree("dist/.blender/scripts")
1197         if os.path.isdir("dist/.blender/bpydata"):
1198                 shutil.rmtree("dist/.blender/bpydata")
1199                 
1200         os.makedirs("dist/.blender/bpydata")
1201         shutil.copy("release/bpydata/readme.txt", "dist/.blender/bpydata/readme.txt")
1202         
1203         os.chdir("release")
1204         shutil.copytree("scripts/", "../dist/.blender/scripts")
1205         
1206         # finally copy auxiliaries (readme, license, etc.)
1207         if sys.platform == 'win32':
1208                 shutil.copy("windows/extra/Help.url", "../dist/Help.url")
1209         shutil.copy("text/copyright.txt", "../dist/copyright.txt")
1210         shutil.copy("text/blender.html", "../dist/blender.html")
1211         shutil.copy("text/GPL-license.txt", "../dist/GPL-license.txt")
1212         shutil.copy("text/Python-license.txt", "../dist/Python-lisence.txt")
1213         
1214         reltext = "release_" + string.join(version.split("."), '') + ".txt"
1215         shutil.copy("text/" + reltext, "../dist/" + reltext)
1216         
1217         os.chdir(startdir)
1218         
1219         if cleanCVS()==0:
1220                 return 0
1221
1222         return 1
1223
1224 def finalisedist(zipname):
1225         """
1226         Fetch the package created and remove temp dir
1227         """
1228         
1229         try:
1230                 import shutil
1231         except:
1232                 print "no shutil available"
1233                 print "make sure you use python 2.3"
1234                 print
1235                 return 0
1236         
1237         shutil.copy("dist/" + zipname, zipname)
1238         shutil.rmtree("dist")
1239         
1240         return 1
1241
1242 def add2arc(arc, file):
1243         if sys.platform == 'win32':
1244                 arc.write(file)
1245         else:
1246                 arc.add(file)
1247
1248                 
1249 def appit(target, source, env):
1250         if sys.platform == 'darwin':
1251                 import shutil
1252                 import commands
1253                 import os.path
1254                                                 
1255                 target = 'blender' 
1256                 sourceinfo = "source/darwin/%s.app/Contents/Info.plist"%target
1257                 targetinfo = "%s.app/Contents/Info.plist"%target
1258
1259                 cmd = '%s.app'%target
1260                 if os.path.isdir(cmd):
1261                         shutil.rmtree('%s.app'%target)
1262                 shutil.copytree("source/darwin/%s.app"%target, '%s.app'%target)
1263                 cmd = "cat %s | sed s/VERSION/`cat release/VERSION`/ | sed s/DATE/`date +'%%Y-%%b-%%d'`/ > %s"%(sourceinfo,targetinfo)
1264                 commands.getoutput(cmd)
1265                 cmd = 'cp %s %s.app/Contents/MacOS/%s'%(target, target, target)
1266                 commands.getoutput(cmd)
1267                 cmd = 'strip -u -r %s.app/Contents/MacOS/%s'%(target, target)
1268                 commands.getoutput(cmd)
1269                 cmd = '%s.app/Contents/Resources/'%target
1270                 shutil.copy('bin/.blender/.bfont.ttf', cmd)
1271                 shutil.copy('bin/.blender/.Blanguages', cmd)
1272                 cmd = 'cp -R bin/.blender/locale %s.app/Contents/Resources/'%target
1273                 commands.getoutput(cmd)
1274                 cmd = 'cp -R release/bpydata %s.app/Contents/Resources/'%target + \
1275                 commands.getoutput(cmd)
1276                 cmd = 'cp -R release/scripts %s.app/Contents/Resources/'%target + \
1277                 commands.getoutput(cmd)
1278                 cmd = 'cp -R release/plugins %s.app/Contents/Resources/'%target 
1279                 commands.getoutput(cmd)
1280                 cmd = 'chmod +x  %s.app/Contents/MacOS/%s'%(target, target)
1281                 commands.getoutput(cmd)
1282                 cmd = 'find %s.app -name CVS -prune -exec rm -rf {} \;'%target
1283                 commands.getoutput(cmd)
1284                 cmd = 'find %s.app -name .DS_Store -exec rm -rf {} \;'%target
1285                 commands.getoutput(cmd)
1286                 
1287                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1288                         target = 'blenderplayer' 
1289                         sourceinfo = "source/darwin/%s.app/Contents/Info.plist"%target
1290                         targetinfo = "%s.app/Contents/Info.plist"%target
1291
1292                         cmd = '%s.app'%target
1293                         if os.path.isdir(cmd):
1294                                 shutil.rmtree('%s.app'%target)
1295                         shutil.copytree("source/darwin/%s.app"%target, '%s.app'%target)
1296                         cmd = "cat %s | sed s/VERSION/`cat release/VERSION`/ | sed s/DATE/`date +'%%Y-%%b-%%d'`/ > %s"%(sourceinfo,targetinfo)
1297                         commands.getoutput(cmd)
1298                         cmd = 'cp %s %s.app/Contents/MacOS/%s'%(target, target, target)
1299                         commands.getoutput(cmd)
1300                         cmd = 'strip -u -r %s.app/Contents/MacOS/%s'%(target, target)
1301                         commands.getoutput(cmd)
1302                         cmd = '%s.app/Contents/Resources/'%target
1303                         shutil.copy('bin/.blender/.bfont.ttf', cmd)
1304                         shutil.copy('bin/.blender/.Blanguages', cmd)
1305                         cmd = 'cp -R bin/.blender/locale %s.app/Contents/Resources/'%target
1306                         commands.getoutput(cmd)
1307                         cmd = 'cp -R release/bpydata %s.app/Contents/Resources/'%target + \
1308                         commands.getoutput(cmd)
1309                         cmd = 'cp -R release/scripts %s.app/Contents/Resources/'%target + \
1310                         commands.getoutput(cmd)
1311                         cmd = 'cp -R release/plugins %s.app/Contents/Resources/'%target 
1312                         commands.getoutput(cmd)
1313                         cmd = 'chmod +x  %s.app/Contents/MacOS/%s'%(target, target)
1314                         commands.getoutput(cmd)
1315                         cmd = 'find %s.app -name CVS -prune -exec rm -rf {} \;'%target
1316                         commands.getoutput(cmd)
1317                         cmd = 'find %s.app -name .DS_Store -exec rm -rf {} \;'%target
1318                         commands.getoutput(cmd)
1319                 
1320         else:
1321                 print "This target is for the Os X platform only"
1322
1323 def zipit(env, target, source):
1324         try:
1325                 if sys.platform == 'win32':
1326                         import zipfile
1327                 else:
1328                         import tarfile
1329         except:
1330                 if sys.platform == 'win32':
1331                         print "no zipfile module found"
1332                 else:
1333                         print "no tarfile module found"
1334                         print "make sure you use python 2.3"
1335                 print
1336                 return
1337         
1338         import glob
1339         import time
1340         
1341         startdir = os.getcwd()
1342         pf=""
1343         zipext = ""
1344         zipname = ""
1345         
1346         today = time.strftime("%Y%m%d", time.gmtime()) # get time in the form 20040714
1347         
1348         if preparedist()==0:
1349                 print "check output for error"
1350                 return
1351         
1352         os.chdir(startdir + "/dist")
1353         
1354         if sys.platform == 'win32':
1355                 zipext += ".zip"
1356                 pf = "windows"
1357         elif sys.platform == 'linux2' or sys.platform == 'linux-i386':
1358                 zipext += ".tar.gz"
1359                 pf = "linux"
1360         
1361         zipname = "bf_blender_" + pf+ "_" + today + zipext
1362         
1363         print
1364         if sys.platform == 'win32':
1365                 print "Create the zip!"
1366         elif sys.platform == 'linux2' or sys.platform == 'linux-i386':
1367                 print "Create the tarball!"
1368         print
1369         
1370         if sys.platform == 'win32':
1371                 thezip = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED)
1372         else:
1373                 thezip = tarfile.open(zipname, 'w:gz')
1374         
1375         for root, dirs, files in os.walk(".", topdown=False):
1376                 for name in files:
1377                         if name in [zipname]:
1378                                 print "skipping self"
1379                         else:
1380                                 file = root + "/" + name
1381                                 print "adding: " + file
1382                                 add2arc(thezip, file)
1383         
1384         thezip.close()
1385         
1386         os.chdir(startdir)
1387         
1388         if finalisedist(zipname)==0:
1389                 print "encountered an error in finalisedist"
1390                 print
1391                 return
1392         
1393         print
1394         print "Blender has been successfully packaged"
1395         print "You can find the file %s in the root source directory"%zipname
1396         print
1397         
1398
1399 def printadd(env, target, source):
1400         """
1401         Print warning message if platform hasn't been added to zipit() yet
1402         """
1403         
1404         print
1405         print "############"
1406         print 
1407         print "Make sure zipit() works for your platform:"
1408         print "  - binaries to copy (naming?)"
1409         print "  - possible libraries?"
1410         print "  - archive format?"
1411         print
1412         print "After you've corrected zipit() for your"
1413         print "platform, be sure to add a proper elif"
1414         print "at the end of BlenderRelease"
1415         print
1416         print "Blender is now ready and can be found in"
1417         print "root of the source distribution, but it"
1418         print "hasn't been packaged neatly. Make sure you"
1419         print "get the right files"
1420         print
1421         print "/jesterKing"
1422         print
1423         
1424
1425 def noaction(env, target, source):
1426         print "Empty action"
1427
1428 def DoClean(dir2clean):
1429         """
1430         Do a removal of the root_build_dir the fast way
1431         """
1432         
1433         import shutil
1434         print
1435         print "start the clean"
1436         dirs = os.listdir(dir2clean)
1437         for dir in dirs:
1438                 if os.path.isdir(dir2clean + "/" + dir) == 1:
1439                         print "clean dir %s"%(dir2clean+"/" + dir)
1440                         shutil.rmtree(dir2clean+"/" + dir)
1441         print "done"
1442
1443 def BlenderDefault(target):
1444         """
1445         The default Blender build.
1446         """
1447         def_env = Environment()
1448         default = def_env.Command('nozip', 'blender$PROGSUFFIX', noaction)
1449         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1450                 def_env.Depends(default, 'blenderplayer$PROGSUFFIX')
1451         def_env.Alias(".", default)
1452
1453 def donsis(env, target, source):
1454         """
1455         Create a Windows installer with NSIS
1456         """
1457         print
1458         print "Creating the Windows installer"
1459         print
1460         
1461         startdir = os.getcwd()
1462         
1463         if preparedist()==0:
1464                 print "check output for error"
1465                 return
1466         
1467         os.chdir("release/windows/installer")
1468         
1469         nsis = open("00.sconsblender.nsi", 'r')
1470         nsis_cnt = str(nsis.read())
1471         nsis.close()
1472         
1473         # do root
1474         rootlist = []
1475         rootdir = os.listdir(startdir + "\\dist")
1476         for rootitem in rootdir:
1477                 if os.path.isdir(startdir + "\\dist\\" + rootitem) == 0:
1478                         rootlist.append("File " + startdir + "\\dist\\" + rootitem)
1479         rootstring = string.join(rootlist, "\n  ")
1480         rootstring += "\n\n"
1481         nsis_cnt = string.replace(nsis_cnt, "[ROOTDIRCONTS]", rootstring)
1482         
1483         # do scripts
1484         scriptlist = []
1485         scriptdir = os.listdir(startdir + "\\dist\\.blender\\scripts")
1486         for scriptitem in scriptdir:
1487                 if os.path.isdir(startdir + "\\dist\\.blender\\scripts\\" + scriptitem) == 0:
1488                         scriptlist.append("File " + startdir + "\\dist\\.blender\\scripts\\" + scriptitem)
1489         scriptstring = string.join(scriptlist, "\n  ")
1490         scriptstring += "\n\n"
1491         nsis_cnt = string.replace(nsis_cnt, "[SCRIPTCONTS]", scriptstring)
1492         
1493         # do dotblender
1494         dotblendlist = []
1495         dotblenddir = os.listdir(startdir+"\\dist\\.blender")
1496         for dotblenditem in dotblenddir:
1497                 if os.path.isdir(startdir + "\\dist\\.blender\\" + dotblenditem) == 0:
1498                         dotblendlist.append("File " + startdir + "\\dist\\.blender\\" + dotblenditem)
1499         dotblendstring = string.join(dotblendlist, "\n  ")
1500         dotblendstring += "\n\n"
1501         nsis_cnt = string.replace(nsis_cnt, "[DOTBLENDERCONTS]", dotblendstring)
1502         
1503         # do language files
1504         langlist = []
1505         langdir = os.listdir(startdir + "\\dist\\.blender\\locale")
1506         for langitem in langdir:
1507                 if os.path.isdir(startdir + "\\dist\\.blender\\locale\\" + langitem) == 1:
1508                         langlist.append("File " + startdir + "\\dist\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo")
1509         langstring = string.join(langlist, "\n  ")
1510         langstring += "\n\n"
1511         nsis_cnt = string.replace(nsis_cnt, "[LANGUAGECONTS]", langstring)
1512         
1513         # var replacements
1514         nsis_cnt = string.replace(nsis_cnt, "DISTDIR", startdir + "\\dist")
1515         nsis_cnt = string.replace(nsis_cnt, "SHORTVER", shortversion)
1516         nsis_cnt = string.replace(nsis_cnt, "VERSION", version)
1517         
1518         new_nsis = open("00.blender_tmp.nsi", 'w')
1519         new_nsis.write(nsis_cnt)
1520         new_nsis.close()
1521         
1522         sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w')
1523         
1524         os.chdir(startdir)
1525         
1526         
1527 def BlenderNSIS(target):
1528         """
1529         Entry for creating Windows installer
1530         """
1531         if sys.platform == 'win32':
1532                 inst_env = Environment()
1533                 nsis_inst = inst_env.Command('nsisinstaller', 'blender$PROGSUFFIX', donsis)
1534                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1535                         inst_env.Depends(nsis_inst, 'blenderplayer$PROGSUFFIX')
1536                 inst_env.Alias("wininst", nsis_inst)
1537         else:
1538                 print "This target is for the win32 platform only "
1539
1540 def BlenderRelease(target):
1541         """
1542         Make a Release package (tarball, zip, bundle).
1543         
1544         target = Name of package to make (string)
1545         eg: BlenderRelease('blender')
1546         """
1547         
1548         if sys.platform == 'darwin':
1549                 app_env = Environment()
1550                 Mappit = app_env.Command('appit', appname, appit)
1551                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1552                         app_env.Depends(Mappit, playername)
1553                 app_env.Alias("release", Mappit)
1554         elif sys.platform in ['win32', 'linux2', 'linux-i386']:
1555                 release_env = Environment()
1556                 releaseit = release_env.Command('blenderrelease', appname, zipit)
1557                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1558                         release_env.Depends(releaseit, playername)
1559                 release_env.Alias("release", releaseit)
1560         else:
1561                 release_env = Environment()
1562                 releaseit = release_env.Command('blender.tar.gz', appname, printadd)
1563                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1564                         release_env.Depends(releaseit, playername)
1565                 release_env.Alias("release", releaseit)
1566
1567 if enable_clean == 0:
1568
1569         
1570         if user_options_dict['BUILD_BLENDER_DYNAMIC'] == 1:
1571                 dy_blender = link_env.Copy ()
1572                 if sys.platform=='win32':
1573                         winblenderres(dy_blender)
1574                 blender_libs(dy_blender)
1575                 common_libs(dy_blender)
1576                 international_libs(dy_blender)
1577                 ketsji_libs(dy_blender)
1578                 system_libs(dy_blender)
1579                 dy_blender.Append (LIBS=user_options_dict['OPENGL_LIBRARY'])
1580                 dy_blender.Append (LIBPATH=user_options_dict['OPENGL_LIBPATH'])
1581                 dy_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1582                 d_obj = buildinfo(dy_blender, "dynamic")
1583                 if sys.platform == 'win32':
1584                         dy_blender.Program (target='blender',
1585                                                 source=d_obj + ['source/icons/winblender.res'])
1586                 else:
1587                         if sys.platform == 'cygwin':
1588                                 dy_blender.Replace (CC='g++')
1589                         dy_blender.Program (target='blender', source=d_obj)
1590         
1591         if user_options_dict['BUILD_BLENDER_STATIC'] == 1:
1592                 st_blender = link_env.Copy ()
1593                 if sys.platform=='win32':
1594                         winblenderres(st_blender)
1595                 blender_libs(st_blender)
1596                 common_libs(st_blender)
1597                 international_libs(st_blender)
1598                 ketsji_libs(st_blender)
1599                 system_libs(st_blender)
1600                 # The next line is to make sure that the LINKFLAGS are appended at the end
1601                 # of the link command. This 'trick' is needed because the GL and GLU static
1602                 # libraries need to be at the end of the command.
1603                 st_blender.Replace(LINKCOM="$LINK -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS")
1604                 s_obj = buildinfo(st_blender, "static")
1605                 st_blender.Append (LINKFLAGS=user_options_dict['OPENGL_STATIC'])
1606                 st_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1607                 st_blender.Prepend (LIBPATH=['/usr/lib/opengl/xfree/lib'])
1608                 st_blender.Program (target='blenderstatic', source=s_obj)
1609         
1610         if sys.platform=='win32':
1611                 if user_options_dict['BUILD_BINARY']=='debug':
1612                         browser = Environment()
1613                         browser_tmp = root_build_dir+'bscmake.tmp'
1614                         browser.Command ('blender.bsc', 'blender$PROGSUFFIX',
1615                                 ['dir /b/s '+root_build_dir+'*.sbr >'+browser_tmp,
1616                                  'bscmake /nologo /n /oblender.bsc @'+browser_tmp,
1617                                  'del '+browser_tmp])
1618         
1619         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1 and user_options_dict['BUILD_GAMEENGINE'] == 1:
1620                 player_blender = link_env.Copy()
1621                 player_libs(player_blender)
1622                 common_libs(player_blender)
1623                 international_libs(player_blender)
1624                 ketsji_libs(player_blender)
1625                 player_libs2(player_blender)
1626                 system_libs(player_blender)
1627                 player_blender.Append (LIBS=user_options_dict['OPENGL_LIBRARY'])
1628                 player_blender.Append (LIBPATH=user_options_dict['OPENGL_LIBPATH'])
1629                 player_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1630                 d_obj = buildinfo(player_blender, "player")
1631                 if sys.platform == 'win32':
1632                         player_blender.Program (target='blenderplayer',
1633                                                 source=d_obj + ['source/icons/winblender.res'])
1634                 else:
1635                         if sys.platform == 'cygwin':
1636                                 player_blender.Replace (CC='g++')
1637                         player_blender.Program (target='blenderplayer', source=d_obj)
1638                 if sys.platform=='win32':
1639                         if user_options_dict['BUILD_BINARY']=='debug':
1640                                 browser = Environment()
1641                                 browser_tmp = root_build_dir+'bscmake.tmp'
1642                                 browser.Command ('blenderplayer.bsc', 'blenderplayer$PROGSUFFIX',
1643                                 ['dir /b/s '+root_build_dir+'*.sbr >'+browser_tmp,
1644                                 'bscmake /nologo /n /oblenderplayer.bsc @'+browser_tmp,
1645                                 'del '+browser_tmp])
1646
1647         release_target = env.Alias("release", BlenderRelease(appname))
1648         default_target = env.Alias("default", BlenderDefault(appname))
1649         wininst_target = env.Alias("winist", BlenderNSIS(appname))
1650                 
1651 else: # only clean target to prevent any building
1652         clean_target = env.Alias("clean", DoClean(root_build_dir))
1653         Default("clean")
1654
1655 if enable_clean == 0: # only set up dependencies when not cleaning
1656         if sys.platform == 'darwin':
1657                 Default("release")
1658         else:
1659                 Default("default")
1660
1661         if sys.platform == 'win32':
1662                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1663                         env.Depends(wininst_target, playername)
1664                 env.Depends(wininst_target, appname)
1665         
1666         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1667                 env.Depends(release_target, playername)
1668         env.Depends(release_target, appname)
1669         
1670         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1671                 env.Depends(default_target, playername)
1672         env.Depends(default_target, appname)
1673