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