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