2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19323...
[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 if pltfrm.architecture()[0] == '64bit':
35         bitness = 64
36 else:
37         bitness = 32
38
39 import sys
40 import os
41 import os.path
42 import string
43 import shutil
44 import glob
45 import re
46 from tempfile import mkdtemp
47
48 import tools.Blender
49 import tools.btools
50 import tools.bcolors
51
52 EnsureSConsVersion(1,0,0)
53
54 BlenderEnvironment = tools.Blender.BlenderEnvironment
55 btools = tools.btools
56 B = tools.Blender
57
58 ### globals ###
59 platform = sys.platform
60 quickie = None
61 quickdebug = None
62 nsis_build = 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_YAFRAY'] = False
283         target_env_defs['WITH_BF_REDCODE'] = False
284         target_env_defs['WITH_BF_FTGL'] = False
285         target_env_defs['WITH_BF_DDS'] = False
286         target_env_defs['WITH_BF_ZLIB'] = False
287         target_env_defs['WITH_BF_SDL'] = False
288         target_env_defs['WITH_BF_JPEG'] = False
289         target_env_defs['WITH_BF_PNG'] = False
290         target_env_defs['WITH_BF_ODE'] = False
291         target_env_defs['WITH_BF_BULLET'] = False
292         target_env_defs['WITH_BF_SOLID'] = False
293         target_env_defs['WITH_BF_BINRELOC'] = False
294         target_env_defs['BF_BUILDINFO'] = False
295         target_env_defs['BF_NO_ELBEEM'] = True
296         target_env_defs['WITH_BF_PYTHON'] = False
297         
298         # Merge blenderlite, let command line to override
299         for k,v in target_env_defs.iteritems():
300                 if k not in B.arguments:
301                         env[k] = v
302
303 if env['WITH_BF_SDL'] == False and env['OURPLATFORM'] in ('win32-vc', 'win32-ming', 'win64-vc'):
304         env['PLATFORM_LINKFLAGS'].remove('/ENTRY:mainCRTStartup')
305         env['PLATFORM_LINKFLAGS'].append('/ENTRY:main')
306
307 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
308 #B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
309 B.root_build_dir = env['BF_BUILDDIR']
310 B.doc_build_dir = env['BF_DOCDIR']
311 if not B.root_build_dir[-1]==os.sep:
312         B.root_build_dir += os.sep
313 if not B.doc_build_dir[-1]==os.sep:
314         B.doc_build_dir += os.sep
315         
316 # We do a shortcut for clean when no quicklist is given: just delete
317 # builddir without reading in SConscripts
318 do_clean = None
319 if 'clean' in B.targets:
320         do_clean = True
321
322 if not quickie and do_clean:
323         if os.path.exists(B.doc_build_dir):
324                 print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
325                 dirs = os.listdir(B.doc_build_dir)
326                 for entry in dirs:
327                         if os.path.isdir(B.doc_build_dir + entry) == 1:
328                                 print "clean dir %s"%(B.doc_build_dir+entry)
329                                 shutil.rmtree(B.doc_build_dir+entry)
330                         else: # remove file
331                                 print "remove file %s"%(B.doc_build_dir+entry)
332                                 os.remove(B.root_build_dir+entry)
333         if os.path.exists(B.root_build_dir):
334                 print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
335                 dirs = os.listdir(B.root_build_dir)
336                 for entry in dirs:
337                         if os.path.isdir(B.root_build_dir + entry) == 1:
338                                 print "clean dir %s"%(B.root_build_dir+entry)
339                                 shutil.rmtree(B.root_build_dir+entry)
340                         else: # remove file
341                                 print "remove file %s"%(B.root_build_dir+entry)
342                                 os.remove(B.root_build_dir+entry)
343                 for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
344                                 'extern/xvidcore/build/generic/platform.inc', 'extern/ffmpeg/include']:
345                         if os.path.exists(confile):
346                                 print "clean file %s"%confile
347                                 if os.path.isdir(confile):
348                                         for root, dirs, files in os.walk(confile):
349                                                 for name in files:
350                                                         os.remove(os.path.join(root, name))
351                                 else:
352                                         os.remove(confile)
353                 print B.bc.OKGREEN+'...done'+B.bc.ENDC
354         else:
355                 print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
356         Exit()
357
358 if not os.path.isdir ( B.root_build_dir):
359         os.makedirs ( B.root_build_dir )
360         os.makedirs ( B.root_build_dir + 'source' )
361         os.makedirs ( B.root_build_dir + 'intern' )
362         os.makedirs ( B.root_build_dir + 'extern' )
363         os.makedirs ( B.root_build_dir + 'lib' )
364         os.makedirs ( B.root_build_dir + 'bin' )
365 if not os.path.isdir(B.doc_build_dir):
366         os.makedirs ( B.doc_build_dir )
367
368 Help(opts.GenerateHelpText(env))
369
370 # default is new quieter output, but if you need to see the 
371 # commands, do 'scons BF_QUIET=0'
372 bf_quietoutput = B.arguments.get('BF_QUIET', '1')
373 if env['BF_QUIET']:
374         B.set_quiet_output(env)
375 else:
376         if toolset=='msvc':
377                 B.msvc_hack(env)
378
379 print B.bc.HEADER+'Building in '+B.bc.ENDC+B.root_build_dir
380 env.SConsignFile(B.root_build_dir+'scons-signatures')
381 B.init_lib_dict()
382
383 ##### END SETUP ##########
384
385 Export('env')
386
387 BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
388 SConscript(B.root_build_dir+'/intern/SConscript')
389 BuildDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
390 SConscript(B.root_build_dir+'/extern/SConscript')
391 BuildDir(B.root_build_dir+'/source', 'source', duplicate=0)
392 SConscript(B.root_build_dir+'/source/SConscript')
393
394 # now that we have read all SConscripts, we know what
395 # libraries will be built. Create list of
396 # libraries to give as objects to linking phase
397 mainlist = []
398 for tp in B.possible_types:
399         if not tp == 'player' and not tp == 'player2':
400                 mainlist += B.create_blender_liblist(env, tp)
401
402 if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
403         B.propose_priorities()
404
405 dobj = B.buildinfo(env, "dynamic") + B.resources
406 thestatlibs, thelibincs = B.setup_staticlibs(env)
407 thesyslibs = B.setup_syslibs(env)
408
409 if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
410         #env.BlenderProg(B.root_build_dir, "blender", dobj , [], mainlist + thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
411         env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
412 if env['WITH_BF_PLAYER']:
413         playerlist = B.create_blender_liblist(env, 'player')
414         env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
415
416 ##### Now define some targets
417
418
419 #------------ INSTALL
420
421 #-- binaries
422 blenderinstall = []
423 if  env['OURPLATFORM']=='darwin':
424         for prg in B.program_list:
425                 bundle = '%s.app' % prg[0]
426                 bundledir = os.path.dirname(bundle)
427                 for dp, dn, df in os.walk(bundle):
428                         if 'CVS' in dn:
429                                 dn.remove('CVS')
430                         if '.svn' in dn:
431                                 dn.remove('.svn')
432                         dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
433                         source=[dp+os.sep+f for f in df]
434                         blenderinstall.append(env.Install(dir=dir,source=source))
435 else:
436         blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
437
438 #-- .blender
439 #- dont do .blender and scripts for darwin, it is already in the bundle
440 dotblendlist = []
441 dottargetlist = []
442 scriptinstall = []
443
444 if  env['OURPLATFORM']!='darwin':
445                 for dp, dn, df in os.walk('bin/.blender'):
446                         if 'CVS' in dn:
447                                 dn.remove('CVS')
448                         if '.svn' in dn:
449                                 dn.remove('.svn')
450                         
451                         for f in df:
452                                 if not env['WITH_BF_INTERNATIONAL']:
453                                         if 'locale' in dp:
454                                                 continue
455                                         if f == '.Blanguages':
456                                                 continue
457                                 if not env['WITH_BF_FREETYPE']:
458                                         if f.endswith('.ttf'):
459                                                 continue
460                                 
461                                 dotblendlist.append(os.path.join(dp, f))
462                                 dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
463
464                 dotblenderinstall = []
465                 for targetdir,srcfile in zip(dottargetlist, dotblendlist):
466                         td, tf = os.path.split(targetdir)
467                         dotblenderinstall.append(env.Install(dir=td, source=srcfile))
468                 
469                 if env['WITH_BF_PYTHON']:
470                         #-- .blender/scripts    
471                         scriptpath='release/scripts'
472                         for dp, dn, df in os.walk(scriptpath):
473                                 if 'CVS' in dn:
474                                         dn.remove('CVS')
475                                 if '.svn' in dn:
476                                         dn.remove('.svn')
477                                 dir=env['BF_INSTALLDIR']+'/.blender/scripts'+dp[len(scriptpath):]
478                                 source=[dp+os.sep+f for f in df]
479                                 scriptinstall.append(env.Install(dir=dir,source=source))
480
481                         #-- .blender/ui 
482                         scriptpath='release/ui'
483                         for dp, dn, df in os.walk(scriptpath):
484                                 if 'CVS' in dn:
485                                         dn.remove('CVS')
486                                 if '.svn' in dn:
487                                         dn.remove('.svn')
488                                 dir=env['BF_INSTALLDIR']+'/.blender/ui'+dp[len(scriptpath):]
489                                 source=[dp+os.sep+f for f in df]
490                                 scriptinstall.append(env.Install(dir=dir,source=source))
491
492 #-- icons
493 if env['OURPLATFORM']=='linux2':
494         iconlist = []
495         icontargetlist = []
496
497         for tp, tn, tf in os.walk('release/freedesktop/icons'):
498                 if 'CVS' in tn:
499                         tn.remove('CVS')
500                 if '.svn' in tn:
501                         tn.remove('.svn')
502                 for f in tf:
503                         iconlist.append(tp+os.sep+f)
504                         icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f)
505
506         iconinstall = []
507         for targetdir,srcfile in zip(icontargetlist, iconlist):
508                 td, tf = os.path.split(targetdir)
509                 iconinstall.append(env.Install(dir=td, source=srcfile))
510
511 # dlls for linuxcross
512 # TODO - add more libs, for now this lets blenderlite run
513 if env['OURPLATFORM']=='linuxcross':
514         dir=env['BF_INSTALLDIR']
515         source = ['../lib/windows/pthreads/lib/pthreadGC2.dll']
516         scriptinstall.append(env.Install(dir=dir, source=source))
517
518 #-- plugins
519 pluglist = []
520 plugtargetlist = []
521 for tp, tn, tf in os.walk('release/plugins'):
522         if 'CVS' in tn:
523                 tn.remove('CVS')
524         if '.svn' in tn:
525                 tn.remove('.svn')
526         for f in tf:
527                 pluglist.append(tp+os.sep+f)
528                 plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
529
530 # header files for plugins
531 pluglist.append('source/blender/blenpluginapi/documentation.h')
532 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'documentation.h')
533 pluglist.append('source/blender/blenpluginapi/externdef.h')
534 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'externdef.h')
535 pluglist.append('source/blender/blenpluginapi/floatpatch.h')
536 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'floatpatch.h')
537 pluglist.append('source/blender/blenpluginapi/iff.h')
538 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'iff.h')
539 pluglist.append('source/blender/blenpluginapi/plugin.h')
540 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'plugin.h')
541 pluglist.append('source/blender/blenpluginapi/util.h')
542 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'util.h')
543 pluglist.append('source/blender/blenpluginapi/plugin.DEF')
544 plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep + 'plugin.def')
545
546 plugininstall = []
547 for targetdir,srcfile in zip(plugtargetlist, pluglist):
548         td, tf = os.path.split(targetdir)
549         plugininstall.append(env.Install(dir=td, source=srcfile))
550
551 textlist = []
552 texttargetlist = []
553 for tp, tn, tf in os.walk('release/text'):
554         if 'CVS' in tn:
555                 tn.remove('CVS')
556         if '.svn' in tn:
557                 tn.remove('.svn')
558         for f in tf:
559                 textlist.append(tp+os.sep+f)
560
561 textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
562
563 if  env['OURPLATFORM']=='darwin':
564                 allinstall = [blenderinstall, plugininstall, textinstall]
565 elif env['OURPLATFORM']=='linux2':
566                 allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
567 else:
568                 allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
569
570 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc'):
571         if env['OURPLATFORM'] == 'win64-vc':
572                 dllsources = []
573         else:
574                 dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
575                                 '${BF_PNG_LIBPATH}/libpng.dll',
576                                 '${BF_ZLIB_LIBPATH}/zlib.dll',
577                                 '${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
578         dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
579         if env['WITH_BF_SDL']:
580                 if env['OURPLATFORM'] == 'win64-vc':
581                         pass # we link statically already to SDL on win64
582                 else:
583                         dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
584         if env['WITH_BF_PYTHON']:
585                 ver = env["BF_PYTHON_VERSION"].replace(".", "")
586                 
587                 dllsources.append('#release/windows/extra/python' + ver + '.zip')
588                 dllsources.append('#release/windows/extra/zlib.pyd')
589                 if env['BF_DEBUG']:
590                         dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}_d.dll')
591                 else:
592                         dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}.dll')
593         if env['WITH_BF_ICONV']:
594                 if env['OURPLATFORM'] == 'win64-vc':
595                         pass # we link statically to iconv on win64
596                 else:
597                         dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
598         if env['WITH_BF_FFMPEG']:
599                 dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-52.dll',
600                                                 '${LCGDIR}/ffmpeg/lib/avformat-52.dll',
601                                                 '${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
602                                                 '${LCGDIR}/ffmpeg/lib/avutil-50.dll',
603                                                 '${LCGDIR}/ffmpeg/lib/libfaad-2.dll',
604                                                 '${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
605                                                 '${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
606                                                 '${LCGDIR}/ffmpeg/lib/libx264-67.dll',
607                                                 '${LCGDIR}/ffmpeg/lib/xvidcore.dll',
608                                                 '${LCGDIR}/ffmpeg/lib/swscale-0.dll']
609         windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
610         allinstall += windlls
611
612 installtarget = env.Alias('install', allinstall)
613 bininstalltarget = env.Alias('install-bin', blenderinstall)
614
615 nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
616 nsiscmd = env.Command('nsisinstaller', None, nsisaction)
617 nsisalias = env.Alias('nsis', nsiscmd)
618
619 if 'blender' in B.targets:
620         blenderexe= env.Alias('blender', B.program_list)
621         Depends(blenderexe,installtarget)
622
623 if env['WITH_BF_PLAYER']:
624         blenderplayer = env.Alias('blenderplayer', B.program_list)
625         Depends(blenderplayer,installtarget)
626
627 if not env['WITH_BF_GAMEENGINE']:
628         blendernogame = env.Alias('blendernogame', B.program_list)
629         Depends(blendernogame,installtarget)
630
631 if 'blenderlite' in B.targets:
632         blenderlite = env.Alias('blenderlite', B.program_list)
633         Depends(blenderlite,installtarget)
634
635 Depends(nsiscmd, allinstall)
636
637 Default(B.program_list)
638
639 if not env['WITHOUT_BF_INSTALL']:
640                 Default(installtarget)
641
642 #------------ EPYDOC
643 if env['WITH_BF_DOCS']:
644         try:            import epydoc
645         except: epydoc = None
646         
647         if epydoc:
648                 SConscript('source/blender/python/api2_2x/doc/SConscript')
649                 SConscript('source/gameengine/PyDoc/SConscript')
650         else:
651                 print "No epydoc install detected, Python API and Gameengine API Docs will not be generated "
652         
653