This commit prevents the loopcut tool from selecting a starting edge which isn't...
[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', 'NDEBUG']
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     if sys.platform == 'win32':
904         defines += ['NDEBUG']
905 else:
906     cflags = extra_flags + debug_flags + warn_flags
907     if sys.platform == 'win32':
908         #defines += ['_DEBUG'] specifying this makes msvc want to link to python22_d.lib??
909         platform_linkflags += ['/DEBUG','/PDB:blender.pdb']
910
911 defines += user_options_dict['DEFINES']
912 cflags += user_options_dict['CCFLAGS']
913 cxxflags += user_options_dict['CXXFLAGS']
914 platform_linkflags += user_options_dict['LDFLAGS']
915
916 #-----------------------------------------------------------------------------
917 # Generic library generation environment. This one is the basis for each
918 # library.
919 #-----------------------------------------------------------------------------
920 library_env = env.Copy ()
921 library_env.Replace (CC = user_options_dict['TARGET_CC'])
922 library_env.Replace (CXX = user_options_dict['TARGET_CXX'])
923 library_env.Replace (PATH = user_options_dict['PATH'])
924 library_env.Replace (AR = user_options_dict['TARGET_AR'])
925 library_env.Append (CCFLAGS = cflags)
926 library_env.Append (CXXFLAGS = cxxflags)
927 library_env.Append (CPPDEFINES = defines)
928 library_env.SConsignFile (root_build_dir+'scons-signatures')
929
930 #-----------------------------------------------------------------------------
931 # Settings to be exported to other SConscript files
932 #-----------------------------------------------------------------------------
933
934 if enable_clean==0: # only read SConscripts when not cleaning, this to cut overhead
935         Export ('cflags')
936         Export ('defines')
937         Export ('window_system')
938         Export ('extra_includes')
939         Export ('user_options_dict')
940         Export ('library_env')
941         
942         BuildDir (root_build_dir+'/extern', 'extern', duplicate=0)
943         SConscript (root_build_dir+'extern/SConscript')
944         BuildDir (root_build_dir+'/intern', 'intern', duplicate=0)
945         SConscript (root_build_dir+'intern/SConscript')
946         BuildDir (root_build_dir+'/source', 'source', duplicate=0)
947         SConscript (root_build_dir+'source/SConscript')
948         
949         libpath = (['#'+root_build_dir+'/lib'])
950         
951         link_env = library_env.Copy ()
952         link_env.Append (LIBPATH=libpath)
953
954
955 def common_libs(env):
956         """
957         Append to env all libraries that are common to Blender and Blenderplayer
958         """
959         env.Append (LIBS=[
960                 'blender_blenloader',
961                 'blender_readblenfile',
962                 'blender_img',
963                 'blender_blenkernel',
964                 'blender_blenpluginapi',
965                 'blender_imbuf',
966                 'blender_avi',
967                 'blender_blenlib',
968                 'blender_makesdna',
969                 'blender_kernel',
970                 'blender_GHOST',
971                 'blender_STR',
972                 'blender_guardedalloc',
973                 'blender_CTR',
974                 'blender_MEM',
975                 'blender_MT',
976                 'blender_BMF',
977                 'soundsystem'])
978         if user_options_dict['USE_QUICKTIME'] == 1:
979                 env.Append (LIBS=['blender_quicktime'])
980
981
982 def international_libs(env):
983         """
984         Append international font support libraries
985         """
986         if user_options_dict['USE_INTERNATIONAL'] == 1:
987                 env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
988                 env.Append (LIBPATH=user_options_dict['FREETYPE_LIBPATH'])
989                 env.Append (LIBS=['blender_FTF'])
990                 env.Append (LIBS=user_options_dict['FTGL_LIBRARY'])
991                 env.Append (LIBPATH=user_options_dict['FTGL_LIBPATH'])
992                 env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
993
994 def blender_libs(env):
995         """
996         Blender only libs (not in player)
997         """
998         env.Append( LIBS=['blender_creator',
999                 'blender_blendersrc',
1000                 'blender_render',
1001                 'blender_yafray',
1002                 'blender_renderconverter',
1003                 'blender_radiosity',
1004                 'blender_LOD',
1005                 'blender_BSP',
1006                 'blender_blenkernel',
1007                 'blender_IK',
1008                 'blender_ONL'])
1009
1010 def ketsji_libs(env):
1011         """
1012         Game Engine libs
1013         """
1014         if user_options_dict['BUILD_GAMEENGINE'] == 1:
1015                 env.Append (LIBS=['KX_blenderhook',
1016                                 'KX_converter',
1017                                 'PHY_Dummy',
1018                                 'PHY_Physics',
1019                                 'KX_ketsji',
1020                                 'SCA_GameLogic',
1021                                 'RAS_rasterizer',
1022                                 'RAS_OpenGLRasterizer',
1023                                 'blender_expressions',
1024                                 'SG_SceneGraph',
1025                                 'blender_MT',
1026                                 'KX_blenderhook',
1027                                 'KX_network',
1028                                 'blender_kernel',
1029                                 'NG_network',
1030                                 'NG_loopbacknetwork'])
1031                 if user_options_dict['USE_PHYSICS'] == 'solid':
1032                         env.Append (LIBS=['PHY_Sumo', 'PHY_Physics', 'blender_MT', 'extern_solid', 'extern_qhull'])
1033                 else:
1034                         env.Append (LIBS=['PHY_Ode',
1035                                         'PHY_Physics'])
1036                         env.Append (LIBS=user_options_dict['ODE_LIBRARY'])
1037                         env.Append (LIBPATH=user_options_dict['ODE_LIBPATH'])
1038
1039 def player_libs(env):
1040         """
1041         Player libraries
1042         """
1043         env.Append (LIBS=['GPG_ghost',
1044                         'GPC_common'])
1045
1046 def player_libs2(env):
1047         """
1048         Link order shenannigans: these libs are added after common_libs
1049         """
1050         env.Append (LIBS=['blender_blenkernel_blc',
1051                         'soundsystem'])
1052
1053 def winblenderres(env):
1054         """
1055         build the windows icon resource file
1056         """
1057         if sys.platform == 'win32':
1058                 env.RES(['source/icons/winblender.rc'])
1059
1060 def system_libs(env):
1061         """
1062         System libraries: Python, SDL, PNG, JPEG, Gettext, OpenAL, Carbon
1063         """
1064         env.Append (LIBS=['blender_python'])
1065         env.Append (LIBS=user_options_dict['PYTHON_LIBRARY'])
1066         env.Append (LIBPATH=user_options_dict['PYTHON_LIBPATH'])
1067         env.Append (LINKFLAGS=user_options_dict['PYTHON_LINKFLAGS'])
1068         env.Append (LIBS=user_options_dict['SDL_LIBRARY'])
1069         env.Append (LIBPATH=user_options_dict['SDL_LIBPATH'])
1070         env.Append (LIBS=user_options_dict['PNG_LIBRARY'])
1071         env.Append (LIBPATH=user_options_dict['PNG_LIBPATH'])
1072         env.Append (LIBS=user_options_dict['JPEG_LIBRARY'])
1073         env.Append (LIBPATH=user_options_dict['JPEG_LIBPATH'])
1074         env.Append (LIBS=user_options_dict['GETTEXT_LIBRARY'])
1075         env.Append (LIBPATH=user_options_dict['GETTEXT_LIBPATH'])
1076         env.Append (LIBS=user_options_dict['Z_LIBRARY'])
1077         env.Append (LIBPATH=user_options_dict['Z_LIBPATH'])
1078         if user_options_dict['USE_OPENAL'] == 1:
1079                 env.Append (LIBS=user_options_dict['OPENAL_LIBRARY'])
1080                 env.Append (LIBPATH=user_options_dict['OPENAL_LIBPATH'])
1081         env.Append (LIBS=user_options_dict['PLATFORM_LIBS'])
1082         env.Append (LIBPATH=user_options_dict['PLATFORM_LIBPATH'])
1083         if sys.platform == 'darwin':
1084                 env.Append (LINKFLAGS='-framework')
1085                 env.Append (LINKFLAGS='Carbon')
1086                 env.Append (LINKFLAGS='-framework')
1087                 env.Append (LINKFLAGS='AGL')
1088                 env.Append (LINKFLAGS='-framework')
1089                 env.Append (LINKFLAGS='AudioUnit')
1090                 env.Append (LINKFLAGS='-framework')
1091                 env.Append (LINKFLAGS='AudioToolbox')
1092                 env.Append (LINKFLAGS='-framework')
1093                 env.Append (LINKFLAGS='CoreAudio')
1094                 if user_options_dict['USE_QUICKTIME'] == 1:
1095                         env.Append (LINKFLAGS='-framework')
1096                         env.Append (LINKFLAGS='QuickTime')
1097         else:
1098                 env.Append (LINKFLAGS=user_options_dict['PLATFORM_LINKFLAGS'])
1099         env.BuildDir (root_build_dir, '.', duplicate=0)
1100
1101 def buildinfo(env, build_type):
1102         """
1103         Generate a buildinfo object
1104         """
1105         build_date = time.strftime ("%Y-%m-%d")
1106         build_time = time.strftime ("%H:%M:%S")
1107         obj = []
1108         if user_options_dict['USE_BUILDINFO'] == 1:
1109                 if sys.platform=='win32':
1110                         build_info_file = open("source/creator/winbuildinfo.h", 'w')
1111                         build_info_file.write("char *build_date=\"%s\";\n"%build_date)
1112                         build_info_file.write("char *build_time=\"%s\";\n"%build_time)
1113                         build_info_file.write("char *build_platform=\"win32\";\n")
1114                         build_info_file.write("char *build_type=\"%s\";\n"%build_type)
1115                         build_info_file.close()
1116                         env.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
1117                 else:
1118                         env.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
1119                                                         'BUILD_DATE=\'"%s"\''%(build_date),
1120                                                         'BUILD_TYPE=\'"dynamic"\'',
1121                                                         'NAN_BUILDINFO',
1122                                                         'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
1123                 obj = [env.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type,
1124                                                 [root_build_dir+'source/creator/buildinfo.c'])]
1125         return obj
1126         
1127 def cleanCVS():
1128         """
1129         walks the dist dir and removes all CVS dirs
1130         """
1131         
1132         try:
1133                 import shutil
1134         except:
1135                 print "no shutil available"
1136                 print "make sure you use python 2.3"
1137                 print
1138                 return 0
1139         
1140         startdir = os.getcwd()
1141         
1142         for root, dirs, files in os.walk("dist", topdown=False):
1143                 for name in dirs:
1144                         if name in ['CVS']:
1145                                 if os.path.isdir(root + "/" + name):
1146                                         shutil.rmtree(root + "/" + name)
1147         
1148         os.chdir(startdir)
1149         
1150         return 1
1151
1152 def preparedist():
1153         """
1154         Prepare a directory for creating either archives or the installer
1155         """
1156         
1157         try:
1158                 import shutil
1159         except:
1160                 print "no shutil available"
1161                 print "make sure you use python 2.3"
1162                 print
1163                 return 0
1164         
1165         startdir = os.getcwd()
1166         
1167         if os.path.isdir("dist") == 0:
1168                 os.makedirs("dist")
1169         else:
1170                 shutil.rmtree("dist") # make sure we don't get old cruft
1171                 os.makedirs("dist")
1172         
1173         # first copy binaries
1174         
1175         if sys.platform == 'win32':
1176                 shutil.copy("blender.exe", "dist/blender.exe")
1177                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1178                         shutil.copy("blenderplayer.exe", "dist/blenderplayer.exe")
1179                 shutil.copy("../lib/windows/python/lib/python23.dll", "dist/python23.dll")
1180                 shutil.copy("../lib/windows/sdl/lib/SDL.dll", "dist/SDL.dll")
1181                 shutil.copy("../lib/windows/gettext/lib/gnu_gettext.dll", "dist/gnu_gettext.dll")
1182         elif sys.platform in ['linux2', 'linux-i386']:
1183                 shutil.copy("blender", "dist/blender")
1184                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1185                         shutil.copy("blenderplayer", "dist/blenderplayer")
1186         else:
1187                 print "update preparedist() for your platform!"
1188                 return 0
1189         
1190         # now copy .blender and necessary extras for it
1191         if os.path.isdir("dist/.blender"):
1192                 shutil.rmtree("dist/.blender")
1193         os.chdir("bin")
1194         shutil.copytree(".blender/", "../dist/.blender")
1195         os.chdir(startdir)
1196         if os.path.isdir("dist/.blender/scripts"):
1197                 shutil.rmtree("dist/.blender/scripts")
1198         if os.path.isdir("dist/.blender/bpydata"):
1199                 shutil.rmtree("dist/.blender/bpydata")
1200                 
1201         os.makedirs("dist/.blender/bpydata")
1202         shutil.copy("release/bpydata/readme.txt", "dist/.blender/bpydata/readme.txt")
1203         
1204         os.chdir("release")
1205         shutil.copytree("scripts/", "../dist/.blender/scripts")
1206         
1207         # finally copy auxiliaries (readme, license, etc.)
1208         if sys.platform == 'win32':
1209                 shutil.copy("windows/extra/Help.url", "../dist/Help.url")
1210         shutil.copy("text/copyright.txt", "../dist/copyright.txt")
1211         shutil.copy("text/blender.html", "../dist/blender.html")
1212         shutil.copy("text/GPL-license.txt", "../dist/GPL-license.txt")
1213         shutil.copy("text/Python-license.txt", "../dist/Python-lisence.txt")
1214         
1215         reltext = "release_" + string.join(version.split("."), '') + ".txt"
1216         shutil.copy("text/" + reltext, "../dist/" + reltext)
1217         
1218         os.chdir(startdir)
1219         
1220         if cleanCVS()==0:
1221                 return 0
1222
1223         return 1
1224
1225 def finalisedist(zipname):
1226         """
1227         Fetch the package created and remove temp dir
1228         """
1229         
1230         try:
1231                 import shutil
1232         except:
1233                 print "no shutil available"
1234                 print "make sure you use python 2.3"
1235                 print
1236                 return 0
1237         
1238         shutil.copy("dist/" + zipname, zipname)
1239         shutil.rmtree("dist")
1240         
1241         return 1
1242
1243 def add2arc(arc, file):
1244         if sys.platform == 'win32':
1245                 arc.write(file)
1246         else:
1247                 arc.add(file)
1248
1249                 
1250 def appit(target, source, env):
1251         if sys.platform == 'darwin':
1252                 import shutil
1253                 import commands
1254                 import os.path
1255                                                 
1256                 target = 'blender' 
1257                 sourceinfo = "source/darwin/%s.app/Contents/Info.plist"%target
1258                 targetinfo = "%s.app/Contents/Info.plist"%target
1259
1260                 cmd = '%s.app'%target
1261                 if os.path.isdir(cmd):
1262                         shutil.rmtree('%s.app'%target)
1263                 shutil.copytree("source/darwin/%s.app"%target, '%s.app'%target)
1264                 cmd = "cat %s | sed s/VERSION/`cat release/VERSION`/ | sed s/DATE/`date +'%%Y-%%b-%%d'`/ > %s"%(sourceinfo,targetinfo)
1265                 commands.getoutput(cmd)
1266                 cmd = 'cp %s %s.app/Contents/MacOS/%s'%(target, target, target)
1267                 commands.getoutput(cmd)
1268                 cmd = 'strip -u -r %s.app/Contents/MacOS/%s'%(target, target)
1269                 commands.getoutput(cmd)
1270                 cmd = '%s.app/Contents/Resources/'%target
1271                 shutil.copy('bin/.blender/.bfont.ttf', cmd)
1272                 shutil.copy('bin/.blender/.Blanguages', cmd)
1273                 cmd = 'cp -R bin/.blender/locale %s.app/Contents/Resources/'%target
1274                 commands.getoutput(cmd)
1275                 cmd = 'cp -R release/bpydata %s.app/Contents/Resources/'%target + \
1276                 commands.getoutput(cmd)
1277                 cmd = 'cp -R release/scripts %s.app/Contents/Resources/'%target + \
1278                 commands.getoutput(cmd)
1279                 cmd = 'cp -R release/plugins %s.app/Contents/Resources/'%target 
1280                 commands.getoutput(cmd)
1281                 cmd = 'chmod +x  %s.app/Contents/MacOS/%s'%(target, target)
1282                 commands.getoutput(cmd)
1283                 cmd = 'find %s.app -name CVS -prune -exec rm -rf {} \;'%target
1284                 commands.getoutput(cmd)
1285                 cmd = 'find %s.app -name .DS_Store -exec rm -rf {} \;'%target
1286                 commands.getoutput(cmd)
1287                 
1288                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1289                         target = 'blenderplayer' 
1290                         sourceinfo = "source/darwin/%s.app/Contents/Info.plist"%target
1291                         targetinfo = "%s.app/Contents/Info.plist"%target
1292
1293                         cmd = '%s.app'%target
1294                         if os.path.isdir(cmd):
1295                                 shutil.rmtree('%s.app'%target)
1296                         shutil.copytree("source/darwin/%s.app"%target, '%s.app'%target)
1297                         cmd = "cat %s | sed s/VERSION/`cat release/VERSION`/ | sed s/DATE/`date +'%%Y-%%b-%%d'`/ > %s"%(sourceinfo,targetinfo)
1298                         commands.getoutput(cmd)
1299                         cmd = 'cp %s %s.app/Contents/MacOS/%s'%(target, target, target)
1300                         commands.getoutput(cmd)
1301                         cmd = 'strip -u -r %s.app/Contents/MacOS/%s'%(target, target)
1302                         commands.getoutput(cmd)
1303                         cmd = '%s.app/Contents/Resources/'%target
1304                         shutil.copy('bin/.blender/.bfont.ttf', cmd)
1305                         shutil.copy('bin/.blender/.Blanguages', cmd)
1306                         cmd = 'cp -R bin/.blender/locale %s.app/Contents/Resources/'%target
1307                         commands.getoutput(cmd)
1308                         cmd = 'cp -R release/bpydata %s.app/Contents/Resources/'%target + \
1309                         commands.getoutput(cmd)
1310                         cmd = 'cp -R release/scripts %s.app/Contents/Resources/'%target + \
1311                         commands.getoutput(cmd)
1312                         cmd = 'cp -R release/plugins %s.app/Contents/Resources/'%target 
1313                         commands.getoutput(cmd)
1314                         cmd = 'chmod +x  %s.app/Contents/MacOS/%s'%(target, target)
1315                         commands.getoutput(cmd)
1316                         cmd = 'find %s.app -name CVS -prune -exec rm -rf {} \;'%target
1317                         commands.getoutput(cmd)
1318                         cmd = 'find %s.app -name .DS_Store -exec rm -rf {} \;'%target
1319                         commands.getoutput(cmd)
1320                 
1321         else:
1322                 print "This target is for the Os X platform only"
1323
1324 def zipit(env, target, source):
1325         try:
1326                 if sys.platform == 'win32':
1327                         import zipfile
1328                 else:
1329                         import tarfile
1330         except:
1331                 if sys.platform == 'win32':
1332                         print "no zipfile module found"
1333                 else:
1334                         print "no tarfile module found"
1335                         print "make sure you use python 2.3"
1336                 print
1337                 return
1338         
1339         import glob
1340         import time
1341         
1342         startdir = os.getcwd()
1343         pf=""
1344         zipext = ""
1345         zipname = ""
1346         
1347         today = time.strftime("%Y%m%d", time.gmtime()) # get time in the form 20040714
1348         
1349         if preparedist()==0:
1350                 print "check output for error"
1351                 return
1352         
1353         os.chdir(startdir + "/dist")
1354         
1355         if sys.platform == 'win32':
1356                 zipext += ".zip"
1357                 pf = "windows"
1358         elif sys.platform == 'linux2' or sys.platform == 'linux-i386':
1359                 zipext += ".tar.gz"
1360                 pf = "linux"
1361         
1362         zipname = "bf_blender_" + pf+ "_" + today + zipext
1363         
1364         print
1365         if sys.platform == 'win32':
1366                 print "Create the zip!"
1367         elif sys.platform == 'linux2' or sys.platform == 'linux-i386':
1368                 print "Create the tarball!"
1369         print
1370         
1371         if sys.platform == 'win32':
1372                 thezip = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED)
1373         else:
1374                 thezip = tarfile.open(zipname, 'w:gz')
1375         
1376         for root, dirs, files in os.walk(".", topdown=False):
1377                 for name in files:
1378                         if name in [zipname]:
1379                                 print "skipping self"
1380                         else:
1381                                 file = root + "/" + name
1382                                 print "adding: " + file
1383                                 add2arc(thezip, file)
1384         
1385         thezip.close()
1386         
1387         os.chdir(startdir)
1388         
1389         if finalisedist(zipname)==0:
1390                 print "encountered an error in finalisedist"
1391                 print
1392                 return
1393         
1394         print
1395         print "Blender has been successfully packaged"
1396         print "You can find the file %s in the root source directory"%zipname
1397         print
1398         
1399
1400 def printadd(env, target, source):
1401         """
1402         Print warning message if platform hasn't been added to zipit() yet
1403         """
1404         
1405         print
1406         print "############"
1407         print 
1408         print "Make sure zipit() works for your platform:"
1409         print "  - binaries to copy (naming?)"
1410         print "  - possible libraries?"
1411         print "  - archive format?"
1412         print
1413         print "After you've corrected zipit() for your"
1414         print "platform, be sure to add a proper elif"
1415         print "at the end of BlenderRelease"
1416         print
1417         print "Blender is now ready and can be found in"
1418         print "root of the source distribution, but it"
1419         print "hasn't been packaged neatly. Make sure you"
1420         print "get the right files"
1421         print
1422         print "/jesterKing"
1423         print
1424         
1425
1426 def noaction(env, target, source):
1427         print "Empty action"
1428
1429 def DoClean(dir2clean):
1430         """
1431         Do a removal of the root_build_dir the fast way
1432         """
1433         
1434         import shutil
1435         print
1436         print "start the clean"
1437         dirs = os.listdir(dir2clean)
1438         for dir in dirs:
1439                 if os.path.isdir(dir2clean + "/" + dir) == 1:
1440                         print "clean dir %s"%(dir2clean+"/" + dir)
1441                         shutil.rmtree(dir2clean+"/" + dir)
1442         print "done"
1443
1444 def BlenderDefault(target):
1445         """
1446         The default Blender build.
1447         """
1448         def_env = Environment()
1449         default = def_env.Command('nozip', 'blender$PROGSUFFIX', noaction)
1450         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1451                 def_env.Depends(default, 'blenderplayer$PROGSUFFIX')
1452         def_env.Alias(".", default)
1453
1454 def donsis(env, target, source):
1455         """
1456         Create a Windows installer with NSIS
1457         """
1458         print
1459         print "Creating the Windows installer"
1460         print
1461         
1462         startdir = os.getcwd()
1463         
1464         if preparedist()==0:
1465                 print "check output for error"
1466                 return
1467         
1468         os.chdir("release/windows/installer")
1469         
1470         nsis = open("00.sconsblender.nsi", 'r')
1471         nsis_cnt = str(nsis.read())
1472         nsis.close()
1473         
1474         # do root
1475         rootlist = []
1476         rootdir = os.listdir(startdir + "\\dist")
1477         for rootitem in rootdir:
1478                 if os.path.isdir(startdir + "\\dist\\" + rootitem) == 0:
1479                         rootlist.append("File " + startdir + "\\dist\\" + rootitem)
1480         rootstring = string.join(rootlist, "\n  ")
1481         rootstring += "\n\n"
1482         nsis_cnt = string.replace(nsis_cnt, "[ROOTDIRCONTS]", rootstring)
1483         
1484         # do scripts
1485         scriptlist = []
1486         scriptdir = os.listdir(startdir + "\\dist\\.blender\\scripts")
1487         for scriptitem in scriptdir:
1488                 if os.path.isdir(startdir + "\\dist\\.blender\\scripts\\" + scriptitem) == 0:
1489                         scriptlist.append("File " + startdir + "\\dist\\.blender\\scripts\\" + scriptitem)
1490         scriptstring = string.join(scriptlist, "\n  ")
1491         scriptstring += "\n\n"
1492         nsis_cnt = string.replace(nsis_cnt, "[SCRIPTCONTS]", scriptstring)
1493         
1494         # do dotblender
1495         dotblendlist = []
1496         dotblenddir = os.listdir(startdir+"\\dist\\.blender")
1497         for dotblenditem in dotblenddir:
1498                 if os.path.isdir(startdir + "\\dist\\.blender\\" + dotblenditem) == 0:
1499                         dotblendlist.append("File " + startdir + "\\dist\\.blender\\" + dotblenditem)
1500         dotblendstring = string.join(dotblendlist, "\n  ")
1501         dotblendstring += "\n\n"
1502         nsis_cnt = string.replace(nsis_cnt, "[DOTBLENDERCONTS]", dotblendstring)
1503         
1504         # do language files
1505         langlist = []
1506         langdir = os.listdir(startdir + "\\dist\\.blender\\locale")
1507         for langitem in langdir:
1508                 if os.path.isdir(startdir + "\\dist\\.blender\\locale\\" + langitem) == 1:
1509                         langlist.append("File " + startdir + "\\dist\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo")
1510         langstring = string.join(langlist, "\n  ")
1511         langstring += "\n\n"
1512         nsis_cnt = string.replace(nsis_cnt, "[LANGUAGECONTS]", langstring)
1513         
1514         # var replacements
1515         nsis_cnt = string.replace(nsis_cnt, "DISTDIR", startdir + "\\dist")
1516         nsis_cnt = string.replace(nsis_cnt, "SHORTVER", shortversion)
1517         nsis_cnt = string.replace(nsis_cnt, "VERSION", version)
1518         
1519         new_nsis = open("00.blender_tmp.nsi", 'w')
1520         new_nsis.write(nsis_cnt)
1521         new_nsis.close()
1522         
1523         sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w')
1524         
1525         os.chdir(startdir)
1526         
1527         
1528 def BlenderNSIS(target):
1529         """
1530         Entry for creating Windows installer
1531         """
1532         if sys.platform == 'win32':
1533                 inst_env = Environment()
1534                 nsis_inst = inst_env.Command('nsisinstaller', 'blender$PROGSUFFIX', donsis)
1535                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1536                         inst_env.Depends(nsis_inst, 'blenderplayer$PROGSUFFIX')
1537                 inst_env.Alias("wininst", nsis_inst)
1538         else:
1539                 print "This target is for the win32 platform only "
1540
1541 def BlenderRelease(target):
1542         """
1543         Make a Release package (tarball, zip, bundle).
1544         
1545         target = Name of package to make (string)
1546         eg: BlenderRelease('blender')
1547         """
1548         
1549         if sys.platform == 'darwin':
1550                 app_env = Environment()
1551                 Mappit = app_env.Command('appit', appname, appit)
1552                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1553                         app_env.Depends(Mappit, playername)
1554                 app_env.Alias("release", Mappit)
1555         elif sys.platform in ['win32', 'linux2', 'linux-i386']:
1556                 release_env = Environment()
1557                 releaseit = release_env.Command('blenderrelease', appname, zipit)
1558                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1559                         release_env.Depends(releaseit, playername)
1560                 release_env.Alias("release", releaseit)
1561         else:
1562                 release_env = Environment()
1563                 releaseit = release_env.Command('blender.tar.gz', appname, printadd)
1564                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1565                         release_env.Depends(releaseit, playername)
1566                 release_env.Alias("release", releaseit)
1567
1568 if enable_clean == 0:
1569
1570         
1571         if user_options_dict['BUILD_BLENDER_DYNAMIC'] == 1:
1572                 dy_blender = link_env.Copy ()
1573                 if sys.platform=='win32':
1574                         winblenderres(dy_blender)
1575                 blender_libs(dy_blender)
1576                 common_libs(dy_blender)
1577                 international_libs(dy_blender)
1578                 ketsji_libs(dy_blender)
1579                 system_libs(dy_blender)
1580                 dy_blender.Append (LIBS=user_options_dict['OPENGL_LIBRARY'])
1581                 dy_blender.Append (LIBPATH=user_options_dict['OPENGL_LIBPATH'])
1582                 dy_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1583                 d_obj = buildinfo(dy_blender, "dynamic")
1584                 if sys.platform == 'win32':
1585                         dy_blender.Program (target='blender',
1586                                                 source=d_obj + ['source/icons/winblender.res'])
1587                 else:
1588                         if sys.platform == 'cygwin':
1589                                 dy_blender.Replace (CC='g++')
1590                         dy_blender.Program (target='blender', source=d_obj)
1591         
1592         if user_options_dict['BUILD_BLENDER_STATIC'] == 1:
1593                 st_blender = link_env.Copy ()
1594                 if sys.platform=='win32':
1595                         winblenderres(st_blender)
1596                 blender_libs(st_blender)
1597                 common_libs(st_blender)
1598                 international_libs(st_blender)
1599                 ketsji_libs(st_blender)
1600                 system_libs(st_blender)
1601                 # The next line is to make sure that the LINKFLAGS are appended at the end
1602                 # of the link command. This 'trick' is needed because the GL and GLU static
1603                 # libraries need to be at the end of the command.
1604                 st_blender.Replace(LINKCOM="$LINK -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS")
1605                 s_obj = buildinfo(st_blender, "static")
1606                 st_blender.Append (LINKFLAGS=user_options_dict['OPENGL_STATIC'])
1607                 st_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1608                 st_blender.Prepend (LIBPATH=['/usr/lib/opengl/xfree/lib'])
1609                 st_blender.Program (target='blenderstatic', source=s_obj)
1610         
1611         if sys.platform=='win32':
1612                 if user_options_dict['BUILD_BINARY']=='debug':
1613                         browser = Environment()
1614                         browser_tmp = root_build_dir+'bscmake.tmp'
1615                         browser.Command ('blender.bsc', 'blender$PROGSUFFIX',
1616                                 ['dir /b/s '+root_build_dir+'*.sbr >'+browser_tmp,
1617                                  'bscmake /nologo /n /oblender.bsc @'+browser_tmp,
1618                                  'del '+browser_tmp])
1619         
1620         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1 and user_options_dict['BUILD_GAMEENGINE'] == 1:
1621                 player_blender = link_env.Copy()
1622                 player_libs(player_blender)
1623                 common_libs(player_blender)
1624                 international_libs(player_blender)
1625                 ketsji_libs(player_blender)
1626                 player_libs2(player_blender)
1627                 system_libs(player_blender)
1628                 player_blender.Append (LIBS=user_options_dict['OPENGL_LIBRARY'])
1629                 player_blender.Append (LIBPATH=user_options_dict['OPENGL_LIBPATH'])
1630                 player_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1631                 d_obj = buildinfo(player_blender, "player")
1632                 if sys.platform == 'win32':
1633                         player_blender.Program (target='blenderplayer',
1634                                                 source=d_obj + ['source/icons/winblender.res'])
1635                 else:
1636                         if sys.platform == 'cygwin':
1637                                 player_blender.Replace (CC='g++')
1638                         player_blender.Program (target='blenderplayer', source=d_obj)
1639                 if sys.platform=='win32':
1640                         if user_options_dict['BUILD_BINARY']=='debug':
1641                                 browser = Environment()
1642                                 browser_tmp = root_build_dir+'bscmake.tmp'
1643                                 browser.Command ('blenderplayer.bsc', 'blenderplayer$PROGSUFFIX',
1644                                 ['dir /b/s '+root_build_dir+'*.sbr >'+browser_tmp,
1645                                 'bscmake /nologo /n /oblenderplayer.bsc @'+browser_tmp,
1646                                 'del '+browser_tmp])
1647
1648         release_target = env.Alias("release", BlenderRelease(appname))
1649         default_target = env.Alias("default", BlenderDefault(appname))
1650         wininst_target = env.Alias("winist", BlenderNSIS(appname))
1651                 
1652 else: # only clean target to prevent any building
1653         clean_target = env.Alias("clean", DoClean(root_build_dir))
1654         Default("clean")
1655
1656 if enable_clean == 0: # only set up dependencies when not cleaning
1657         if sys.platform == 'darwin':
1658                 Default("release")
1659         else:
1660                 Default("default")
1661
1662         if sys.platform == 'win32':
1663                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1664                         env.Depends(wininst_target, playername)
1665                 env.Depends(wininst_target, appname)
1666         
1667         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1668                 env.Depends(release_target, playername)
1669         env.Depends(release_target, appname)
1670         
1671         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1672                 env.Depends(default_target, playername)
1673         env.Depends(default_target, appname)
1674