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