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