3 # ***** BEGIN GPL LICENSE BLOCK *****
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.
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.
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.
19 # The Original Code is Copyright (C) 2006, Blender Foundation
20 # All rights reserved.
22 # The Original Code is: all of this file.
24 # Contributor(s): Nathan Letwory.
26 # ***** END GPL LICENSE BLOCK *****
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
32 # TODO: fix /FORCE:MULTIPLE on windows to get proper debug builds.
33 # TODO: directory copy functions are far too complicated, see:
34 # http://wiki.blender.org/index.php/User:Ideasman42/SConsNotSimpleInstallingFiles
36 import platform as pltfrm
38 # Need a better way to do this. Automagical maybe is not the best thing, maybe it is.
39 if pltfrm.architecture()[0] == '64bit':
51 from tempfile import mkdtemp
54 toolpath=os.path.join(".", "build_files", "scons", "tools")
56 # needed for importing tools
57 sys.path.append(toolpath)
63 EnsureSConsVersion(1,0,0)
65 # Before we do anything, let's check if we have a sane os.environ
66 if not btools.check_environ():
69 BlenderEnvironment = Blender.BlenderEnvironment
72 VERSION = btools.VERSION # This is used in creating the local config directories
73 VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE
76 platform = sys.platform
80 ##### BEGIN SETUP #####
82 B.possible_types = ['core', 'player', 'player2', 'intern', 'extern']
84 B.binarykind = ['blender' , 'blenderplayer']
85 ##################################
86 # target and argument validation #
87 ##################################
88 # XX cheating for BF_FANCY, we check for BF_FANCY before args are validated
89 use_color = ARGUMENTS.get('BF_FANCY', '1')
93 if not use_color=='1':
96 #on defaut white Os X terminal, some colors are totally unlegible
97 if platform=='darwin':
98 B.bc.OKGREEN = '\033[34m'
99 B.bc.WARNING = '\033[36m'
102 print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
103 B.arguments = btools.validate_arguments(ARGUMENTS, B.bc)
104 btools.print_arguments(B.arguments, B.bc)
107 print B.bc.HEADER+'Command-line targets'+B.bc.ENDC
108 B.targets = btools.validate_targets(COMMAND_LINE_TARGETS, B.bc)
109 btools.print_targets(B.targets, B.bc)
111 ##########################
112 # setting up environment #
113 ##########################
115 # handling cmd line arguments & config file
118 tempbitness = int(B.arguments.get('BF_BITNESS', bitness)) # default to bitness found as per starting python
119 if tempbitness in (32, 64): # only set if 32 or 64 has been given
120 bitness = int(tempbitness)
122 # first check cmdline for toolset and we create env to work on
123 quickie = B.arguments.get('BF_QUICK', None)
124 quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
127 B.quickdebug=string.split(quickdebug, ',')
132 B.quickie=string.split(quickie,',')
136 toolset = B.arguments.get('BF_TOOLSET', None)
138 print "Using " + toolset
139 if toolset=='mstoolkit':
140 env = BlenderEnvironment(ENV = os.environ)
141 env.Tool('mstoolkit', [toolpath])
143 env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
144 # xxx commented out, as was supressing warnings under mingw..
146 # btools.SetupSpawn(env)
148 if bitness==64 and platform=='win32':
149 env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64')
151 env = BlenderEnvironment(ENV = os.environ)
154 print "Could not create a build environment"
157 cc = B.arguments.get('CC', None)
158 cxx = B.arguments.get('CXX', None)
164 if sys.platform=='win32':
165 if env['CC'] in ['cl', 'cl.exe']:
166 platform = 'win64-vc' if bitness == 64 else 'win32-vc'
167 elif env['CC'] in ['gcc']:
168 platform = 'win32-mingw'
170 env.SConscriptChdir(0)
172 # Remove major kernel version from linux platform.
173 # After Linus switched kernel to new version model this major version
174 # shouldn't take much sense for building rules.
176 if re.match('linux[0-9]+', platform):
179 crossbuild = B.arguments.get('BF_CROSS', None)
180 if crossbuild and platform not in ('win32-vc', 'win64-vc'):
181 platform = 'linuxcross'
183 env['OURPLATFORM'] = platform
185 configfile = os.path.join("build_files", "scons", "config", platform + "-config.py")
187 if os.path.exists(configfile):
188 print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
190 print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
192 if crossbuild and env['PLATFORM'] != 'win32':
193 print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
194 env.Tool('crossmingw', [toolpath])
195 # todo: determine proper libs/includes etc.
196 # Needed for gui programs, console programs should do without it
198 # Now we don't need this option to have console window
199 # env.Append(LINKFLAGS=['-mwindows'])
201 userconfig = B.arguments.get('BF_CONFIG', 'user-config.py')
202 # first read platform config. B.arguments will override
203 optfiles = [configfile]
204 if os.path.exists(userconfig):
205 print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
206 optfiles += [userconfig]
208 print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
210 opts = btools.read_opts(env, optfiles, B.arguments)
213 if sys.platform=='win32':
215 env.Append(CPPFLAGS=['-DWIN64']) # -DWIN32 needed too, as it's used all over to target Windows generally
217 if not env['BF_FANCY']:
221 # remove install dir so old and new files are not mixed.
222 # NOTE: only do the scripts directory for now, otherwise is too disruptive for developers
223 # TODO: perhaps we need an option (off by default) to not do this altogether...
224 if not env['WITHOUT_BF_INSTALL'] and not env['WITHOUT_BF_OVERWRITE_INSTALL']:
225 scriptsDir = os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts')
226 if os.path.isdir(scriptsDir):
227 print B.bc.OKGREEN + "Clearing installation directory%s: %s" % (B.bc.ENDC, os.path.abspath(scriptsDir))
228 shutil.rmtree(scriptsDir)
231 SetOption('num_jobs', int(env['BF_NUMJOBS']))
232 print B.bc.OKGREEN + "Build with parallel jobs%s: %s" % (B.bc.ENDC, GetOption('num_jobs'))
233 print B.bc.OKGREEN + "Build with debug symbols%s: %s" % (B.bc.ENDC, env['BF_DEBUG'])
235 if 'blenderlite' in B.targets:
237 target_env_defs['WITH_BF_GAMEENGINE'] = False
238 target_env_defs['WITH_BF_OPENAL'] = False
239 target_env_defs['WITH_BF_OPENEXR'] = False
240 target_env_defs['WITH_BF_OPENMP'] = False
241 target_env_defs['WITH_BF_ICONV'] = False
242 target_env_defs['WITH_BF_INTERNATIONAL'] = False
243 target_env_defs['WITH_BF_OPENJPEG'] = False
244 target_env_defs['WITH_BF_FFMPEG'] = False
245 target_env_defs['WITH_BF_QUICKTIME'] = False
246 target_env_defs['WITH_BF_REDCODE'] = False
247 target_env_defs['WITH_BF_DDS'] = False
248 target_env_defs['WITH_BF_CINEON'] = False
249 target_env_defs['WITH_BF_HDR'] = False
250 target_env_defs['WITH_BF_ZLIB'] = False
251 target_env_defs['WITH_BF_SDL'] = False
252 target_env_defs['WITH_BF_JPEG'] = False
253 target_env_defs['WITH_BF_PNG'] = False
254 target_env_defs['WITH_BF_BULLET'] = False
255 target_env_defs['WITH_BF_BINRELOC'] = False
256 target_env_defs['BF_BUILDINFO'] = False
257 target_env_defs['WITH_BF_FLUID'] = False
258 target_env_defs['WITH_BF_OCEANSIM'] = False
259 target_env_defs['WITH_BF_DECIMATE'] = False
260 target_env_defs['WITH_BF_BOOLEAN'] = False
261 target_env_defs['WITH_BF_PYTHON'] = False
262 target_env_defs['WITH_BF_3DMOUSE'] = False
264 # Merge blenderlite, let command line to override
265 for k,v in target_env_defs.iteritems():
266 if k not in B.arguments:
269 # Extended OSX_SDK and 3D_CONNEXION_CLIENT_LIBRARY detection for OSX
270 if env['OURPLATFORM']=='darwin':
271 print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'][:9] + " --"
272 print "Available " + env['MACOSX_SDK_CHECK']
273 if not 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']:
274 print B.bc.OKGREEN + "MacOSX10.5.sdk not available:" + B.bc.ENDC + " using MacOSX10.6.sdk"
276 print B.bc.OKGREEN + "Found recommended sdk :" + B.bc.ENDC + " using MacOSX10.5.sdk"
278 # for now, Mac builders must download and install the 3DxWare 10 Beta 4 driver framework from 3Dconnexion
279 # necessary header file lives here when installed:
280 # /Library/Frameworks/3DconnexionClient.framework/Versions/Current/Headers/ConnexionClientAPI.h
281 if env['WITH_BF_3DMOUSE'] == 1:
282 if not os.path.exists('/Library/Frameworks/3DconnexionClient.framework'):
283 print "3D_CONNEXION_CLIENT_LIBRARY not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
284 env['WITH_BF_3DMOUSE'] = 0
286 env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','3DconnexionClient'])
288 if env['WITH_BF_OPENMP'] == 1:
289 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
290 env['CCFLAGS'].append('/openmp')
292 if env['CC'].endswith('icc'): # to be able to handle CC=/opt/bla/icc case
293 env.Append(LINKFLAGS=['-openmp', '-static-intel'])
294 env['CCFLAGS'].append('-openmp')
296 env.Append(CCFLAGS=['-fopenmp'])
298 if env['WITH_GHOST_COCOA'] == True:
299 env.Append(CPPFLAGS=['-DGHOST_COCOA'])
301 if env['USE_QTKIT'] == True:
302 env.Append(CPPFLAGS=['-DUSE_QTKIT'])
304 #check for additional debug libnames
306 if env.has_key('BF_DEBUG_LIBS'):
307 B.quickdebug += env['BF_DEBUG_LIBS']
309 printdebug = B.arguments.get('BF_LISTDEBUG', 0)
311 if len(B.quickdebug) > 0 and printdebug != 0:
312 print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
313 for l in B.quickdebug:
316 # remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
317 if env['WITH_BF_STATICCXX']:
318 if 'stdc++' in env['LLIBS']:
319 env['LLIBS'].remove('stdc++')
321 print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
323 # check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
324 if 'blenderplayer' in B.targets:
325 env['WITH_BF_PLAYER'] = True
327 if 'blendernogame' in B.targets:
328 env['WITH_BF_GAMEENGINE'] = False
330 # build without elbeem (fluidsim)?
331 if env['WITH_BF_FLUID'] == 1:
332 env['CPPFLAGS'].append('-DWITH_MOD_FLUID')
334 # build with ocean sim?
335 if env['WITH_BF_OCEANSIM'] == 1:
336 env['WITH_BF_FFTW3'] = 1 # ocean needs fftw3 so enable it
337 env['CPPFLAGS'].append('-DWITH_MOD_OCEANSIM')
340 if btools.ENDIAN == "big":
341 env['CPPFLAGS'].append('-D__BIG_ENDIAN__')
343 env['CPPFLAGS'].append('-D__LITTLE_ENDIAN__')
345 # TODO, make optional
346 env['CPPFLAGS'].append('-DWITH_AUDASPACE')
348 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
349 B.root_build_dir = env['BF_BUILDDIR']
350 B.doc_build_dir = os.path.join(env['BF_INSTALLDIR'], 'doc')
351 if not B.root_build_dir[-1]==os.sep:
352 B.root_build_dir += os.sep
353 if not B.doc_build_dir[-1]==os.sep:
354 B.doc_build_dir += os.sep
356 # We do a shortcut for clean when no quicklist is given: just delete
357 # builddir without reading in SConscripts
359 if 'clean' in B.targets:
362 if not quickie and do_clean:
363 if os.path.exists(B.doc_build_dir):
364 print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
365 dirs = os.listdir(B.doc_build_dir)
367 if os.path.isdir(B.doc_build_dir + entry) == 1:
368 print "clean dir %s"%(B.doc_build_dir+entry)
369 shutil.rmtree(B.doc_build_dir+entry)
371 print "remove file %s"%(B.doc_build_dir+entry)
372 os.remove(B.root_build_dir+entry)
373 if os.path.exists(B.root_build_dir):
374 print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
375 dirs = os.listdir(B.root_build_dir)
377 if os.path.isdir(B.root_build_dir + entry) == 1:
378 print "clean dir %s"%(B.root_build_dir+entry)
379 shutil.rmtree(B.root_build_dir+entry)
381 print "remove file %s"%(B.root_build_dir+entry)
382 os.remove(B.root_build_dir+entry)
383 for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
384 'extern/xvidcore/build/generic/platform.inc', 'extern/ffmpeg/include']:
385 if os.path.exists(confile):
386 print "clean file %s"%confile
387 if os.path.isdir(confile):
388 for root, dirs, files in os.walk(confile):
390 os.remove(os.path.join(root, name))
393 print B.bc.OKGREEN+'...done'+B.bc.ENDC
395 print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
399 # ensure python header is found since detection can fail, this could happen
400 # with _any_ library but since we used a fixed python version this tends to
401 # be most problematic.
402 if env['WITH_BF_PYTHON']:
403 py_h = os.path.join(Dir(env.subst('${BF_PYTHON_INC}')).abspath, "Python.h")
405 if not os.path.exists(py_h):
406 print("\nMissing: \"" + env.subst('${BF_PYTHON_INC}') + os.sep + "Python.h\",\n"
407 " Set 'BF_PYTHON_INC' to point "
408 "to a valid python include path.\n Containing "
409 "Python.h for python version \"" + env.subst('${BF_PYTHON_VERSION}') + "\"")
415 if not os.path.isdir ( B.root_build_dir):
416 os.makedirs ( B.root_build_dir )
417 os.makedirs ( B.root_build_dir + 'source' )
418 os.makedirs ( B.root_build_dir + 'intern' )
419 os.makedirs ( B.root_build_dir + 'extern' )
420 os.makedirs ( B.root_build_dir + 'lib' )
421 os.makedirs ( B.root_build_dir + 'bin' )
422 # # Docs not working with epy anymore
423 # if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']:
424 # os.makedirs ( B.doc_build_dir )
426 Help(opts.GenerateHelpText(env))
428 # default is new quieter output, but if you need to see the
429 # commands, do 'scons BF_QUIET=0'
430 bf_quietoutput = B.arguments.get('BF_QUIET', '1')
432 B.set_quiet_output(env)
437 print B.bc.HEADER+'Building in: ' + B.bc.ENDC + os.path.abspath(B.root_build_dir)
438 env.SConsignFile(B.root_build_dir+'scons-signatures')
441 ##### END SETUP ##########
445 BuildDir(B.root_build_dir+'/source', 'source', duplicate=0)
446 SConscript(B.root_build_dir+'/source/SConscript')
447 BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
448 SConscript(B.root_build_dir+'/intern/SConscript')
449 BuildDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
450 SConscript(B.root_build_dir+'/extern/SConscript')
452 # now that we have read all SConscripts, we know what
453 # libraries will be built. Create list of
454 # libraries to give as objects to linking phase
456 for tp in B.possible_types:
457 if (not tp == 'player') and (not tp == 'player2'):
458 mainlist += B.create_blender_liblist(env, tp)
460 if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
461 B.propose_priorities()
463 dobj = B.buildinfo(env, "dynamic") + B.resources
464 creob = B.creator(env)
465 thestatlibs, thelibincs = B.setup_staticlibs(env)
466 thesyslibs = B.setup_syslibs(env)
468 if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
469 env.BlenderProg(B.root_build_dir, "blender", creob + mainlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
470 if env['WITH_BF_PLAYER']:
471 playerlist = B.create_blender_liblist(env, 'player')
472 playerlist += B.create_blender_liblist(env, 'player2')
473 playerlist += B.create_blender_liblist(env, 'intern')
474 playerlist += B.create_blender_liblist(env, 'extern')
475 env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
477 ##### Now define some targets
480 #------------ INSTALL
484 if env['OURPLATFORM']=='darwin':
485 for prg in B.program_list:
486 bundle = '%s.app' % prg[0]
487 bundledir = os.path.dirname(bundle)
488 for dp, dn, df in os.walk(bundle):
493 dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
494 source=[dp+os.sep+f for f in df]
495 blenderinstall.append(env.Install(dir=dir,source=source))
497 blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
499 #-- local path = config files in install dir: installdir\VERSION
500 #- dont do config and scripts for darwin, it is already in the bundle
503 datafilestargetlist = []
507 if env['OURPLATFORM']!='darwin':
508 dotblenderinstall = []
509 for targetdir,srcfile in zip(dottargetlist, dotblendlist):
510 td, tf = os.path.split(targetdir)
511 dotblenderinstall.append(env.Install(dir=td, source=srcfile))
512 for targetdir,srcfile in zip(datafilestargetlist, datafileslist):
513 td, tf = os.path.split(targetdir)
514 dotblenderinstall.append(env.Install(dir=td, source=srcfile))
516 if env['WITH_BF_PYTHON']:
517 #-- local/VERSION/scripts
518 scriptpaths=['release/scripts']
519 for scriptpath in scriptpaths:
520 for dp, dn, df in os.walk(scriptpath):
525 if '__pycache__' in dn: # py3.2 cache dir
526 dn.remove('__pycache__')
528 # only for testing builds
529 if VERSION_RELEASE_CYCLE == "release" and "addons_contrib" in dn:
530 dn.remove('addons_contrib')
532 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
533 dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):]
535 source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
536 # To ensure empty dirs are created too
538 env.Execute(Mkdir(dir))
539 scriptinstall.append(env.Install(dir=dir,source=source))
540 if env['WITH_BF_CYCLES']:
542 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles')
543 source=os.listdir('intern/cycles/blender/addon')
544 if '.svn' in source: source.remove('.svn')
545 if '_svn' in source: source.remove('_svn')
546 if '__pycache__' in source: source.remove('__pycache__')
547 source=['intern/cycles/blender/addon/'+s for s in source]
548 scriptinstall.append(env.Install(dir=dir,source=source))
551 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel')
552 source=os.listdir('intern/cycles/kernel')
553 if '.svn' in source: source.remove('.svn')
554 if '_svn' in source: source.remove('_svn')
555 if '__pycache__' in source: source.remove('__pycache__')
556 source.remove('kernel.cpp')
557 source.remove('CMakeLists.txt')
560 source=['intern/cycles/kernel/'+s for s in source]
561 source.append('intern/cycles/util/util_color.h')
562 source.append('intern/cycles/util/util_math.h')
563 source.append('intern/cycles/util/util_transform.h')
564 source.append('intern/cycles/util/util_types.h')
565 scriptinstall.append(env.Install(dir=dir,source=source))
567 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'svm')
568 source=os.listdir('intern/cycles/kernel/svm')
569 if '.svn' in source: source.remove('.svn')
570 if '_svn' in source: source.remove('_svn')
571 if '__pycache__' in source: source.remove('__pycache__')
572 source=['intern/cycles/kernel/svm/'+s for s in source]
573 scriptinstall.append(env.Install(dir=dir,source=source))
576 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license')
577 source=os.listdir('intern/cycles/doc/license')
578 if '.svn' in source: source.remove('.svn')
579 if '_svn' in source: source.remove('_svn')
580 if '__pycache__' in source: source.remove('__pycache__')
581 source.remove('CMakeLists.txt')
582 source=['intern/cycles/doc/license/'+s for s in source]
583 scriptinstall.append(env.Install(dir=dir,source=source))
586 if env['WITH_BF_CYCLES_CUDA_BINARIES']:
587 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'lib')
588 for arch in env['BF_CYCLES_CUDA_BINARIES_ARCH']:
589 kernel_build_dir = os.path.join(B.root_build_dir, 'intern/cycles/kernel')
590 cubin_file = os.path.join(kernel_build_dir, "kernel_%s.cubin" % arch)
591 scriptinstall.append(env.Install(dir=dir,source=cubin_file))
593 if env['WITH_BF_INTERNATIONAL']:
594 internationalpaths=['release' + os.sep + 'datafiles']
596 def check_path(path, member):
597 return (member in path.split(os.sep))
599 for intpath in internationalpaths:
600 for dp, dn, df in os.walk(intpath):
606 # we only care about release/datafiles/fonts, release/datafiles/locales
607 if check_path(dp, "fonts") or check_path(dp, "locale"):
612 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
613 dir += os.sep + os.path.basename(intpath) + dp[len(intpath):]
615 source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
616 # To ensure empty dirs are created too
618 env.Execute(Mkdir(dir))
619 scriptinstall.append(env.Install(dir=dir,source=source))
622 if env['OURPLATFORM']=='linux':
626 for tp, tn, tf in os.walk('release/freedesktop/icons'):
632 iconlist.append(os.path.join(tp, f))
633 icontargetlist.append( os.path.join(*([env['BF_INSTALLDIR']] + tp.split(os.sep)[2:] + [f])) )
636 for targetdir,srcfile in zip(icontargetlist, iconlist):
637 td, tf = os.path.split(targetdir)
638 iconinstall.append(env.Install(dir=td, source=srcfile))
640 # dlls for linuxcross
641 # TODO - add more libs, for now this lets blenderlite run
642 if env['OURPLATFORM']=='linuxcross':
643 dir=env['BF_INSTALLDIR']
646 if env['WITH_BF_OPENMP']:
647 source += ['../lib/windows/pthreads/lib/pthreadGC2.dll']
649 scriptinstall.append(env.Install(dir=dir, source=source))
654 for tp, tn, tf in os.walk('release/plugins'):
659 df = tp[8:] # remove 'release/'
661 pluglist.append(os.path.join(tp, f))
662 plugtargetlist.append( os.path.join(env['BF_INSTALLDIR'], VERSION, df, f) )
665 # header files for plugins
666 pluglist.append('source/blender/blenpluginapi/documentation.h')
667 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'documentation.h'))
668 pluglist.append('source/blender/blenpluginapi/externdef.h')
669 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'externdef.h'))
670 pluglist.append('source/blender/blenpluginapi/floatpatch.h')
671 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'floatpatch.h'))
672 pluglist.append('source/blender/blenpluginapi/iff.h')
673 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'iff.h'))
674 pluglist.append('source/blender/blenpluginapi/plugin.h')
675 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'plugin.h'))
676 pluglist.append('source/blender/blenpluginapi/util.h')
677 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'util.h'))
678 pluglist.append('source/blender/blenpluginapi/plugin.DEF')
679 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'plugin.def'))
682 # plugins in blender 2.5 don't work at the moment.
683 #for targetdir,srcfile in zip(plugtargetlist, pluglist):
684 # td, tf = os.path.split(targetdir)
685 # plugininstall.append(env.Install(dir=td, source=srcfile))
689 for tp, tn, tf in os.walk('release/text'):
695 textlist.append(tp+os.sep+f)
697 textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
699 if env['OURPLATFORM']=='darwin':
700 allinstall = [blenderinstall, plugininstall, textinstall]
701 elif env['OURPLATFORM']=='linux':
702 allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
704 allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
706 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
709 if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
710 # For MinGW and linuxcross static linking will be used
711 dllsources += ['${LCGDIR}/gettext/lib/gnu_gettext.dll']
713 #currently win64-vc doesn't appear to have libpng.dll
714 if env['OURPLATFORM'] != 'win64-vc':
715 dllsources += ['${BF_PNG_LIBPATH}/libpng.dll']
717 dllsources += ['${BF_ZLIB_LIBPATH}/zlib.dll']
718 # Used when linking to libtiff was dynamic
719 # keep it here until compilation on all platform would be ok
720 # dllsources += ['${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
722 if env['OURPLATFORM'] != 'linuxcross':
723 # pthreads library is already added
724 dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
726 if env['WITH_BF_SDL']:
727 if env['OURPLATFORM'] == 'win64-vc':
728 pass # we link statically already to SDL on win64
730 dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
732 if env['WITH_BF_PYTHON']:
734 dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
736 dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
738 if env['WITH_BF_ICONV']:
739 if env['OURPLATFORM'] == 'win64-vc':
740 pass # we link statically to iconv on win64
741 elif not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
742 #gettext for MinGW and cross-compilation is compiled staticly
743 dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
745 if env['WITH_BF_OPENAL']:
746 dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
747 dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
749 if env['WITH_BF_SNDFILE']:
750 dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
752 if env['WITH_BF_FFMPEG']:
753 dllsources += env['BF_FFMPEG_DLL'].split()
755 # Since the thumb handler is loaded by Explorer, architecture is
756 # strict: the x86 build fails on x64 Windows. We need to ship
757 # both builds in x86 packages.
759 dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll')
760 dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
762 if env['WITH_BF_OIIO']:
763 dllsources.append('${LCGDIR}/openimageio/bin/OpenImageIO.dll')
765 dllsources.append('#source/icons/blender.exe.manifest')
767 windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
768 allinstall += windlls
770 installtarget = env.Alias('install', allinstall)
771 bininstalltarget = env.Alias('install-bin', blenderinstall)
773 nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
774 nsiscmd = env.Command('nsisinstaller', None, nsisaction)
775 nsisalias = env.Alias('nsis', nsiscmd)
777 if 'blender' in B.targets:
778 blenderexe= env.Alias('blender', B.program_list)
779 Depends(blenderexe,installtarget)
781 if env['WITH_BF_PLAYER']:
782 blenderplayer = env.Alias('blenderplayer', B.program_list)
783 Depends(blenderplayer,installtarget)
785 if not env['WITH_BF_GAMEENGINE']:
786 blendernogame = env.Alias('blendernogame', B.program_list)
787 Depends(blendernogame,installtarget)
789 if 'blenderlite' in B.targets:
790 blenderlite = env.Alias('blenderlite', B.program_list)
791 Depends(blenderlite,installtarget)
793 Depends(nsiscmd, allinstall)
795 buildslave_action = env.Action(btools.buildslave, btools.buildslave_print)
796 buildslave_cmd = env.Command('buildslave_exec', None, buildslave_action)
797 buildslave_alias = env.Alias('buildslave', buildslave_cmd)
799 Depends(buildslave_cmd, allinstall)
801 Default(B.program_list)
803 if not env['WITHOUT_BF_INSTALL']:
804 Default(installtarget)