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