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