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