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)
125 B.bitness = tempbitness
128 # first check cmdline for toolset and we create env to work on
129 quickie = B.arguments.get('BF_QUICK', None)
130 quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
133 B.quickdebug=string.split(quickdebug, ',')
138 B.quickie=string.split(quickie,',')
142 toolset = B.arguments.get('BF_TOOLSET', None)
144 print "Using " + toolset
145 if toolset=='mstoolkit':
146 env = BlenderEnvironment(ENV = os.environ)
147 env.Tool('mstoolkit', [toolpath])
149 env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
150 # xxx commented out, as was supressing warnings under mingw..
152 # btools.SetupSpawn(env)
154 if bitness==64 and platform=='win32':
155 env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64')
157 env = BlenderEnvironment(ENV = os.environ)
160 print "Could not create a build environment"
163 cc = B.arguments.get('CC', None)
164 cxx = B.arguments.get('CXX', None)
170 if sys.platform=='win32':
171 if env['CC'] in ['cl', 'cl.exe']:
172 platform = 'win64-vc' if bitness == 64 else 'win32-vc'
173 elif env['CC'] in ['gcc']:
174 platform = 'win32-mingw'
176 env.SConscriptChdir(0)
178 # Remove major kernel version from linux platform.
179 # After Linus switched kernel to new version model this major version
180 # shouldn't take much sense for building rules.
182 if re.match('linux[0-9]+', platform):
185 crossbuild = B.arguments.get('BF_CROSS', None)
186 if crossbuild and platform not in ('win32-vc', 'win64-vc'):
187 platform = 'linuxcross'
189 env['OURPLATFORM'] = platform
191 configfile = os.path.join("build_files", "scons", "config", platform + "-config.py")
193 if os.path.exists(configfile):
194 print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
196 print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
198 if crossbuild and env['PLATFORM'] != 'win32':
199 print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
200 env.Tool('crossmingw', [toolpath])
201 # todo: determine proper libs/includes etc.
202 # Needed for gui programs, console programs should do without it
204 # Now we don't need this option to have console window
205 # env.Append(LINKFLAGS=['-mwindows'])
207 userconfig = B.arguments.get('BF_CONFIG', 'user-config.py')
208 # first read platform config. B.arguments will override
209 optfiles = [configfile]
210 if os.path.exists(userconfig):
211 print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
212 optfiles += [userconfig]
214 print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
216 opts = btools.read_opts(env, optfiles, B.arguments)
219 if sys.platform=='win32':
221 env.Append(CPPFLAGS=['-DWIN64']) # -DWIN32 needed too, as it's used all over to target Windows generally
223 if not env['BF_FANCY']:
227 # remove install dir so old and new files are not mixed.
228 # NOTE: only do the scripts directory for now, otherwise is too disruptive for developers
229 # TODO: perhaps we need an option (off by default) to not do this altogether...
230 if not env['WITHOUT_BF_INSTALL'] and not env['WITHOUT_BF_OVERWRITE_INSTALL']:
231 scriptsDir = os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts')
232 if os.path.isdir(scriptsDir):
233 print B.bc.OKGREEN + "Clearing installation directory%s: %s" % (B.bc.ENDC, os.path.abspath(scriptsDir))
234 shutil.rmtree(scriptsDir)
237 SetOption('num_jobs', int(env['BF_NUMJOBS']))
238 print B.bc.OKGREEN + "Build with parallel jobs%s: %s" % (B.bc.ENDC, GetOption('num_jobs'))
239 print B.bc.OKGREEN + "Build with debug symbols%s: %s" % (B.bc.ENDC, env['BF_DEBUG'])
241 if 'blenderlite' in B.targets:
243 target_env_defs['WITH_BF_GAMEENGINE'] = False
244 target_env_defs['WITH_BF_OPENAL'] = False
245 target_env_defs['WITH_BF_OPENEXR'] = False
246 target_env_defs['WITH_BF_OPENMP'] = False
247 target_env_defs['WITH_BF_ICONV'] = False
248 target_env_defs['WITH_BF_INTERNATIONAL'] = False
249 target_env_defs['WITH_BF_OPENJPEG'] = False
250 target_env_defs['WITH_BF_FFMPEG'] = False
251 target_env_defs['WITH_BF_QUICKTIME'] = False
252 target_env_defs['WITH_BF_REDCODE'] = False
253 target_env_defs['WITH_BF_DDS'] = False
254 target_env_defs['WITH_BF_CINEON'] = False
255 target_env_defs['WITH_BF_HDR'] = False
256 target_env_defs['WITH_BF_ZLIB'] = False
257 target_env_defs['WITH_BF_SDL'] = False
258 target_env_defs['WITH_BF_JPEG'] = False
259 target_env_defs['WITH_BF_PNG'] = False
260 target_env_defs['WITH_BF_BULLET'] = False
261 target_env_defs['WITH_BF_BINRELOC'] = False
262 target_env_defs['BF_BUILDINFO'] = False
263 target_env_defs['WITH_BF_FLUID'] = False
264 target_env_defs['WITH_BF_OCEANSIM'] = False
265 target_env_defs['WITH_BF_DECIMATE'] = False
266 target_env_defs['WITH_BF_BOOLEAN'] = False
267 target_env_defs['WITH_BF_REMESH'] = False
268 target_env_defs['WITH_BF_PYTHON'] = False
269 target_env_defs['WITH_BF_3DMOUSE'] = False
271 # Merge blenderlite, let command line to override
272 for k,v in target_env_defs.iteritems():
273 if k not in B.arguments:
276 # Extended OSX_SDK and 3D_CONNEXION_CLIENT_LIBRARY and JAckOSX detection for OSX
277 if env['OURPLATFORM']=='darwin':
278 print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'][:9] + " --"
279 print "Available " + env['MACOSX_SDK_CHECK']
280 if not 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']:
281 print B.bc.OKGREEN + "MacOSX10.5.sdk not available:" + B.bc.ENDC + " using MacOSX10.6.sdk"
283 print B.bc.OKGREEN + "Found recommended sdk :" + B.bc.ENDC + " using MacOSX10.5.sdk"
285 # for now, Mac builders must download and install the 3DxWare 10 Beta 4 driver framework from 3Dconnexion
286 # necessary header file lives here when installed:
287 # /Library/Frameworks/3DconnexionClient.framework/Versions/Current/Headers/ConnexionClientAPI.h
288 if env['WITH_BF_3DMOUSE'] == 1:
289 if not os.path.exists('/Library/Frameworks/3DconnexionClient.framework'):
290 print "3D_CONNEXION_CLIENT_LIBRARY not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
291 env['WITH_BF_3DMOUSE'] = 0
293 env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','3DconnexionClient'])
295 # for now, Mac builders must download and install the JackOSX framework
296 # necessary header file lives here when installed:
297 # /Library/Frameworks/Jackmp.framework/Versions/A/Headers/jack.h
298 if env['WITH_BF_JACK'] == 1:
299 if not os.path.exists('/Library/Frameworks/Jackmp.framework'):
300 print "JackOSX install not found, disabling WITH_BF_JACK" # avoid build errors !
301 env['WITH_BF_JACK'] = 0
303 env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','Jackmp'])
305 if env['WITH_BF_OPENMP'] == 1:
306 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
307 env['CCFLAGS'].append('/openmp')
309 if env['CC'].endswith('icc'): # to be able to handle CC=/opt/bla/icc case
310 env.Append(LINKFLAGS=['-openmp', '-static-intel'])
311 env['CCFLAGS'].append('-openmp')
313 env.Append(CCFLAGS=['-fopenmp'])
315 if env['WITH_GHOST_COCOA'] == True:
316 env.Append(CPPFLAGS=['-DGHOST_COCOA'])
318 if env['USE_QTKIT'] == True:
319 env.Append(CPPFLAGS=['-DUSE_QTKIT'])
321 #check for additional debug libnames
323 if env.has_key('BF_DEBUG_LIBS'):
324 B.quickdebug += env['BF_DEBUG_LIBS']
326 printdebug = B.arguments.get('BF_LISTDEBUG', 0)
328 if len(B.quickdebug) > 0 and printdebug != 0:
329 print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
330 for l in B.quickdebug:
333 # remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
334 if env['WITH_BF_STATICCXX']:
335 if 'stdc++' in env['LLIBS']:
336 env['LLIBS'].remove('stdc++')
338 print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
340 # check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
341 if 'blenderplayer' in B.targets:
342 env['WITH_BF_PLAYER'] = True
344 if 'blendernogame' in B.targets:
345 env['WITH_BF_GAMEENGINE'] = False
347 # build without elbeem (fluidsim)?
348 if env['WITH_BF_FLUID'] == 1:
349 env['CPPFLAGS'].append('-DWITH_MOD_FLUID')
351 # build with ocean sim?
352 if env['WITH_BF_OCEANSIM'] == 1:
353 env['WITH_BF_FFTW3'] = 1 # ocean needs fftw3 so enable it
354 env['CPPFLAGS'].append('-DWITH_MOD_OCEANSIM')
357 if btools.ENDIAN == "big":
358 env['CPPFLAGS'].append('-D__BIG_ENDIAN__')
360 env['CPPFLAGS'].append('-D__LITTLE_ENDIAN__')
362 # TODO, make optional
363 env['CPPFLAGS'].append('-DWITH_AUDASPACE')
365 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
366 B.root_build_dir = env['BF_BUILDDIR']
367 B.doc_build_dir = os.path.join(env['BF_INSTALLDIR'], 'doc')
368 if not B.root_build_dir[-1]==os.sep:
369 B.root_build_dir += os.sep
370 if not B.doc_build_dir[-1]==os.sep:
371 B.doc_build_dir += os.sep
373 # We do a shortcut for clean when no quicklist is given: just delete
374 # builddir without reading in SConscripts
376 if 'clean' in B.targets:
379 if not quickie and do_clean:
380 if os.path.exists(B.doc_build_dir):
381 print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
382 dirs = os.listdir(B.doc_build_dir)
384 if os.path.isdir(B.doc_build_dir + entry) == 1:
385 print "clean dir %s"%(B.doc_build_dir+entry)
386 shutil.rmtree(B.doc_build_dir+entry)
388 print "remove file %s"%(B.doc_build_dir+entry)
389 os.remove(B.root_build_dir+entry)
390 if os.path.exists(B.root_build_dir):
391 print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
392 dirs = os.listdir(B.root_build_dir)
394 if os.path.isdir(B.root_build_dir + entry) == 1:
395 print "clean dir %s"%(B.root_build_dir+entry)
396 shutil.rmtree(B.root_build_dir+entry)
398 print "remove file %s"%(B.root_build_dir+entry)
399 os.remove(B.root_build_dir+entry)
400 for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
401 'extern/xvidcore/build/generic/platform.inc', 'extern/ffmpeg/include']:
402 if os.path.exists(confile):
403 print "clean file %s"%confile
404 if os.path.isdir(confile):
405 for root, dirs, files in os.walk(confile):
407 os.remove(os.path.join(root, name))
410 print B.bc.OKGREEN+'...done'+B.bc.ENDC
412 print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
416 # ensure python header is found since detection can fail, this could happen
417 # with _any_ library but since we used a fixed python version this tends to
418 # be most problematic.
419 if env['WITH_BF_PYTHON']:
420 py_h = os.path.join(Dir(env.subst('${BF_PYTHON_INC}')).abspath, "Python.h")
422 if not os.path.exists(py_h):
423 print("\nMissing: \"" + env.subst('${BF_PYTHON_INC}') + os.sep + "Python.h\",\n"
424 " Set 'BF_PYTHON_INC' to point "
425 "to a valid python include path.\n Containing "
426 "Python.h for python version \"" + env.subst('${BF_PYTHON_VERSION}') + "\"")
432 if not os.path.isdir ( B.root_build_dir):
433 os.makedirs ( B.root_build_dir )
434 os.makedirs ( B.root_build_dir + 'source' )
435 os.makedirs ( B.root_build_dir + 'intern' )
436 os.makedirs ( B.root_build_dir + 'extern' )
437 os.makedirs ( B.root_build_dir + 'lib' )
438 os.makedirs ( B.root_build_dir + 'bin' )
439 # # Docs not working with epy anymore
440 # if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']:
441 # os.makedirs ( B.doc_build_dir )
443 Help(opts.GenerateHelpText(env))
445 # default is new quieter output, but if you need to see the
446 # commands, do 'scons BF_QUIET=0'
447 bf_quietoutput = B.arguments.get('BF_QUIET', '1')
449 B.set_quiet_output(env)
454 print B.bc.HEADER+'Building in: ' + B.bc.ENDC + os.path.abspath(B.root_build_dir)
455 env.SConsignFile(B.root_build_dir+'scons-signatures')
458 ##### END SETUP ##########
462 BuildDir(B.root_build_dir+'/source', 'source', duplicate=0)
463 SConscript(B.root_build_dir+'/source/SConscript')
464 BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
465 SConscript(B.root_build_dir+'/intern/SConscript')
466 BuildDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
467 SConscript(B.root_build_dir+'/extern/SConscript')
469 # now that we have read all SConscripts, we know what
470 # libraries will be built. Create list of
471 # libraries to give as objects to linking phase
473 for tp in B.possible_types:
474 if (not tp == 'player') and (not tp == 'player2'):
475 mainlist += B.create_blender_liblist(env, tp)
477 if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
478 B.propose_priorities()
480 dobj = B.buildinfo(env, "dynamic") + B.resources
481 creob = B.creator(env)
482 thestatlibs, thelibincs = B.setup_staticlibs(env)
483 thesyslibs = B.setup_syslibs(env)
485 if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
486 env.BlenderProg(B.root_build_dir, "blender", creob + mainlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
487 if env['WITH_BF_PLAYER']:
488 playerlist = B.create_blender_liblist(env, 'player')
489 playerlist += B.create_blender_liblist(env, 'player2')
490 playerlist += B.create_blender_liblist(env, 'intern')
491 playerlist += B.create_blender_liblist(env, 'extern')
492 env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
494 ##### Now define some targets
497 #------------ INSTALL
501 if env['OURPLATFORM']=='darwin':
502 for prg in B.program_list:
503 bundle = '%s.app' % prg[0]
504 bundledir = os.path.dirname(bundle)
505 for dp, dn, df in os.walk(bundle):
510 dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
511 source=[dp+os.sep+f for f in df]
512 blenderinstall.append(env.Install(dir=dir,source=source))
514 blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
516 #-- local path = config files in install dir: installdir\VERSION
517 #- dont do config and scripts for darwin, it is already in the bundle
520 datafilestargetlist = []
524 if env['OURPLATFORM']!='darwin':
525 dotblenderinstall = []
526 for targetdir,srcfile in zip(dottargetlist, dotblendlist):
527 td, tf = os.path.split(targetdir)
528 dotblenderinstall.append(env.Install(dir=td, source=srcfile))
529 for targetdir,srcfile in zip(datafilestargetlist, datafileslist):
530 td, tf = os.path.split(targetdir)
531 dotblenderinstall.append(env.Install(dir=td, source=srcfile))
533 if env['WITH_BF_PYTHON']:
534 #-- local/VERSION/scripts
535 scriptpaths=['release/scripts']
536 for scriptpath in scriptpaths:
537 for dp, dn, df in os.walk(scriptpath):
542 if '__pycache__' in dn: # py3.2 cache dir
543 dn.remove('__pycache__')
545 # only for testing builds
546 if VERSION_RELEASE_CYCLE == "release" and "addons_contrib" in dn:
547 dn.remove('addons_contrib')
549 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
550 dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):]
552 source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
553 # To ensure empty dirs are created too
555 env.Execute(Mkdir(dir))
556 scriptinstall.append(env.Install(dir=dir,source=source))
557 if env['WITH_BF_CYCLES']:
559 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles')
560 source=os.listdir('intern/cycles/blender/addon')
561 if '.svn' in source: source.remove('.svn')
562 if '_svn' in source: source.remove('_svn')
563 if '__pycache__' in source: source.remove('__pycache__')
564 source=['intern/cycles/blender/addon/'+s for s in source]
565 scriptinstall.append(env.Install(dir=dir,source=source))
568 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel')
569 source=os.listdir('intern/cycles/kernel')
570 if '.svn' in source: source.remove('.svn')
571 if '_svn' in source: source.remove('_svn')
572 if '__pycache__' in source: source.remove('__pycache__')
573 source.remove('kernel.cpp')
574 source.remove('CMakeLists.txt')
577 source=['intern/cycles/kernel/'+s for s in source]
578 source.append('intern/cycles/util/util_color.h')
579 source.append('intern/cycles/util/util_math.h')
580 source.append('intern/cycles/util/util_transform.h')
581 source.append('intern/cycles/util/util_types.h')
582 scriptinstall.append(env.Install(dir=dir,source=source))
584 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'svm')
585 source=os.listdir('intern/cycles/kernel/svm')
586 if '.svn' in source: source.remove('.svn')
587 if '_svn' in source: source.remove('_svn')
588 if '__pycache__' in source: source.remove('__pycache__')
589 source=['intern/cycles/kernel/svm/'+s for s in source]
590 scriptinstall.append(env.Install(dir=dir,source=source))
593 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license')
594 source=os.listdir('intern/cycles/doc/license')
595 if '.svn' in source: source.remove('.svn')
596 if '_svn' in source: source.remove('_svn')
597 if '__pycache__' in source: source.remove('__pycache__')
598 source.remove('CMakeLists.txt')
599 source=['intern/cycles/doc/license/'+s for s in source]
600 scriptinstall.append(env.Install(dir=dir,source=source))
603 if env['WITH_BF_CYCLES_CUDA_BINARIES']:
604 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'lib')
605 for arch in env['BF_CYCLES_CUDA_BINARIES_ARCH']:
606 kernel_build_dir = os.path.join(B.root_build_dir, 'intern/cycles/kernel')
607 cubin_file = os.path.join(kernel_build_dir, "kernel_%s.cubin" % arch)
608 scriptinstall.append(env.Install(dir=dir,source=cubin_file))
610 if env['WITH_BF_INTERNATIONAL']:
611 internationalpaths=['release' + os.sep + 'datafiles']
613 def check_path(path, member):
614 return (member in path.split(os.sep))
616 for intpath in internationalpaths:
617 for dp, dn, df in os.walk(intpath):
623 # we only care about release/datafiles/fonts, release/datafiles/locales
624 if check_path(dp, "fonts") or check_path(dp, "locale"):
629 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
630 dir += os.sep + os.path.basename(intpath) + dp[len(intpath):]
632 source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
633 # To ensure empty dirs are created too
635 env.Execute(Mkdir(dir))
636 scriptinstall.append(env.Install(dir=dir,source=source))
639 if env['OURPLATFORM']=='linux':
643 for tp, tn, tf in os.walk('release/freedesktop/icons'):
649 iconlist.append(os.path.join(tp, f))
650 icontargetlist.append( os.path.join(*([env['BF_INSTALLDIR']] + tp.split(os.sep)[2:] + [f])) )
653 for targetdir,srcfile in zip(icontargetlist, iconlist):
654 td, tf = os.path.split(targetdir)
655 iconinstall.append(env.Install(dir=td, source=srcfile))
657 # dlls for linuxcross
658 # TODO - add more libs, for now this lets blenderlite run
659 if env['OURPLATFORM']=='linuxcross':
660 dir=env['BF_INSTALLDIR']
663 if env['WITH_BF_OPENMP']:
664 source += ['../lib/windows/pthreads/lib/pthreadGC2.dll']
666 scriptinstall.append(env.Install(dir=dir, source=source))
671 for tp, tn, tf in os.walk('release/plugins'):
676 df = tp[8:] # remove 'release/'
678 pluglist.append(os.path.join(tp, f))
679 plugtargetlist.append( os.path.join(env['BF_INSTALLDIR'], VERSION, df, f) )
682 # header files for plugins
683 pluglist.append('source/blender/blenpluginapi/documentation.h')
684 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'documentation.h'))
685 pluglist.append('source/blender/blenpluginapi/externdef.h')
686 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'externdef.h'))
687 pluglist.append('source/blender/blenpluginapi/floatpatch.h')
688 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'floatpatch.h'))
689 pluglist.append('source/blender/blenpluginapi/iff.h')
690 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'iff.h'))
691 pluglist.append('source/blender/blenpluginapi/plugin.h')
692 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'plugin.h'))
693 pluglist.append('source/blender/blenpluginapi/util.h')
694 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'util.h'))
695 pluglist.append('source/blender/blenpluginapi/plugin.DEF')
696 plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'plugin.def'))
699 # plugins in blender 2.5 don't work at the moment.
700 #for targetdir,srcfile in zip(plugtargetlist, pluglist):
701 # td, tf = os.path.split(targetdir)
702 # plugininstall.append(env.Install(dir=td, source=srcfile))
706 for tp, tn, tf in os.walk('release/text'):
712 textlist.append(tp+os.sep+f)
714 textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
716 if env['OURPLATFORM']=='darwin':
717 allinstall = [blenderinstall, plugininstall, textinstall]
718 elif env['OURPLATFORM']=='linux':
719 allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
721 allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
723 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
726 if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
727 # For MinGW and linuxcross static linking will be used
728 dllsources += ['${LCGDIR}/gettext/lib/gnu_gettext.dll']
730 dllsources += ['${BF_ZLIB_LIBPATH}/zlib.dll']
731 # Used when linking to libtiff was dynamic
732 # keep it here until compilation on all platform would be ok
733 # dllsources += ['${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
735 if env['OURPLATFORM'] != 'linuxcross':
736 # pthreads library is already added
737 dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
739 if env['WITH_BF_SDL']:
740 if env['OURPLATFORM'] == 'win64-vc':
741 pass # we link statically already to SDL on win64
743 dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
745 if env['WITH_BF_PYTHON']:
747 dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
749 dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
751 if env['WITH_BF_ICONV']:
752 if env['OURPLATFORM'] == 'win64-vc':
753 pass # we link statically to iconv on win64
754 elif not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
755 #gettext for MinGW and cross-compilation is compiled staticly
756 dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
758 if env['WITH_BF_OPENAL']:
759 dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
761 if env['WITH_BF_SNDFILE']:
762 dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
764 if env['WITH_BF_FFMPEG']:
765 dllsources += env['BF_FFMPEG_DLL'].split()
767 # Since the thumb handler is loaded by Explorer, architecture is
768 # strict: the x86 build fails on x64 Windows. We need to ship
769 # both builds in x86 packages.
771 dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll')
772 dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
774 if env['WITH_BF_OIIO']:
775 dllsources.append('${LCGDIR}/openimageio/bin/OpenImageIO.dll')
777 dllsources.append('#source/icons/blender.exe.manifest')
779 windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
780 allinstall += windlls
782 installtarget = env.Alias('install', allinstall)
783 bininstalltarget = env.Alias('install-bin', blenderinstall)
785 nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
786 nsiscmd = env.Command('nsisinstaller', None, nsisaction)
787 nsisalias = env.Alias('nsis', nsiscmd)
789 if 'blender' in B.targets:
790 blenderexe= env.Alias('blender', B.program_list)
791 Depends(blenderexe,installtarget)
793 if env['WITH_BF_PLAYER']:
794 blenderplayer = env.Alias('blenderplayer', B.program_list)
795 Depends(blenderplayer,installtarget)
797 if not env['WITH_BF_GAMEENGINE']:
798 blendernogame = env.Alias('blendernogame', B.program_list)
799 Depends(blendernogame,installtarget)
801 if 'blenderlite' in B.targets:
802 blenderlite = env.Alias('blenderlite', B.program_list)
803 Depends(blenderlite,installtarget)
805 Depends(nsiscmd, allinstall)
807 buildslave_action = env.Action(btools.buildslave, btools.buildslave_print)
808 buildslave_cmd = env.Command('buildslave_exec', None, buildslave_action)
809 buildslave_alias = env.Alias('buildslave', buildslave_cmd)
811 Depends(buildslave_cmd, allinstall)
813 Default(B.program_list)
815 if not env['WITHOUT_BF_INSTALL']:
816 Default(installtarget)