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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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
44 toolpath=os.path.join(".", "build_files", "scons", "tools")
46 # needed for importing tools
47 sys.path.append(toolpath)
52 EnsureSConsVersion(1,0,0)
54 # Before we do anything, let's check if we have a sane os.environ
55 if not btools.check_environ():
58 BlenderEnvironment = Blender.BlenderEnvironment
61 VERSION = btools.VERSION # This is used in creating the local config directories
62 VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE
65 platform = sys.platform
69 ##### BEGIN SETUP #####
71 B.possible_types = ['core', 'player', 'player2', 'intern', 'extern']
73 B.binarykind = ['blender' , 'blenderplayer']
74 ##################################
75 # target and argument validation #
76 ##################################
77 # XX cheating for BF_FANCY, we check for BF_FANCY before args are validated
78 use_color = ARGUMENTS.get('BF_FANCY', '1')
82 if not use_color=='1':
85 #on defaut white Os X terminal, some colors are totally unlegible
86 if platform=='darwin':
87 B.bc.OKGREEN = '\033[34m'
88 B.bc.WARNING = '\033[36m'
91 print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
92 B.arguments = btools.validate_arguments(ARGUMENTS, B.bc)
93 btools.print_arguments(B.arguments, B.bc)
96 print B.bc.HEADER+'Command-line targets'+B.bc.ENDC
97 B.targets = btools.validate_targets(COMMAND_LINE_TARGETS, B.bc)
98 btools.print_targets(B.targets, B.bc)
100 ##########################
101 # setting up environment #
102 ##########################
104 # handling cmd line arguments & config file
107 tempbitness = int(B.arguments.get('BF_BITNESS', B.bitness)) # default to bitness found as per starting python
108 if tempbitness in B.allowed_bitnesses.values() :
109 B.bitness = tempbitness
111 # first check cmdline for toolset and we create env to work on
112 quickie = B.arguments.get('BF_QUICK', None)
113 quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
116 B.quickdebug=string.split(quickdebug, ',')
121 B.quickie=string.split(quickie,',')
125 toolset = B.arguments.get('BF_TOOLSET', None)
126 vcver = B.arguments.get('MSVS_VERSION', '9.0')
129 print "Using " + toolset
130 if toolset=='mstoolkit':
131 env = BlenderEnvironment(ENV = os.environ)
132 env.Tool('mstoolkit', [toolpath])
134 env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
136 btools.SetupSpawn(env)
138 if B.bitness==64 and platform=='win32':
139 env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64', TARGET_ARCH='x86_64', MSVC_VERSION=vcver)
141 env = BlenderEnvironment(ENV = os.environ, TARGET_ARCH='x86', MSVC_VERSION=vcver)
144 print "Could not create a build environment"
147 cc = B.arguments.get('CC', None)
148 cxx = B.arguments.get('CXX', None)
154 if sys.platform=='win32':
155 if env['CC'] in ['cl', 'cl.exe']:
156 platform = 'win64-vc' if B.bitness == 64 else 'win32-vc'
157 elif env['CC'] in ['gcc']:
158 platform = 'win64-mingw' if B.bitness == 64 else 'win32-mingw'
160 if 'mingw' in platform:
161 print "Setting custom spawn function"
162 btools.SetupSpawn(env)
164 env.SConscriptChdir(0)
166 # Remove major kernel version from linux platform.
167 # After Linus switched kernel to new version model this major version
168 # shouldn't take much sense for building rules.
170 if re.match('linux[0-9]+', platform):
173 crossbuild = B.arguments.get('BF_CROSS', None)
174 if crossbuild and platform not in ('win32-vc', 'win64-vc'):
175 platform = 'linuxcross'
177 env['OURPLATFORM'] = platform
179 configfile = os.path.join("build_files", "scons", "config", platform + "-config.py")
181 if os.path.exists(configfile):
182 print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
184 print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
186 if crossbuild and env['PLATFORM'] != 'win32':
187 print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
188 env.Tool('crossmingw', [toolpath])
189 # todo: determine proper libs/includes etc.
190 # Needed for gui programs, console programs should do without it
192 # Now we don't need this option to have console window
193 # env.Append(LINKFLAGS=['-mwindows'])
195 userconfig = B.arguments.get('BF_CONFIG', 'user-config.py')
196 # first read platform config. B.arguments will override
197 optfiles = [configfile]
198 if os.path.exists(userconfig):
199 print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
200 optfiles += [userconfig]
202 print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
204 opts = btools.read_opts(env, optfiles, B.arguments)
207 if sys.platform=='win32':
209 env.Append(CPPFLAGS=['-DWIN64']) # -DWIN32 needed too, as it's used all over to target Windows generally
211 if not env['BF_FANCY']:
215 # remove install dir so old and new files are not mixed.
216 # NOTE: only do the scripts directory for now, otherwise is too disruptive for developers
217 # TODO: perhaps we need an option (off by default) to not do this altogether...
218 if not env['WITHOUT_BF_INSTALL'] and not env['WITHOUT_BF_OVERWRITE_INSTALL']:
219 scriptsDir = os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts')
220 if os.path.isdir(scriptsDir):
221 print B.bc.OKGREEN + "Clearing installation directory%s: %s" % (B.bc.ENDC, os.path.abspath(scriptsDir))
222 shutil.rmtree(scriptsDir)
225 SetOption('num_jobs', int(env['BF_NUMJOBS']))
226 print B.bc.OKGREEN + "Build with parallel jobs%s: %s" % (B.bc.ENDC, GetOption('num_jobs'))
227 print B.bc.OKGREEN + "Build with debug symbols%s: %s" % (B.bc.ENDC, env['BF_DEBUG'])
229 if 'blenderlite' in B.targets:
231 target_env_defs['WITH_BF_GAMEENGINE'] = False
232 target_env_defs['WITH_BF_CYCLES'] = False
233 target_env_defs['WITH_BF_OPENAL'] = False
234 target_env_defs['WITH_BF_OPENEXR'] = False
235 target_env_defs['WITH_BF_PSD'] = False
236 target_env_defs['WITH_BF_OPENMP'] = False
237 target_env_defs['WITH_BF_ICONV'] = False
238 target_env_defs['WITH_BF_INTERNATIONAL'] = False
239 target_env_defs['WITH_BF_OPENJPEG'] = False
240 target_env_defs['WITH_BF_FFMPEG'] = False
241 target_env_defs['WITH_BF_QUICKTIME'] = False
242 target_env_defs['WITH_BF_REDCODE'] = False
243 target_env_defs['WITH_BF_DDS'] = False
244 target_env_defs['WITH_BF_CINEON'] = False
245 target_env_defs['WITH_BF_FRAMESERVER'] = False
246 target_env_defs['WITH_BF_HDR'] = False
247 target_env_defs['WITH_BF_ZLIB'] = False
248 target_env_defs['WITH_BF_SDL'] = False
249 target_env_defs['WITH_BF_JPEG'] = False
250 target_env_defs['WITH_BF_PNG'] = False
251 target_env_defs['WITH_BF_BULLET'] = False
252 target_env_defs['WITH_BF_BINRELOC'] = False
253 target_env_defs['BF_BUILDINFO'] = False
254 target_env_defs['WITH_BF_FLUID'] = False
255 target_env_defs['WITH_BF_OCEANSIM'] = False
256 target_env_defs['WITH_BF_SMOKE'] = False
257 target_env_defs['WITH_BF_BOOLEAN'] = False
258 target_env_defs['WITH_BF_REMESH'] = False
259 target_env_defs['WITH_BF_PYTHON'] = False
260 target_env_defs['WITH_BF_3DMOUSE'] = False
261 target_env_defs['WITH_BF_LIBMV'] = False
262 target_env_defs['WITH_BF_FREESTYLE'] = 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 if 'cudakernels' in B.targets:
270 env['WITH_BF_CYCLES'] = True
271 env['WITH_BF_CYCLES_CUDA_BINARIES'] = True
272 env['WITH_BF_PYTHON'] = False
274 # Configure paths for automated configuration test programs
275 env['CONFIGUREDIR'] = os.path.abspath(os.path.normpath(os.path.join(env['BF_BUILDDIR'], "sconf_temp")))
276 env['CONFIGURELOG'] = os.path.abspath(os.path.normpath(os.path.join(env['BF_BUILDDIR'], "config.log")))
278 #############################################################################
279 ################### Automatic configuration for OSX ##################
280 #############################################################################
282 if env['OURPLATFORM']=='darwin':
287 command = ["%s"%env['CC'], "--version"]
288 process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None, shell=False)
289 line = process.communicate()[0]
290 ver = re.search(r'[0-9]+(\.[0-9]+[svn]+)+', line) or re.search(r'[0-9]+(\.[0-9]+)+', line) # read the "based on LLVM x.xsvn" version here, not the Apple version
292 env['CCVERSION'] = ver.group(0).strip('svn')
293 frontend = re.search(r'gcc', line) or re.search(r'clang', line) or re.search(r'llvm-gcc', line) or re.search(r'icc', line)
295 env['C_COMPILER_ID'] = frontend.group(0)
297 vendor = re.search(r'Apple', line)
299 C_VENDOR = vendor.group(0)
301 C_VENDOR = 'Open Source'
303 print B.bc.OKGREEN + "Using Compiler: " + B.bc.ENDC + env['C_COMPILER_ID'] + '-' + env['CCVERSION'] + ' ( ' + C_VENDOR + ' )'
305 cmd = 'sw_vers -productVersion'
306 MAC_CUR_VER=cmd_res=commands.getoutput(cmd)
307 cmd = 'xcodebuild -version'
308 cmd_xcode=commands.getoutput(cmd)
309 env['XCODE_CUR_VER']=cmd_xcode[6:][:3] # truncate output to major.minor version
310 cmd = 'xcodebuild -showsdks'
311 cmd_sdk=commands.getoutput(cmd)
312 MACOSX_SDK_CHECK=cmd_sdk
313 cmd = 'xcode-select --print-path'
314 XCODE_SELECT_PATH=commands.getoutput(cmd)
315 if XCODE_SELECT_PATH.endswith("/Contents/Developer"):
316 XCODE_BUNDLE=XCODE_SELECT_PATH[:-19]
318 XCODE_BUNDLE=XCODE_SELECT_PATH
320 print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'] + " --"
321 print B.bc.OKGREEN + "Available SDK's: \n" + B.bc.ENDC + MACOSX_SDK_CHECK.replace('\t', '')
323 if env['MACOSX_SDK'] == '': # no set sdk, choosing best one found
324 if 'OS X 10.9' in MACOSX_SDK_CHECK:
325 env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
326 env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.9.sdk'
327 elif 'OS X 10.8' in MACOSX_SDK_CHECK:
328 env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
329 env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.8.sdk'
330 elif 'OS X 10.7' in MACOSX_SDK_CHECK:
331 env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
332 env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.7.sdk'
333 elif 'OS X 10.6' in MACOSX_SDK_CHECK:
334 env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
335 env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.6.sdk'
336 elif 'OS X 10.5' in MACOSX_SDK_CHECK:
337 env['MACOSX_DEPLOYMENT_TARGET'] = '10.5'
338 env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.5.sdk'
340 env['MACOSX_SDK']='/Developer/SDKs/MacOSX' + env['MACOSX_SDK'] + '.sdk'
342 if env['XCODE_CUR_VER'] >= '4.3': ## since version 4.3, XCode and developer dir are bundled ##
343 env['MACOSX_SDK'] = XCODE_BUNDLE + '/Contents/Developer/Platforms/MacOSX.platform' + env['MACOSX_SDK']
345 print B.bc.OKGREEN + "Using OSX SDK :" + B.bc.ENDC + env['MACOSX_SDK']
347 if not env['WITH_OSX_STATICPYTHON'] == 1:
348 # python 3.3 uses Python-framework additionally installed in /Library/Frameworks
349 env['BF_PYTHON'] = '/Library/Frameworks/Python.framework/Versions/'
350 env['BF_PYTHON_INC'] = env['BF_PYTHON'] + env['BF_PYTHON_VERSION'] + '/include/python' + env['BF_PYTHON_VERSION'] + 'm'
351 env['BF_PYTHON_BINARY'] = env['BF_PYTHON'] + env['BF_PYTHON_VERSION'] + '/bin/python' + env['BF_PYTHON_VERSION']
352 env['BF_PYTHON_LIB'] = ''
353 env['BF_PYTHON_LIBPATH'] = env['BF_PYTHON'] + env['BF_PYTHON_VERSION'] + '/lib/python' + env['BF_PYTHON_VERSION'] + '/config-' + env['BF_PYTHON_VERSION'] +'m'
354 env['PLATFORM_LINKFLAGS'] = env['PLATFORM_LINKFLAGS']+['-framework','Python'] # link to python framework
356 #Ray trace optimization
357 if env['WITH_BF_RAYOPTIMIZATION'] == 1:
358 if env['MACOSX_ARCHITECTURE'] == 'x86_64' or env['MACOSX_ARCHITECTURE'] == 'i386':
359 env['WITH_BF_RAYOPTIMIZATION'] = 1
361 env['WITH_BF_RAYOPTIMIZATION'] = 0
362 if env['MACOSX_ARCHITECTURE'] == 'i386':
363 env['BF_RAYOPTIMIZATION_SSE_FLAGS'] = env['BF_RAYOPTIMIZATION_SSE_FLAGS']+['-msse']
364 elif env['MACOSX_ARCHITECTURE'] == 'x86_64':
365 env['BF_RAYOPTIMIZATION_SSE_FLAGS'] = env['BF_RAYOPTIMIZATION_SSE_FLAGS']+['-msse','-msse2']
367 if env['MACOSX_ARCHITECTURE'] == 'x86_64' or env['MACOSX_ARCHITECTURE'] == 'ppc64':
368 ARCH_FLAGS = ['-m64']
370 ARCH_FLAGS = ['-m32']
372 env.Append(CPPFLAGS=ARCH_FLAGS)
374 SDK_FLAGS=['-isysroot', env['MACOSX_SDK'],'-mmacosx-version-min='+ env['MACOSX_DEPLOYMENT_TARGET'],'-arch',env['MACOSX_ARCHITECTURE']] # always used
375 env['PLATFORM_LINKFLAGS'] = ['-mmacosx-version-min='+ env['MACOSX_DEPLOYMENT_TARGET'],'-isysroot', env['MACOSX_SDK'],'-arch',env['MACOSX_ARCHITECTURE']]+ARCH_FLAGS+env['PLATFORM_LINKFLAGS']
376 env['CCFLAGS']=SDK_FLAGS+env['CCFLAGS']
377 env['CXXFLAGS']=SDK_FLAGS+env['CXXFLAGS']
379 #Intel Macs are CoreDuo and Up
380 if env['MACOSX_ARCHITECTURE'] == 'i386' or env['MACOSX_ARCHITECTURE'] == 'x86_64':
381 env['REL_CCFLAGS'] = env['REL_CCFLAGS']+['-msse','-msse2','-msse3']
382 if env['C_COMPILER_ID'] != 'clang' or (env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.3'):
383 env['REL_CCFLAGS'] = env['REL_CCFLAGS']+['-ftree-vectorize'] # clang xcode 4 does not accept flag
385 env['CCFLAGS'] = env['CCFLAGS']+['-fno-strict-aliasing']
387 # Intel 64bit Macs are Core2Duo and up
388 if env['MACOSX_ARCHITECTURE'] == 'x86_64':
389 env['REL_CCFLAGS'] = env['REL_CCFLAGS']+['-mssse3']
391 if env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.3':
392 env['CCFLAGS'].append('-ftemplate-depth=1024') # only valid for clang bundled with xcode 5
394 # 3DconnexionClient.framework, optionally install
395 if env['WITH_BF_3DMOUSE'] == 1:
396 if not os.path.exists('/Library/Frameworks/3DconnexionClient.framework'):
397 env['WITH_BF_3DMOUSE'] = 0
398 print B.bc.OKGREEN + "3DconnexionClient install not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
400 env.Append(LINKFLAGS=['-F/Library/Frameworks','-Xlinker','-weak_framework','-Xlinker','3DconnexionClient'])
401 env['BF_3DMOUSE_INC'] = '/Library/Frameworks/3DconnexionClient.framework/Headers'
402 print B.bc.OKGREEN + "Using 3Dconnexion"
404 # Jackmp.framework, optionally install
405 if env['WITH_BF_JACK'] == 1:
406 if not os.path.exists('/Library/Frameworks/Jackmp.framework'):
407 env['WITH_BF_JACK'] = 0
408 print B.bc.OKGREEN + "JackOSX install not found, disabling WITH_BF_JACK" # avoid build errors !
410 env.Append(LINKFLAGS=['-F/Library/Frameworks','-Xlinker','-weak_framework','-Xlinker','Jackmp'])
411 print B.bc.OKGREEN + "Using Jack"
413 if env['WITH_BF_QUICKTIME'] == 1:
414 env['PLATFORM_LINKFLAGS'] = env['PLATFORM_LINKFLAGS']+['-framework','QTKit']
416 #Defaults openMP to true if compiler handles it ( only gcc 4.6.1 and newer )
417 # if your compiler does not have accurate suffix you may have to enable it by hand !
418 if env['WITH_BF_OPENMP'] == 1:
419 if env['C_COMPILER_ID'] == 'gcc' and env['CCVERSION'] >= '4.6.1' or env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4' and C_VENDOR != 'Apple':
420 env['WITH_BF_OPENMP'] = 1 # multithreading for fluids, cloth, sculpt and smoke
421 print B.bc.OKGREEN + "Using OpenMP"
422 if env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4':
423 OSX_OMP_LIBPATH = Dir(env.subst(env['LCGDIR'])).abspath
424 env.Append(BF_PROGRAM_LINKFLAGS=['-L'+OSX_OMP_LIBPATH+'/openmp/lib','-liomp5'])
425 env['CCFLAGS'].append('-I'+OSX_OMP_LIBPATH+'/openmp/include') # include for omp.h
427 env['WITH_BF_OPENMP'] = 0
428 print B.bc.OKGREEN + "Disabled OpenMP, not supported by compiler"
430 if env['WITH_BF_CYCLES_OSL'] == 1:
431 OSX_OSL_LIBPATH = Dir(env.subst(env['BF_OSL_LIBPATH'])).abspath
432 # we need 2 variants of passing the oslexec with the force_load option, string and list type atm
433 if env['C_COMPILER_ID'] == 'gcc' and env['CCVERSION'] >= '4.8' or env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4':
434 env.Append(LINKFLAGS=['-L'+OSX_OSL_LIBPATH,'-loslcomp','-loslexec','-loslquery'])
436 env.Append(LINKFLAGS=['-L'+OSX_OSL_LIBPATH,'-loslcomp','-force_load '+ OSX_OSL_LIBPATH +'/liboslexec.a','-loslquery'])
437 env.Append(BF_PROGRAM_LINKFLAGS=['-Xlinker','-force_load','-Xlinker',OSX_OSL_LIBPATH +'/liboslexec.a'])
439 # Trying to get rid of eventually clashes, we export some symbols explicite as local
440 env.Append(LINKFLAGS=['-Xlinker','-unexported_symbols_list','-Xlinker','./source/creator/osx_locals.map'])
442 #for < 10.7.sdk, SystemStubs needs to be linked
443 if env['MACOSX_SDK'].endswith("10.6.sdk") or env['MACOSX_SDK'].endswith("10.5.sdk"):
444 env['LLIBS'].append('SystemStubs')
446 #############################################################################
447 ################### End Automatic configuration for OSX ##################
448 #############################################################################
450 if env['WITH_BF_OPENMP'] == 1:
451 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
452 env['CCFLAGS'].append('/openmp')
454 if env['CC'].endswith('icc'): # to be able to handle CC=/opt/bla/icc case
455 env.Append(LINKFLAGS=['-openmp', '-static-intel'])
456 env['CCFLAGS'].append('-openmp')
458 env.Append(CCFLAGS=['-fopenmp'])
460 #check for additional debug libnames
462 if env.has_key('BF_DEBUG_LIBS'):
463 B.quickdebug += env['BF_DEBUG_LIBS']
465 printdebug = B.arguments.get('BF_LISTDEBUG', 0)
467 if len(B.quickdebug) > 0 and printdebug != 0:
468 print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
469 for l in B.quickdebug:
472 # remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
473 if env['WITH_BF_STATICCXX']:
474 if 'stdc++' in env['LLIBS']:
475 env['LLIBS'].remove('stdc++')
477 print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
479 # check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
480 if 'blenderplayer' in B.targets:
481 env['WITH_BF_PLAYER'] = True
483 if 'blendernogame' in B.targets:
484 env['WITH_BF_GAMEENGINE'] = False
486 if not env['WITH_BF_GAMEENGINE']:
487 env['WITH_BF_PLAYER'] = False
489 # build without elbeem (fluidsim)?
490 if env['WITH_BF_FLUID'] == 1:
491 env['CPPFLAGS'].append('-DWITH_MOD_FLUID')
493 # build with ocean sim?
494 if env['WITH_BF_OCEANSIM'] == 1:
495 env['WITH_BF_FFTW3'] = 1 # ocean needs fftw3 so enable it
496 env['CPPFLAGS'].append('-DWITH_MOD_OCEANSIM')
499 if btools.ENDIAN == "big":
500 env['CPPFLAGS'].append('-D__BIG_ENDIAN__')
502 env['CPPFLAGS'].append('-D__LITTLE_ENDIAN__')
504 # TODO, make optional (as with CMake)
505 env['CPPFLAGS'].append('-DWITH_AUDASPACE')
506 env['CPPFLAGS'].append('-DWITH_AVI')
507 env['CPPFLAGS'].append('-DWITH_OPENNL')
509 if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
510 env['CPPFLAGS'].append('-DHAVE_STDBOOL_H')
512 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
513 B.root_build_dir = env['BF_BUILDDIR']
514 B.doc_build_dir = os.path.join(env['BF_INSTALLDIR'], 'doc')
515 if not B.root_build_dir[-1]==os.sep:
516 B.root_build_dir += os.sep
517 if not B.doc_build_dir[-1]==os.sep:
518 B.doc_build_dir += os.sep
520 # We do a shortcut for clean when no quicklist is given: just delete
521 # builddir without reading in SConscripts
523 if 'clean' in B.targets:
526 if not quickie and do_clean:
527 if os.path.exists(B.doc_build_dir):
528 print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
529 dirs = os.listdir(B.doc_build_dir)
531 if os.path.isdir(B.doc_build_dir + entry) == 1:
532 print "clean dir %s"%(B.doc_build_dir+entry)
533 shutil.rmtree(B.doc_build_dir+entry)
535 print "remove file %s"%(B.doc_build_dir+entry)
536 os.remove(B.root_build_dir+entry)
537 if os.path.exists(B.root_build_dir):
538 print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
539 dirs = os.listdir(B.root_build_dir)
541 if os.path.isdir(B.root_build_dir + entry) == 1:
542 print "clean dir %s"%(B.root_build_dir+entry)
543 shutil.rmtree(B.root_build_dir+entry)
545 print "remove file %s"%(B.root_build_dir+entry)
546 os.remove(B.root_build_dir+entry)
547 for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
548 'extern/xvidcore/build/generic/platform.inc', 'extern/ffmpeg/include']:
549 if os.path.exists(confile):
550 print "clean file %s"%confile
551 if os.path.isdir(confile):
552 for root, dirs, files in os.walk(confile):
554 os.remove(os.path.join(root, name))
557 print B.bc.OKGREEN+'...done'+B.bc.ENDC
559 print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
563 # ensure python header is found since detection can fail, this could happen
564 # with _any_ library but since we used a fixed python version this tends to
565 # be most problematic.
566 if env['WITH_BF_PYTHON']:
567 found_python_h = found_pyconfig_h = False
568 for bf_python_inc in env.subst('${BF_PYTHON_INC}').split():
569 py_h = os.path.join(Dir(bf_python_inc).abspath, "Python.h")
570 if os.path.exists(py_h):
571 found_python_h = True
572 py_h = os.path.join(Dir(bf_python_inc).abspath, "pyconfig.h")
573 if os.path.exists(py_h):
574 found_pyconfig_h = True
576 if not (found_python_h and found_pyconfig_h):
577 print("""\nMissing: Python.h and/or pyconfig.h in "%s"
578 Set 'BF_PYTHON_INC' to point to valid include path(s),
579 containing Python.h and pyconfig.h for Python version "%s".
581 Example: python scons/scons.py BF_PYTHON_INC=../Python/include
582 """ % (env.subst('${BF_PYTHON_INC}'), env.subst('${BF_PYTHON_VERSION}')))
586 if not os.path.isdir ( B.root_build_dir):
587 os.makedirs ( B.root_build_dir )
588 os.makedirs ( B.root_build_dir + 'source' )
589 os.makedirs ( B.root_build_dir + 'intern' )
590 os.makedirs ( B.root_build_dir + 'extern' )
591 os.makedirs ( B.root_build_dir + 'lib' )
592 os.makedirs ( B.root_build_dir + 'bin' )
593 # # Docs not working with epy anymore
594 # if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']:
595 # os.makedirs ( B.doc_build_dir )
597 ###################################
598 # Ensure all data files are valid #
599 ###################################
600 if not os.path.isdir ( B.root_build_dir + 'data_headers'):
601 os.makedirs ( B.root_build_dir + 'data_headers' )
602 if not os.path.isdir ( B.root_build_dir + 'data_sources'):
603 os.makedirs ( B.root_build_dir + 'data_sources' )
605 env['DATA_HEADERS'] = os.path.join(os.path.abspath(env['BF_BUILDDIR']), "data_headers")
606 env['DATA_SOURCES'] = os.path.join(os.path.abspath(env['BF_BUILDDIR']), "data_sources")
607 def data_to_c(FILE_FROM, FILE_TO, VAR_NAME):
609 FILE_FROM = FILE_FROM.replace("/", "\\")
610 FILE_TO = FILE_TO.replace("/", "\\")
612 # first check if we need to bother.
613 if os.path.exists(FILE_TO):
614 if os.path.getmtime(FILE_FROM) < os.path.getmtime(FILE_TO):
617 print(B.bc.HEADER + "Generating: " + B.bc.ENDC + "%r" % os.path.basename(FILE_TO))
618 fpin = open(FILE_FROM, "rb")
619 fpin.seek(0, os.SEEK_END)
623 fpout = open(FILE_TO, "w")
624 fpout.write("int %s_size = %d;\n" % (VAR_NAME, size))
625 fpout.write("char %s[] = {\n" % VAR_NAME)
632 fpout.write("%3d," % ord(fpin.read(1)))
633 fpout.write("\n 0};\n\n")
638 def data_to_c_simple(FILE_FROM):
639 filename_only = os.path.basename(FILE_FROM)
640 FILE_TO = os.path.join(env['DATA_SOURCES'], filename_only + ".c")
641 VAR_NAME = "datatoc_" + filename_only.replace(".", "_")
643 data_to_c(FILE_FROM, FILE_TO, VAR_NAME)
646 def data_to_c_simple_icon(PATH_FROM):
648 # first handle import
650 path = "source/blender/datatoc"
651 if path not in sys.path:
652 sys.path.append(path)
654 # convert the pixmaps to a png
657 filename_only = os.path.basename(PATH_FROM)
658 FILE_TO_PNG = os.path.join(env['DATA_SOURCES'], filename_only + ".png")
659 FILE_TO = FILE_TO_PNG + ".c"
660 argv = [PATH_FROM, FILE_TO_PNG]
661 datatoc_icon.main_ex(argv)
663 # then the png to a c file
664 data_to_c_simple(FILE_TO_PNG)
667 if B.targets != ['cudakernels']:
668 data_to_c("source/blender/compositor/operations/COM_OpenCLKernels.cl",
669 B.root_build_dir + "data_headers/COM_OpenCLKernels.cl.h",
670 "datatoc_COM_OpenCLKernels_cl")
672 data_to_c_simple("release/datafiles/startup.blend")
673 data_to_c_simple("release/datafiles/preview.blend")
674 data_to_c_simple("release/datafiles/preview_cycles.blend")
677 data_to_c_simple("source/blender/gpu/shaders/gpu_shader_simple_frag.glsl")
678 data_to_c_simple("source/blender/gpu/shaders/gpu_shader_simple_vert.glsl")
679 data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
680 data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
681 data_to_c_simple("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_frag.glsl")
682 data_to_c_simple("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_vert.glsl")
683 data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vertex.glsl")
684 data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl")
685 data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl")
686 data_to_c_simple("intern/opencolorio/gpu_shader_display_transform.glsl")
689 data_to_c_simple("release/datafiles/bfont.pfb")
690 data_to_c_simple("release/datafiles/bfont.ttf")
691 data_to_c_simple("release/datafiles/bmonofont.ttf")
693 data_to_c_simple("release/datafiles/splash.png")
694 data_to_c_simple("release/datafiles/splash_2x.png")
696 # data_to_c_simple("release/datafiles/blender_icons16.png")
697 # data_to_c_simple("release/datafiles/blender_icons32.png")
698 data_to_c_simple_icon("release/datafiles/blender_icons16")
699 data_to_c_simple_icon("release/datafiles/blender_icons32")
701 data_to_c_simple("release/datafiles/prvicons.png")
703 data_to_c_simple("release/datafiles/brushicons/add.png")
704 data_to_c_simple("release/datafiles/brushicons/blob.png")
705 data_to_c_simple("release/datafiles/brushicons/blur.png")
706 data_to_c_simple("release/datafiles/brushicons/clay.png")
707 data_to_c_simple("release/datafiles/brushicons/claystrips.png")
708 data_to_c_simple("release/datafiles/brushicons/clone.png")
709 data_to_c_simple("release/datafiles/brushicons/crease.png")
710 data_to_c_simple("release/datafiles/brushicons/darken.png")
711 data_to_c_simple("release/datafiles/brushicons/draw.png")
712 data_to_c_simple("release/datafiles/brushicons/fill.png")
713 data_to_c_simple("release/datafiles/brushicons/flatten.png")
714 data_to_c_simple("release/datafiles/brushicons/grab.png")
715 data_to_c_simple("release/datafiles/brushicons/inflate.png")
716 data_to_c_simple("release/datafiles/brushicons/layer.png")
717 data_to_c_simple("release/datafiles/brushicons/lighten.png")
718 data_to_c_simple("release/datafiles/brushicons/mask.png")
719 data_to_c_simple("release/datafiles/brushicons/mix.png")
720 data_to_c_simple("release/datafiles/brushicons/multiply.png")
721 data_to_c_simple("release/datafiles/brushicons/nudge.png")
722 data_to_c_simple("release/datafiles/brushicons/pinch.png")
723 data_to_c_simple("release/datafiles/brushicons/scrape.png")
724 data_to_c_simple("release/datafiles/brushicons/smear.png")
725 data_to_c_simple("release/datafiles/brushicons/smooth.png")
726 data_to_c_simple("release/datafiles/brushicons/snake_hook.png")
727 data_to_c_simple("release/datafiles/brushicons/soften.png")
728 data_to_c_simple("release/datafiles/brushicons/subtract.png")
729 data_to_c_simple("release/datafiles/brushicons/texdraw.png")
730 data_to_c_simple("release/datafiles/brushicons/thumb.png")
731 data_to_c_simple("release/datafiles/brushicons/twist.png")
732 data_to_c_simple("release/datafiles/brushicons/vertexdraw.png")
734 data_to_c_simple("release/datafiles/matcaps/mc01.jpg")
735 data_to_c_simple("release/datafiles/matcaps/mc02.jpg")
736 data_to_c_simple("release/datafiles/matcaps/mc03.jpg")
737 data_to_c_simple("release/datafiles/matcaps/mc04.jpg")
738 data_to_c_simple("release/datafiles/matcaps/mc05.jpg")
739 data_to_c_simple("release/datafiles/matcaps/mc06.jpg")
740 data_to_c_simple("release/datafiles/matcaps/mc07.jpg")
741 data_to_c_simple("release/datafiles/matcaps/mc08.jpg")
742 data_to_c_simple("release/datafiles/matcaps/mc09.jpg")
743 data_to_c_simple("release/datafiles/matcaps/mc10.jpg")
744 data_to_c_simple("release/datafiles/matcaps/mc11.jpg")
745 data_to_c_simple("release/datafiles/matcaps/mc12.jpg")
746 data_to_c_simple("release/datafiles/matcaps/mc13.jpg")
747 data_to_c_simple("release/datafiles/matcaps/mc14.jpg")
748 data_to_c_simple("release/datafiles/matcaps/mc15.jpg")
749 data_to_c_simple("release/datafiles/matcaps/mc16.jpg")
750 data_to_c_simple("release/datafiles/matcaps/mc17.jpg")
751 data_to_c_simple("release/datafiles/matcaps/mc18.jpg")
752 data_to_c_simple("release/datafiles/matcaps/mc19.jpg")
753 data_to_c_simple("release/datafiles/matcaps/mc20.jpg")
754 data_to_c_simple("release/datafiles/matcaps/mc21.jpg")
755 data_to_c_simple("release/datafiles/matcaps/mc22.jpg")
756 data_to_c_simple("release/datafiles/matcaps/mc23.jpg")
757 data_to_c_simple("release/datafiles/matcaps/mc24.jpg")
759 ##### END DATAFILES ##########
761 Help(opts.GenerateHelpText(env))
763 # default is new quieter output, but if you need to see the
764 # commands, do 'scons BF_QUIET=0'
765 bf_quietoutput = B.arguments.get('BF_QUIET', '1')
767 B.set_quiet_output(env)
772 print B.bc.HEADER+'Building in: ' + B.bc.ENDC + os.path.abspath(B.root_build_dir)
773 env.SConsignFile(B.root_build_dir+'scons-signatures')
776 ##### END SETUP ##########
780 VariantDir(B.root_build_dir+'/source', 'source', duplicate=0)
781 SConscript(B.root_build_dir+'/source/SConscript')
782 VariantDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
783 SConscript(B.root_build_dir+'/intern/SConscript')
784 VariantDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
785 SConscript(B.root_build_dir+'/extern/SConscript')
787 # now that we have read all SConscripts, we know what
788 # libraries will be built. Create list of
789 # libraries to give as objects to linking phase
791 for tp in B.possible_types:
792 if (not tp == 'player') and (not tp == 'player2'):
793 mainlist += B.create_blender_liblist(env, tp)
795 if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
796 B.propose_priorities()
798 dobj = B.buildinfo(env, "dynamic") + B.resources
799 creob = B.creator(env)
800 thestatlibs, thelibincs = B.setup_staticlibs(env)
801 thesyslibs = B.setup_syslibs(env)
803 if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
804 env.BlenderProg(B.root_build_dir, "blender", creob + mainlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
805 if env['WITH_BF_PLAYER']:
806 playerlist = B.create_blender_liblist(env, 'player')
807 playerlist += B.create_blender_liblist(env, 'player2')
808 playerlist += B.create_blender_liblist(env, 'intern')
809 playerlist += B.create_blender_liblist(env, 'extern')
810 env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
812 ##### Now define some targets
815 #------------ INSTALL
819 if env['OURPLATFORM']=='darwin':
820 for prg in B.program_list:
821 bundle = '%s.app' % prg[0]
822 bundledir = os.path.dirname(bundle)
823 for dp, dn, df in os.walk(bundle):
830 dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
831 source=[dp+os.sep+f for f in df]
832 blenderinstall.append(env.Install(dir=dir,source=source))
834 blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
836 #-- local path = config files in install dir: installdir\VERSION
837 #- dont do config and scripts for darwin, it is already in the bundle
840 datafilestargetlist = []
845 if env['OURPLATFORM']!='darwin':
846 dotblenderinstall = []
847 for targetdir,srcfile in zip(dottargetlist, dotblendlist):
848 td, tf = os.path.split(targetdir)
849 dotblenderinstall.append(env.Install(dir=td, source=srcfile))
850 for targetdir,srcfile in zip(datafilestargetlist, datafileslist):
851 td, tf = os.path.split(targetdir)
852 dotblenderinstall.append(env.Install(dir=td, source=srcfile))
854 if env['WITH_BF_PYTHON']:
855 #-- local/VERSION/scripts
856 scriptpaths=['release/scripts']
857 for scriptpath in scriptpaths:
858 for dp, dn, df in os.walk(scriptpath):
861 if '__pycache__' in dn: # py3.2 cache dir
862 dn.remove('__pycache__')
864 # only for testing builds
865 if VERSION_RELEASE_CYCLE == "release" and "addons_contrib" in dn:
866 dn.remove('addons_contrib')
868 # do not install freestyle if disabled
869 if not env['WITH_BF_FREESTYLE'] and "freestyle" in dn:
870 dn.remove("freestyle")
872 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
873 dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):]
875 source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
876 # To ensure empty dirs are created too
877 if len(source)==0 and not os.path.exists(dir):
878 env.Execute(Mkdir(dir))
879 scriptinstall.append(env.Install(dir=dir,source=source))
880 if env['WITH_BF_CYCLES']:
882 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles')
883 source=os.listdir('intern/cycles/blender/addon')
884 if '__pycache__' in source: source.remove('__pycache__')
885 source=['intern/cycles/blender/addon/'+s for s in source]
886 scriptinstall.append(env.Install(dir=dir,source=source))
889 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel')
890 source=os.listdir('intern/cycles/kernel')
891 if '__pycache__' in source: source.remove('__pycache__')
892 source.remove('kernel.cpp')
893 source.remove('CMakeLists.txt')
895 source.remove('closure')
896 source.remove('geom')
897 source.remove('shaders')
899 source=['intern/cycles/kernel/'+s for s in source]
900 source.append('intern/cycles/util/util_color.h')
901 source.append('intern/cycles/util/util_half.h')
902 source.append('intern/cycles/util/util_math.h')
903 source.append('intern/cycles/util/util_transform.h')
904 source.append('intern/cycles/util/util_types.h')
905 scriptinstall.append(env.Install(dir=dir,source=source))
907 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'svm')
908 source=os.listdir('intern/cycles/kernel/svm')
909 if '__pycache__' in source: source.remove('__pycache__')
910 source=['intern/cycles/kernel/svm/'+s for s in source]
911 scriptinstall.append(env.Install(dir=dir,source=source))
913 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'closure')
914 source=os.listdir('intern/cycles/kernel/closure')
915 if '__pycache__' in source: source.remove('__pycache__')
916 source=['intern/cycles/kernel/closure/'+s for s in source]
917 scriptinstall.append(env.Install(dir=dir,source=source))
919 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'geom')
920 source=os.listdir('intern/cycles/kernel/geom')
921 if '__pycache__' in source: source.remove('__pycache__')
922 source=['intern/cycles/kernel/geom/'+s for s in source]
923 scriptinstall.append(env.Install(dir=dir,source=source))
926 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license')
927 source=os.listdir('intern/cycles/doc/license')
928 if '__pycache__' in source: source.remove('__pycache__')
929 source.remove('CMakeLists.txt')
930 source=['intern/cycles/doc/license/'+s for s in source]
931 scriptinstall.append(env.Install(dir=dir,source=source))
933 if env['WITH_BF_CYCLES']:
935 if env['WITH_BF_CYCLES_CUDA_BINARIES']:
936 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'lib')
937 for arch in env['BF_CYCLES_CUDA_BINARIES_ARCH']:
938 kernel_build_dir = os.path.join(B.root_build_dir, 'intern/cycles/kernel')
939 cubin_file = os.path.join(kernel_build_dir, "kernel_%s.cubin" % arch)
940 cubininstall.append(env.Install(dir=dir,source=cubin_file))
943 if env['WITH_BF_CYCLES_OSL']:
944 dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'shader')
946 osl_source_dir = Dir('./intern/cycles/kernel/shaders').srcnode().path
947 oso_build_dir = os.path.join(B.root_build_dir, 'intern/cycles/kernel/shaders')
949 headers='node_color.h node_fresnel.h node_texture.h oslutil.h stdosl.h'.split()
950 source=['intern/cycles/kernel/shaders/'+s for s in headers]
951 scriptinstall.append(env.Install(dir=dir,source=source))
953 for f in os.listdir(osl_source_dir):
954 if f.endswith('.osl'):
955 oso_file = os.path.join(oso_build_dir, f.replace('.osl', '.oso'))
956 scriptinstall.append(env.Install(dir=dir,source=oso_file))
958 if env['WITH_BF_OCIO']:
959 colormanagement = os.path.join('release', 'datafiles', 'colormanagement')
961 for dp, dn, df in os.walk(colormanagement):
962 dir = os.path.join(env['BF_INSTALLDIR'], VERSION, 'datafiles')
963 dir += os.sep + os.path.basename(colormanagement) + dp[len(colormanagement):]
965 source = [os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
967 # To ensure empty dirs are created too
969 env.Execute(Mkdir(dir))
971 scriptinstall.append(env.Install(dir=dir,source=source))
973 if env['WITH_BF_INTERNATIONAL']:
974 internationalpaths=['release' + os.sep + 'datafiles']
976 def check_path(path, member):
977 return (member in path.split(os.sep))
979 po_dir = os.path.join("release", "datafiles", "locale", "po")
982 for intpath in internationalpaths:
983 for dp, dn, df in os.walk(intpath):
987 # we only care about release/datafiles/fonts, release/datafiles/locales
988 if check_path(dp, "fonts"):
993 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
994 dir += os.sep + os.path.basename(intpath) + dp[len(intpath):]
996 source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
997 # To ensure empty dirs are created too
999 env.Execute(Mkdir(dir))
1000 scriptinstall.append(env.Install(dir=dir,source=source))
1003 for f in os.listdir(po_dir):
1004 if not f.endswith(".po"):
1007 locale_name = os.path.splitext(f)[0]
1009 mo_file = os.path.join(B.root_build_dir, "locale", locale_name + ".mo")
1011 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
1012 dir = os.path.join(dir, "datafiles", "locale", locale_name, "LC_MESSAGES")
1013 scriptinstall.append(env.InstallAs(os.path.join(dir, "blender.mo"), mo_file))
1016 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
1017 dir = os.path.join(dir, "datafiles", "locale")
1018 languages_file = os.path.join("release", "datafiles", "locale", "languages")
1019 scriptinstall.append(env.InstallAs(os.path.join(dir, "languages"), languages_file))
1022 if env['OURPLATFORM']=='linux':
1026 for tp, tn, tf in os.walk('release/freedesktop/icons'):
1028 iconlist.append(os.path.join(tp, f))
1029 icontargetlist.append( os.path.join(*([env['BF_INSTALLDIR']] + tp.split(os.sep)[2:] + [f])) )
1032 for targetdir,srcfile in zip(icontargetlist, iconlist):
1033 td, tf = os.path.split(targetdir)
1034 iconinstall.append(env.Install(dir=td, source=srcfile))
1036 scriptinstall.append(env.Install(dir=env['BF_INSTALLDIR'], source='release/bin/blender-thumbnailer.py'))
1038 # dlls for linuxcross
1039 # TODO - add more libs, for now this lets blenderlite run
1040 if env['OURPLATFORM']=='linuxcross':
1041 dir=env['BF_INSTALLDIR']
1044 if env['WITH_BF_OPENMP']:
1045 source += ['../lib/windows/pthreads/lib/pthreadGC2.dll']
1047 scriptinstall.append(env.Install(dir=dir, source=source))
1051 for tp, tn, tf in os.walk('release/text'):
1053 textlist.append(tp+os.sep+f)
1056 textlist.append('release/datafiles/LICENSE-bfont.ttf.txt')
1057 if env['WITH_BF_INTERNATIONAL']:
1058 textlist += ['release/datafiles/LICENSE-droidsans.ttf.txt', 'release/datafiles/LICENSE-bmonofont-i18n.ttf.txt']
1060 textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
1062 if env['OURPLATFORM']=='darwin':
1063 allinstall = [blenderinstall, textinstall]
1064 elif env['OURPLATFORM']=='linux':
1065 allinstall = [blenderinstall, dotblenderinstall, scriptinstall, textinstall, iconinstall, cubininstall]
1067 allinstall = [blenderinstall, dotblenderinstall, scriptinstall, textinstall, cubininstall]
1069 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
1072 # Used when linking to libtiff was dynamic
1073 # keep it here until compilation on all platform would be ok
1074 # dllsources += ['${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
1076 if env['OURPLATFORM'] != 'linuxcross':
1077 # pthreads library is already added
1078 dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
1080 if env['WITH_BF_SDL']:
1081 if env['OURPLATFORM'] == 'win64-vc':
1082 pass # we link statically already to SDL on win64
1084 dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
1086 if env['WITH_BF_PYTHON']:
1088 dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
1090 dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
1092 if env['WITH_BF_ICONV']:
1093 if env['OURPLATFORM'] == 'win64-vc':
1094 pass # we link statically to iconv on win64
1095 elif not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
1096 #gettext for MinGW and cross-compilation is compiled staticly
1097 dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
1099 if env['WITH_BF_OPENAL']:
1100 dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
1101 dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
1103 if env['WITH_BF_SNDFILE']:
1104 dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
1106 if env['WITH_BF_FFMPEG']:
1107 dllsources += env['BF_FFMPEG_DLL'].split()
1109 # Since the thumb handler is loaded by Explorer, architecture is
1110 # strict: the x86 build fails on x64 Windows. We need to ship
1111 # both builds in x86 packages.
1113 dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll')
1114 dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
1116 if env['WITH_BF_OCIO']:
1117 if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
1118 dllsources.append('${LCGDIR}/opencolorio/bin/OpenColorIO.dll')
1121 dllsources.append('${LCGDIR}/opencolorio/bin/libOpenColorIO.dll')
1123 dllsources.append('#source/icons/blender.exe.manifest')
1125 windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
1126 allinstall += windlls
1128 if env['OURPLATFORM'] == 'win64-mingw':
1131 if env['WITH_BF_PYTHON']:
1133 dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
1135 dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
1137 if env['WITH_BF_FFMPEG']:
1138 dllsources += env['BF_FFMPEG_DLL'].split()
1140 if env['WITH_BF_OPENAL']:
1141 dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
1142 dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
1144 if env['WITH_BF_SNDFILE']:
1145 dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
1147 if env['WITH_BF_SDL']:
1148 dllsources.append('${LCGDIR}/sdl/lib/SDL.dll')
1150 if(env['WITH_BF_OPENMP']):
1151 dllsources.append('${LCGDIR}/binaries/libgomp-1.dll')
1153 if env['WITH_BF_OCIO']:
1154 dllsources.append('${LCGDIR}/opencolorio/bin/libOpenColorIO.dll')
1156 dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
1157 dllsources.append('${LCGDIR}/binaries/libgcc_s_sjlj-1.dll')
1158 dllsources.append('${LCGDIR}/binaries/libwinpthread-1.dll')
1159 dllsources.append('${LCGDIR}/binaries/libstdc++-6.dll')
1160 dllsources.append('#source/icons/blender.exe.manifest')
1162 windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
1163 allinstall += windlls
1165 installtarget = env.Alias('install', allinstall)
1166 bininstalltarget = env.Alias('install-bin', blenderinstall)
1168 nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
1169 nsiscmd = env.Command('nsisinstaller', None, nsisaction)
1170 nsisalias = env.Alias('nsis', nsiscmd)
1172 if 'blender' in B.targets:
1173 blenderexe= env.Alias('blender', B.program_list)
1174 Depends(blenderexe,installtarget)
1176 if env['WITH_BF_PLAYER']:
1177 blenderplayer = env.Alias('blenderplayer', B.program_list)
1178 Depends(blenderplayer,installtarget)
1180 if not env['WITH_BF_GAMEENGINE']:
1181 blendernogame = env.Alias('blendernogame', B.program_list)
1182 Depends(blendernogame,installtarget)
1184 if 'blenderlite' in B.targets:
1185 blenderlite = env.Alias('blenderlite', B.program_list)
1186 Depends(blenderlite,installtarget)
1188 Depends(nsiscmd, allinstall)
1190 buildslave_action = env.Action(btools.buildslave, btools.buildslave_print)
1191 buildslave_cmd = env.Command('buildslave_exec', None, buildslave_action)
1192 buildslave_alias = env.Alias('buildslave', buildslave_cmd)
1194 Depends(buildslave_cmd, allinstall)
1196 cudakernels_action = env.Action(btools.cudakernels, btools.cudakernels_print)
1197 cudakernels_cmd = env.Command('cudakernels_exec', None, cudakernels_action)
1198 cudakernels_alias = env.Alias('cudakernels', cudakernels_cmd)
1200 cudakernel_dir = os.path.join(os.path.abspath(os.path.normpath(B.root_build_dir)), 'intern/cycles/kernel')
1203 for x in env['BF_CYCLES_CUDA_BINARIES_ARCH']:
1204 cubin = os.path.join(cudakernel_dir, 'kernel_' + x + '.cubin')
1205 cuda_kernels.append(cubin)
1207 Depends(cudakernels_cmd, cuda_kernels)
1208 Depends(cudakernels_cmd, cubininstall)
1210 Default(B.program_list)
1212 if not env['WITHOUT_BF_INSTALL']:
1213 Default(installtarget)