merge with 2.5 at r18679
[blender.git] / SConstruct
1 #!/usr/bin/env python
2 # $Id$
3 # ***** BEGIN GPL LICENSE BLOCK *****
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 #
19 # The Original Code is Copyright (C) 2006, Blender Foundation
20 # All rights reserved.
21 #
22 # The Original Code is: all of this file.
23 #
24 # Contributor(s): Nathan Letwory.
25 #
26 # ***** END GPL LICENSE BLOCK *****
27 #
28 # Main entry-point for the SCons building system
29 # Set up some custom actions and target/argument handling
30 # Then read all SConscripts and build
31
32 import sys
33 import os
34 import os.path
35 import string
36 import shutil
37 import glob
38 import re
39 from tempfile import mkdtemp
40
41 import tools.Blender
42 import tools.btools
43 import tools.bcolors
44
45 EnsureSConsVersion(1,0,0)
46
47 BlenderEnvironment = tools.Blender.BlenderEnvironment
48 btools = tools.btools
49 B = tools.Blender
50
51 ### globals ###
52 platform = sys.platform
53 quickie = None
54 quickdebug = None
55 nsis_build = None
56
57 ##### BEGIN SETUP #####
58
59 B.possible_types = ['core', 'player', 'intern', 'extern']
60
61 B.binarykind = ['blender' , 'blenderplayer']
62 ##################################
63 # target and argument validation #
64 ##################################
65 # XX cheating for BF_FANCY, we check for BF_FANCY before args are validated
66 use_color = ARGUMENTS.get('BF_FANCY', '1')
67 if platform=='win32':
68         use_color = None
69
70 if not use_color=='1':
71         B.bc.disable()
72         
73  #on defaut white Os X terminal, some colors are totally unlegible
74 if platform=='darwin':
75         B.bc.OKGREEN = '\033[34m'
76         B.bc.WARNING = '\033[36m'
77
78 # arguments
79 print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
80 B.arguments = btools.validate_arguments(ARGUMENTS, B.bc)
81 btools.print_arguments(B.arguments, B.bc)
82
83 # targets
84 print B.bc.HEADER+'Command-line targets'+B.bc.ENDC
85 B.targets = btools.validate_targets(COMMAND_LINE_TARGETS, B.bc)
86 btools.print_targets(B.targets, B.bc)
87
88 ##########################
89 # setting up environment #
90 ##########################
91
92 # handling cmd line arguments & config file
93
94 # first check cmdline for toolset and we create env to work on
95 quickie = B.arguments.get('BF_QUICK', None)
96 quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
97
98 if quickdebug:
99         B.quickdebug=string.split(quickdebug, ',')
100 else:
101         B.quickdebug=[]
102
103 if quickie:
104         B.quickie=string.split(quickie,',')
105 else:
106         B.quickie=[]
107         
108 toolset = B.arguments.get('BF_TOOLSET', None)
109 if toolset:
110         print "Using " + toolset
111         if toolset=='mstoolkit':
112                 env = BlenderEnvironment(ENV = os.environ)
113                 env.Tool('mstoolkit', ['tools'])
114         else:
115                 env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
116                 # xxx commented out, as was supressing warnings under mingw..
117                 #if env:
118                 #       btools.SetupSpawn(env)
119 else:
120         env = BlenderEnvironment(ENV = os.environ)
121
122 if not env:
123         print "Could not create a build environment"
124         Exit()
125
126
127 cc = B.arguments.get('CC', None)
128 cxx = B.arguments.get('CXX', None)
129 if cc:
130         env['CC'] = cc
131 if cxx:
132         env['CXX'] = cxx
133
134 if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
135         platform = 'win32-vc'
136 elif env['CC'] in ['gcc'] and sys.platform=='win32':
137         platform = 'win32-mingw'
138
139 env.SConscriptChdir(0)
140
141 crossbuild = B.arguments.get('BF_CROSS', None)
142 if crossbuild and platform!='win32':
143         platform = 'linuxcross'
144
145 env['OURPLATFORM'] = platform
146
147 configfile = 'config'+os.sep+platform+'-config.py'
148
149 if os.path.exists(configfile):
150         print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
151 else:
152         print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
153
154 if crossbuild and env['PLATFORM'] != 'win32':
155         print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
156         env.Tool('crossmingw', ['tools'])
157         # todo: determine proper libs/includes etc.
158         # Needed for gui programs, console programs should do without it
159         env.Append(LINKFLAGS=['-mwindows'])
160
161 userconfig = B.arguments.get('BF_CONFIG', 'user-config.py')
162 # first read platform config. B.arguments will override
163 optfiles = [configfile]
164 if os.path.exists(userconfig):
165         print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
166         optfiles += [userconfig]
167 else:
168         print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
169
170 opts = btools.read_opts(optfiles, B.arguments)
171 opts.Update(env)
172
173 if not env['BF_FANCY']:
174         B.bc.disable()
175
176 SetOption('num_jobs', int(env['BF_NUMJOBS']))
177 print "Build with %d parallel jobs" % (GetOption('num_jobs'))
178
179 # disable elbeem (fluidsim) compilation?
180 if env['BF_NO_ELBEEM'] == 1:
181         env['CPPFLAGS'].append('-DDISABLE_ELBEEM')
182         env['CXXFLAGS'].append('-DDISABLE_ELBEEM')
183         env['CCFLAGS'].append('-DDISABLE_ELBEEM')
184
185 if env['WITH_BF_OPENMP'] == 1:
186                 if env['OURPLATFORM']=='win32-vc':
187                                 env['CCFLAGS'].append('/openmp')
188                                 env['CPPFLAGS'].append('/openmp')
189                                 env['CXXFLAGS'].append('/openmp')
190                 else:
191                         if env['CC'][-3:] == 'icc': # to be able to handle CC=/opt/bla/icc case
192                                 env.Append(LINKFLAGS=['-openmp', '-static-intel'])
193                                 env['CCFLAGS'].append('-openmp')
194                                 env['CPPFLAGS'].append('-openmp')
195                                 env['CXXFLAGS'].append('-openmp')
196                         else:
197                                 env.Append(CCFLAGS=['-fopenmp']) 
198                                 env.Append(CPPFLAGS=['-fopenmp'])
199                                 env.Append(CXXFLAGS=['-fopenmp'])
200                                 # env.Append(LINKFLAGS=['-fprofile-generate'])
201
202 #check for additional debug libnames
203
204 if env.has_key('BF_DEBUG_LIBS'):
205         B.quickdebug += env['BF_DEBUG_LIBS']
206
207 printdebug = B.arguments.get('BF_LISTDEBUG', 0)
208
209 # see if this linux distro has libalut
210
211 if env['OURPLATFORM'] == 'linux2' :
212         if env['WITH_BF_OPENAL']:
213                 mylib_test_source_file = """
214                 #include "AL/alut.h"
215                 int main(int argc, char **argv)
216                 {
217                         alutGetMajorVersion();
218                         return 0;
219                 }
220                 """
221
222                 def CheckFreeAlut(context,env):
223                         context.Message( B.bc.OKGREEN + "Linux platform detected:\n  checking for FreeAlut... " + B.bc.ENDC )
224                         env['LIBS'] = 'alut'
225                         result = context.TryLink(mylib_test_source_file, '.c')
226                         context.Result(result)
227                         return result
228
229                 env2 = env.Clone( LIBPATH = env['BF_OPENAL'] ) 
230                 sconf_temp = mkdtemp()
231                 conf = Configure( env2, {'CheckFreeAlut' : CheckFreeAlut}, sconf_temp, '/dev/null' )
232                 if conf.CheckFreeAlut( env2 ):
233                         env['BF_OPENAL_LIB'] += ' alut'
234                 del env2
235                 root = ''
236                 for root, dirs, files in os.walk(sconf_temp, topdown=False):
237                         for name in files:
238                                 os.remove(os.path.join(root, name))
239                         for name in dirs:
240                                 os.rmdir(os.path.join(root, name))
241                 if root: os.rmdir(root)
242
243 if len(B.quickdebug) > 0 and printdebug != 0:
244         print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
245         for l in B.quickdebug:
246                 print "\t" + l
247
248 # remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
249 if env['WITH_BF_STATICCXX']:
250         if 'stdc++' in env['LLIBS']:
251                 env['LLIBS'].remove('stdc++')
252         else:
253                 print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
254
255 # check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
256 if 'blenderplayer' in B.targets:
257         env['WITH_BF_PLAYER'] = True
258
259 if 'blendernogame' in B.targets:
260         env['WITH_BF_GAMEENGINE'] = False
261
262 if 'blenderlite' in B.targets:
263         env['WITH_BF_GAMEENGINE'] = False
264         env['WITH_BF_OPENAL'] = False
265         env['WITH_BF_OPENEXR'] = False
266         env['WITH_BF_ICONV'] = False
267         env['WITH_BF_INTERNATIONAL'] = False
268         env['WITH_BF_OPENJPEG'] = False
269         env['WITH_BF_FFMPEG'] = False
270         env['WITH_BF_QUICKTIME'] = False
271         env['WITH_BF_YAFRAY'] = False
272         env['WITH_BF_REDCODE'] = False
273         env['WITH_BF_FTGL'] = False
274         env['WITH_BF_DDS'] = False
275         env['WITH_BF_ZLIB'] = False
276         env['WITH_BF_SDL'] = False
277         env['WITH_BF_JPEG'] = False
278         env['WITH_BF_PNG'] = False
279         env['WITH_BF_ODE'] = False
280         env['WITH_BF_BULLET'] = False
281         env['WITH_BF_BINRELOC'] = False
282         env['BF_BUILDINFO'] = False
283         env['BF_NO_ELBEEM'] = True
284         env['WITH_BF_PYTHON'] = False
285
286 if env['WITH_BF_SDL'] == False and env['OURPLATFORM'] in ('win32-vc', 'win32-ming'):
287         env['PLATFORM_LINKFLAGS'].remove('/ENTRY:mainCRTStartup')
288         env['PLATFORM_LINKFLAGS'].append('/ENTRY:main')
289
290 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
291 #B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
292 B.root_build_dir = env['BF_BUILDDIR']
293 B.doc_build_dir = env['BF_DOCDIR']
294 if not B.root_build_dir[-1]==os.sep:
295         B.root_build_dir += os.sep
296 if not B.doc_build_dir[-1]==os.sep:
297         B.doc_build_dir += os.sep
298         
299 # We do a shortcut for clean when no quicklist is given: just delete
300 # builddir without reading in SConscripts
301 do_clean = None
302 if 'clean' in B.targets:
303         do_clean = True
304
305 if not quickie and do_clean:
306         if os.path.exists(B.doc_build_dir):
307                 print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
308                 dirs = os.listdir(B.doc_build_dir)
309                 for entry in dirs:
310                         if os.path.isdir(B.doc_build_dir + entry) == 1:
311                                 print "clean dir %s"%(B.doc_build_dir+entry)
312                                 shutil.rmtree(B.doc_build_dir+entry)
313                         else: # remove file
314                                 print "remove file %s"%(B.doc_build_dir+entry)
315                                 os.remove(B.root_build_dir+entry)
316         if os.path.exists(B.root_build_dir):
317                 print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
318                 dirs = os.listdir(B.root_build_dir)
319                 for entry in dirs:
320                         if os.path.isdir(B.root_build_dir + entry) == 1:
321                                 print "clean dir %s"%(B.root_build_dir+entry)
322                                 shutil.rmtree(B.root_build_dir+entry)
323                         else: # remove file
324                                 print "remove file %s"%(B.root_build_dir+entry)
325                                 os.remove(B.root_build_dir+entry)
326                 for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
327                                 'extern/xvidcore/build/generic/platform.inc', 'extern/ffmpeg/include']:
328                         if os.path.exists(confile):
329                                 print "clean file %s"%confile
330                                 if os.path.isdir(confile):
331                                         for root, dirs, files in os.walk(confile):
332                                                 for name in files:
333                                                         os.remove(os.path.join(root, name))
334                                 else:
335                                         os.remove(confile)
336                 print B.bc.OKGREEN+'...done'+B.bc.ENDC
337         else:
338                 print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
339         Exit()
340
341 if not os.path.isdir ( B.root_build_dir):
342         os.makedirs ( B.root_build_dir )
343         os.makedirs ( B.root_build_dir + 'source' )
344         os.makedirs ( B.root_build_dir + 'intern' )
345         os.makedirs ( B.root_build_dir + 'extern' )
346         os.makedirs ( B.root_build_dir + 'lib' )
347         os.makedirs ( B.root_build_dir + 'bin' )
348 if not os.path.isdir(B.doc_build_dir):
349         os.makedirs ( B.doc_build_dir )
350
351 Help(opts.GenerateHelpText(env))
352
353 # default is new quieter output, but if you need to see the 
354 # commands, do 'scons BF_QUIET=0'
355 bf_quietoutput = B.arguments.get('BF_QUIET', '1')
356 if env['BF_QUIET']:
357         B.set_quiet_output(env)
358 else:
359         if toolset=='msvc':
360                 B.msvc_hack(env)
361
362 print B.bc.HEADER+'Building in '+B.bc.ENDC+B.root_build_dir
363 env.SConsignFile(B.root_build_dir+'scons-signatures')
364 B.init_lib_dict()
365
366 ##### END SETUP ##########
367
368 Export('env')
369
370 BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
371 SConscript(B.root_build_dir+'/intern/SConscript')
372 BuildDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
373 SConscript(B.root_build_dir+'/extern/SConscript')
374 BuildDir(B.root_build_dir+'/source', 'source', duplicate=0)
375 SConscript(B.root_build_dir+'/source/SConscript')
376
377 # now that we have read all SConscripts, we know what
378 # libraries will be built. Create list of
379 # libraries to give as objects to linking phase
380 mainlist = []
381 for tp in B.possible_types:
382         if not tp == 'player' and not tp == 'player2':
383                 mainlist += B.create_blender_liblist(env, tp)
384
385 if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
386         B.propose_priorities()
387
388 dobj = B.buildinfo(env, "dynamic") + B.resources
389 thestatlibs, thelibincs = B.setup_staticlibs(env)
390 thesyslibs = B.setup_syslibs(env)
391
392 if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
393         env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
394 if env['WITH_BF_PLAYER']:
395         playerlist = B.create_blender_liblist(env, 'player')
396         env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
397
398 ##### Now define some targets
399
400
401 #------------ INSTALL
402
403 #-- binaries
404 blenderinstall = []
405 if  env['OURPLATFORM']=='darwin':
406         for prg in B.program_list:
407                 bundle = '%s.app' % prg[0]
408                 bundledir = os.path.dirname(bundle)
409                 for dp, dn, df in os.walk(bundle):
410                         if 'CVS' in dn:
411                                 dn.remove('CVS')
412                         if '.svn' in dn:
413                                 dn.remove('.svn')
414                         dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
415                         source=[dp+os.sep+f for f in df]
416                         blenderinstall.append(env.Install(dir=dir,source=source))
417 else:
418         blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
419
420 #-- .blender
421 #- dont do .blender and scripts for darwin, it is already in the bundle
422 dotblendlist = []
423 dottargetlist = []
424 scriptinstall = []
425
426 if  env['OURPLATFORM']!='darwin':
427                 for dp, dn, df in os.walk('bin/.blender'):
428                         if 'CVS' in dn:
429                                 dn.remove('CVS')
430                         if '.svn' in dn:
431                                 dn.remove('.svn')
432                         
433                         for f in df:
434                                 if not env['WITH_BF_INTERNATIONAL']:
435                                         if 'locale' in dp:
436                                                 continue
437                                         if f == '.Blanguages':
438                                                 continue
439                                 if not env['WITH_BF_FREETYPE']:
440                                         if f.endswith('.ttf'):
441                                                 continue
442                                 
443                                 dotblendlist.append(os.path.join(dp, f))
444                                 dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
445
446                 dotblenderinstall = []
447                 for targetdir,srcfile in zip(dottargetlist, dotblendlist):
448                         td, tf = os.path.split(targetdir)
449                         dotblenderinstall.append(env.Install(dir=td, source=srcfile))
450                 
451                 if env['WITH_BF_PYTHON']:
452                         #-- .blender/scripts    
453                         scriptpath='release/scripts'
454                         for dp, dn, df in os.walk(scriptpath):
455                                 if 'CVS' in dn:
456                                         dn.remove('CVS')
457                                 if '.svn' in dn:
458                                         dn.remove('.svn')
459                                 dir=env['BF_INSTALLDIR']+'/.blender/scripts'+dp[len(scriptpath):]
460                                 source=[dp+os.sep+f for f in df]
461                                 scriptinstall.append(env.Install(dir=dir,source=source))
462
463 #-- icons
464 if env['OURPLATFORM']=='linux2':
465         iconlist = []
466         icontargetlist = []
467
468         for tp, tn, tf in os.walk('release/freedesktop/icons'):
469                 if 'CVS' in tn:
470                         tn.remove('CVS')
471                 if '.svn' in tn:
472                         tn.remove('.svn')
473                 for f in tf:
474                         print ">>>", env['BF_INSTALLDIR'], tp, f
475                         iconlist.append(tp+os.sep+f)
476                         icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f)
477
478         iconinstall = []
479         for targetdir,srcfile in zip(icontargetlist, iconlist):
480                 td, tf = os.path.split(targetdir)
481                 iconinstall.append(env.Install(dir=td, source=srcfile))
482
483 # dlls for linuxcross
484 # TODO - add more libs, for now this lets blenderlite run
485 if env['OURPLATFORM']=='linuxcross':
486         dir=env['BF_INSTALLDIR']
487         source = ['../lib/windows/pthreads/lib/pthreadGC2.dll']
488         scriptinstall.append(env.Install(dir=dir, source=source))
489
490 #-- plugins
491 pluglist = []
492 plugtargetlist = []
493 for tp, tn, tf in os.walk('release/plugins'):
494         if 'CVS' in tn:
495                 tn.remove('CVS')
496         if '.svn' in tn:
497                 tn.remove('.svn')
498         for f in tf:
499                 print ">>>", env['BF_INSTALLDIR'], tp, f
500                 pluglist.append(tp+os.sep+f)
501                 plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
502
503 # header files for plugins
504 pluglist.append('source/blender/blenpluginapi/documentation.h')
505 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'documentation.h')
506 pluglist.append('source/blender/blenpluginapi/externdef.h')
507 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'externdef.h')
508 pluglist.append('source/blender/blenpluginapi/floatpatch.h')
509 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'floatpatch.h')
510 pluglist.append('source/blender/blenpluginapi/iff.h')
511 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'iff.h')
512 pluglist.append('source/blender/blenpluginapi/plugin.h')
513 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'plugin.h')
514 pluglist.append('source/blender/blenpluginapi/util.h')
515 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'util.h')
516 pluglist.append('source/blender/blenpluginapi/plugin.DEF')
517 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep + 'plugin.def')
518
519 plugininstall = []
520 for targetdir,srcfile in zip(plugtargetlist, pluglist):
521         td, tf = os.path.split(targetdir)
522         plugininstall.append(env.Install(dir=td, source=srcfile))
523
524 textlist = []
525 texttargetlist = []
526 for tp, tn, tf in os.walk('release/text'):
527         if 'CVS' in tn:
528                 tn.remove('CVS')
529         if '.svn' in tn:
530                 tn.remove('.svn')
531         for f in tf:
532                 textlist.append(tp+os.sep+f)
533
534 textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
535
536 if  env['OURPLATFORM']=='darwin':
537                 allinstall = [blenderinstall, plugininstall, textinstall]
538 elif env['OURPLATFORM']=='linux2':
539                 allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
540 else:
541                 allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
542
543 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
544         dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
545                                                 '${BF_PNG_LIBPATH}/libpng.dll',
546                                                 '${BF_ZLIB_LIBPATH}/zlib.dll',
547                                                 '${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
548         dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
549         if env['WITH_BF_SDL']:
550                 dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
551         if env['WITH_BF_PYTHON']:
552                 dllsources.append('#release/windows/extra/python25.zip')
553                 dllsources.append('#release/windows/extra/zlib.pyd')
554                 if env['BF_DEBUG']:
555                         dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}_d.dll')
556                 else:
557                         dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}.dll')
558         if env['WITH_BF_ICONV']:
559                 dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
560         if env['WITH_BF_FFMPEG']:
561                 dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
562                                                 '${LCGDIR}/ffmpeg/lib/avformat-52.dll',
563                                                 '${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
564                                                 '${LCGDIR}/ffmpeg/lib/avutil-49.dll',
565                                                 '${LCGDIR}/ffmpeg/lib/libfaad-0.dll',
566                                                 '${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
567                                                 '${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
568                                                 '${LCGDIR}/ffmpeg/lib/libx264-59.dll',
569                                                 '${LCGDIR}/ffmpeg/lib/xvidcore.dll',
570                                                 '${LCGDIR}/ffmpeg/lib/swscale-0.dll']
571         windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
572         allinstall += windlls
573
574 installtarget = env.Alias('install', allinstall)
575 bininstalltarget = env.Alias('install-bin', blenderinstall)
576
577 nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
578 nsiscmd = env.Command('nsisinstaller', None, nsisaction)
579 nsisalias = env.Alias('nsis', nsiscmd)
580
581 if 'blender' in B.targets:
582         blenderexe= env.Alias('blender', B.program_list)
583         Depends(blenderexe,installtarget)
584
585 if env['WITH_BF_PLAYER']:
586         blenderplayer = env.Alias('blenderplayer', B.program_list)
587         Depends(blenderplayer,installtarget)
588
589 if not env['WITH_BF_GAMEENGINE']:
590         blendernogame = env.Alias('blendernogame', B.program_list)
591         Depends(blendernogame,installtarget)
592
593 if 'blenderlite' in B.targets:
594         blenderlite = env.Alias('blenderlite', B.program_list)
595         Depends(blenderlite,installtarget)
596
597 Depends(nsiscmd, allinstall)
598
599 Default(B.program_list)
600
601 if not env['WITHOUT_BF_INSTALL']:
602                 Default(installtarget)
603
604 #------------ RELEASE
605 # TODO: zipup the installation
606
607 #------------ BLENDERPLAYER
608 # TODO: build stubs and link into blenderplayer
609
610 #------------ EPYDOC
611 if env['WITH_BF_DOCS']:
612         SConscript('source/blender/python/api2_2x/doc/SConscript')
613         SConscript('source/gameengine/PyDoc/SConscript')
614