Merged revision(s) 58452-58584 from trunk/blender into soc-2013-dingto.
[blender.git] / SConstruct
1 #!/usr/bin/env python
2 #
3 # ***** BEGIN GPL LICENSE BLOCK *****
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #
19 # The Original Code is Copyright (C) 2006, Blender Foundation
20 # All rights reserved.
21 #
22 # The Original Code is: all of this file.
23 #
24 # Contributor(s): Nathan Letwory.
25 #
26 # ***** END GPL LICENSE BLOCK *****
27 #
28 # Main entry-point for the SCons building system
29 # Set up some custom actions and target/argument handling
30 # Then read all SConscripts and build
31 #
32 # 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
35
36 import platform as pltfrm
37
38 # Need a better way to do this. Automagical maybe is not the best thing, maybe it is.
39 if pltfrm.architecture()[0] == '64bit':
40     bitness = 64
41 else:
42     bitness = 32
43
44 import sys
45 import os
46 import os.path
47 import string
48 import shutil
49 import re
50
51 # store path to tools
52 toolpath=os.path.join(".", "build_files", "scons", "tools")
53
54 # needed for importing tools
55 sys.path.append(toolpath)
56
57 import Blender
58 import btools
59
60 EnsureSConsVersion(1,0,0)
61
62 # Before we do anything, let's check if we have a sane os.environ
63 if not btools.check_environ():
64     Exit()
65
66 BlenderEnvironment = Blender.BlenderEnvironment
67 B = Blender
68
69 VERSION = btools.VERSION # This is used in creating the local config directories
70 VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE
71
72 ### globals ###
73 platform = sys.platform
74 quickie = None
75 quickdebug = None
76
77 ##### BEGIN SETUP #####
78
79 B.possible_types = ['core', 'player', 'player2', 'intern', 'extern']
80
81 B.binarykind = ['blender' , 'blenderplayer']
82 ##################################
83 # target and argument validation #
84 ##################################
85 # XX cheating for BF_FANCY, we check for BF_FANCY before args are validated
86 use_color = ARGUMENTS.get('BF_FANCY', '1')
87 if platform=='win32':
88     use_color = None
89
90 if not use_color=='1':
91     B.bc.disable()
92
93  #on defaut white Os X terminal, some colors are totally unlegible
94 if platform=='darwin':
95     B.bc.OKGREEN = '\033[34m'
96     B.bc.WARNING = '\033[36m'
97
98 # arguments
99 print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
100 B.arguments = btools.validate_arguments(ARGUMENTS, B.bc)
101 btools.print_arguments(B.arguments, B.bc)
102
103 # targets
104 print B.bc.HEADER+'Command-line targets'+B.bc.ENDC
105 B.targets = btools.validate_targets(COMMAND_LINE_TARGETS, B.bc)
106 btools.print_targets(B.targets, B.bc)
107
108 ##########################
109 # setting up environment #
110 ##########################
111
112 # handling cmd line arguments & config file
113
114 # bitness stuff
115 tempbitness = int(B.arguments.get('BF_BITNESS', bitness)) # default to bitness found as per starting python
116 if tempbitness in (32, 64): # only set if 32 or 64 has been given
117     bitness = int(tempbitness)
118
119 if bitness:
120     B.bitness = bitness
121 else:
122     B.bitness = tempbitness
123
124
125 # first check cmdline for toolset and we create env to work on
126 quickie = B.arguments.get('BF_QUICK', None)
127 quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
128
129 if quickdebug:
130     B.quickdebug=string.split(quickdebug, ',')
131 else:
132     B.quickdebug=[]
133
134 if quickie:
135     B.quickie=string.split(quickie,',')
136 else:
137     B.quickie=[]
138
139 toolset = B.arguments.get('BF_TOOLSET', None)
140 vcver = B.arguments.get('MSVS_VERSION', '9.0')
141
142 if toolset:
143     print "Using " + toolset
144     if toolset=='mstoolkit':
145         env = BlenderEnvironment(ENV = os.environ)
146         env.Tool('mstoolkit', [toolpath])
147     else:
148         env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
149         if env:
150             btools.SetupSpawn(env)
151 else:
152     if bitness==64 and platform=='win32':
153         env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64', TARGET_ARCH='x86_64', MSVC_VERSION=vcver)
154     else:
155         env = BlenderEnvironment(ENV = os.environ, TARGET_ARCH='x86', MSVC_VERSION=vcver)
156
157 if not env:
158     print "Could not create a build environment"
159     Exit()
160
161 cc = B.arguments.get('CC', None)
162 cxx = B.arguments.get('CXX', None)
163 if cc:
164     env['CC'] = cc
165 if cxx:
166     env['CXX'] = cxx
167
168 if sys.platform=='win32':
169     if env['CC'] in ['cl', 'cl.exe']:
170         platform = 'win64-vc' if bitness == 64 else 'win32-vc'
171     elif env['CC'] in ['gcc']:
172         platform = 'win64-mingw' if bitness == 64 else 'win32-mingw'
173
174 if 'mingw' in platform:
175     print "Setting custom spawn function"
176     btools.SetupSpawn(env)
177
178 env.SConscriptChdir(0)
179
180 # Remove major kernel version from linux platform.
181 # After Linus switched kernel to new version model this major version
182 # shouldn't take much sense for building rules.
183
184 if re.match('linux[0-9]+', platform):
185     platform = 'linux'
186
187 crossbuild = B.arguments.get('BF_CROSS', None)
188 if crossbuild and platform not in ('win32-vc', 'win64-vc'):
189     platform = 'linuxcross'
190
191 env['OURPLATFORM'] = platform
192
193 configfile = os.path.join("build_files", "scons", "config", platform + "-config.py")
194
195 if os.path.exists(configfile):
196     print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
197 else:
198     print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
199
200 if crossbuild and env['PLATFORM'] != 'win32':
201     print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
202     env.Tool('crossmingw', [toolpath])
203     # todo: determine proper libs/includes etc.
204     # Needed for gui programs, console programs should do without it
205
206     # Now we don't need this option to have console window
207     # env.Append(LINKFLAGS=['-mwindows'])
208
209 userconfig = B.arguments.get('BF_CONFIG', 'user-config.py')
210 # first read platform config. B.arguments will override
211 optfiles = [configfile]
212 if os.path.exists(userconfig):
213     print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
214     optfiles += [userconfig]
215 else:
216     print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
217
218 opts = btools.read_opts(env, optfiles, B.arguments)
219 opts.Update(env)
220
221 if sys.platform=='win32':
222     if bitness==64:
223         env.Append(CPPFLAGS=['-DWIN64']) # -DWIN32 needed too, as it's used all over to target Windows generally
224
225 if not env['BF_FANCY']:
226     B.bc.disable()
227
228
229 # remove install dir so old and new files are not mixed.
230 # NOTE: only do the scripts directory for now, otherwise is too disruptive for developers
231 # TODO: perhaps we need an option (off by default) to not do this altogether...
232 if not env['WITHOUT_BF_INSTALL'] and not env['WITHOUT_BF_OVERWRITE_INSTALL']:
233     scriptsDir = os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts')
234     if os.path.isdir(scriptsDir):
235         print B.bc.OKGREEN + "Clearing installation directory%s: %s" % (B.bc.ENDC, os.path.abspath(scriptsDir))
236         shutil.rmtree(scriptsDir)
237
238
239 SetOption('num_jobs', int(env['BF_NUMJOBS']))
240 print B.bc.OKGREEN + "Build with parallel jobs%s: %s" % (B.bc.ENDC, GetOption('num_jobs'))
241 print B.bc.OKGREEN + "Build with debug symbols%s: %s" % (B.bc.ENDC, env['BF_DEBUG'])
242
243 if 'blenderlite' in B.targets:
244     target_env_defs = {}
245     target_env_defs['WITH_BF_GAMEENGINE'] = False
246     target_env_defs['WITH_BF_CYCLES'] = False
247     target_env_defs['WITH_BF_OPENAL'] = False
248     target_env_defs['WITH_BF_OPENEXR'] = False
249     target_env_defs['WITH_BF_OPENMP'] = False
250     target_env_defs['WITH_BF_ICONV'] = False
251     target_env_defs['WITH_BF_INTERNATIONAL'] = False
252     target_env_defs['WITH_BF_OPENJPEG'] = False
253     target_env_defs['WITH_BF_FFMPEG'] = False
254     target_env_defs['WITH_BF_QUICKTIME'] = False
255     target_env_defs['WITH_BF_REDCODE'] = False
256     target_env_defs['WITH_BF_DDS'] = False
257     target_env_defs['WITH_BF_CINEON'] = False
258     target_env_defs['WITH_BF_FRAMESERVER'] = False
259     target_env_defs['WITH_BF_HDR'] = False
260     target_env_defs['WITH_BF_ZLIB'] = False
261     target_env_defs['WITH_BF_SDL'] = False
262     target_env_defs['WITH_BF_JPEG'] = False
263     target_env_defs['WITH_BF_PNG'] = False
264     target_env_defs['WITH_BF_BULLET'] = False
265     target_env_defs['WITH_BF_BINRELOC'] = False
266     target_env_defs['BF_BUILDINFO'] = False
267     target_env_defs['WITH_BF_FLUID'] = False
268     target_env_defs['WITH_BF_OCEANSIM'] = False
269     target_env_defs['WITH_BF_SMOKE'] = False
270     target_env_defs['WITH_BF_BOOLEAN'] = False
271     target_env_defs['WITH_BF_REMESH'] = False
272     target_env_defs['WITH_BF_PYTHON'] = False
273     target_env_defs['WITH_BF_3DMOUSE'] = False
274     target_env_defs['WITH_BF_LIBMV'] = False
275     target_env_defs['WITH_BF_FREESTYLE'] = False
276
277     # Merge blenderlite, let command line to override
278     for k,v in target_env_defs.iteritems():
279         if k not in B.arguments:
280             env[k] = v
281
282 if 'cudakernels' in B.targets:
283     env['WITH_BF_CYCLES'] = True
284     env['WITH_BF_CYCLES_CUDA_BINARIES'] = True
285     env['WITH_BF_PYTHON'] = False
286
287 # Extended OSX_SDK and 3D_CONNEXION_CLIENT_LIBRARY and JAckOSX detection for OSX
288 if env['OURPLATFORM']=='darwin':
289     print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'] + " --"
290     print "Available " + env['MACOSX_SDK_CHECK']
291     if not 'Mac OS X 10.6' in env['MACOSX_SDK_CHECK']:
292         print  B.bc.OKGREEN + "Auto-setting available MacOSX SDK -> " + B.bc.ENDC + "MacOSX10.7.sdk"
293     elif not 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']:
294         print  B.bc.OKGREEN + "Auto-setting available MacOSX SDK -> " + B.bc.ENDC + "MacOSX10.6.sdk"
295     else:
296         print B.bc.OKGREEN + "Found recommended sdk :" + B.bc.ENDC + " using MacOSX10.5.sdk"
297
298     # for now, Mac builders must download and install the 3DxWare 10 Beta 4 driver framework from 3Dconnexion
299     # necessary header file lives here when installed:
300     # /Library/Frameworks/3DconnexionClient.framework/Versions/Current/Headers/ConnexionClientAPI.h
301     if env['WITH_BF_3DMOUSE'] == 1:
302         if not os.path.exists('/Library/Frameworks/3DconnexionClient.framework'):
303             print "3D_CONNEXION_CLIENT_LIBRARY not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
304             env['WITH_BF_3DMOUSE'] = 0
305         else:
306             env.Append(LINKFLAGS=['-F/Library/Frameworks','-Xlinker','-weak_framework','-Xlinker','3DconnexionClient'])
307             env['BF_3DMOUSE_INC'] = '/Library/Frameworks/3DconnexionClient.framework/Headers'
308
309     # for now, Mac builders must download and install the JackOSX framework
310     # necessary header file lives here when installed:
311     # /Library/Frameworks/Jackmp.framework/Versions/A/Headers/jack.h
312     if env['WITH_BF_JACK'] == 1:
313         if not os.path.exists('/Library/Frameworks/Jackmp.framework'):
314             print "JackOSX install not found, disabling WITH_BF_JACK" # avoid build errors !
315             env['WITH_BF_JACK'] = 0
316         else:
317             env.Append(LINKFLAGS=['-L/Library/Frameworks','-Xlinker','-weak_framework','-Xlinker','Jackmp'])
318
319     if env['WITH_BF_CYCLES_OSL'] == 1:
320         OSX_OSL_LIBPATH = Dir(env.subst(env['BF_OSL_LIBPATH'])).abspath
321         # we need 2 variants of passing the oslexec with the force_load option, string and list type atm
322         env.Append(LINKFLAGS=['-L'+OSX_OSL_LIBPATH,'-loslcomp','-force_load '+ OSX_OSL_LIBPATH +'/liboslexec.a','-loslquery'])
323         env.Append(BF_PROGRAM_LINKFLAGS=['-Xlinker','-force_load','-Xlinker',OSX_OSL_LIBPATH +'/liboslexec.a'])
324
325     # Trying to get rid of eventually clashes, we export some explicite as local symbols
326     env.Append(LINKFLAGS=['-Xlinker','-unexported_symbols_list','-Xlinker','./source/creator/osx_locals.map'])
327
328 if env['WITH_BF_OPENMP'] == 1:
329         if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
330                 env['CCFLAGS'].append('/openmp')
331         else:
332             if env['CC'].endswith('icc'): # to be able to handle CC=/opt/bla/icc case
333                 env.Append(LINKFLAGS=['-openmp', '-static-intel'])
334                 env['CCFLAGS'].append('-openmp')
335             else:
336                 env.Append(CCFLAGS=['-fopenmp'])
337
338 if env['WITH_GHOST_COCOA'] == True:
339     env.Append(CPPFLAGS=['-DGHOST_COCOA'])
340
341 if env['USE_QTKIT'] == True:
342     env.Append(CPPFLAGS=['-DUSE_QTKIT'])
343
344 #check for additional debug libnames
345
346 if env.has_key('BF_DEBUG_LIBS'):
347     B.quickdebug += env['BF_DEBUG_LIBS']
348
349 printdebug = B.arguments.get('BF_LISTDEBUG', 0)
350
351 if len(B.quickdebug) > 0 and printdebug != 0:
352     print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
353     for l in B.quickdebug:
354         print "\t" + l
355
356 # remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
357 if env['WITH_BF_STATICCXX']:
358     if 'stdc++' in env['LLIBS']:
359         env['LLIBS'].remove('stdc++')
360     else:
361         print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
362
363 # check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
364 if 'blenderplayer' in B.targets:
365     env['WITH_BF_PLAYER'] = True
366
367 if 'blendernogame' in B.targets:
368     env['WITH_BF_GAMEENGINE'] = False
369
370 # build without elbeem (fluidsim)?
371 if env['WITH_BF_FLUID'] == 1:
372     env['CPPFLAGS'].append('-DWITH_MOD_FLUID')
373
374 # build with ocean sim?
375 if env['WITH_BF_OCEANSIM'] == 1:
376     env['WITH_BF_FFTW3']  = 1  # ocean needs fftw3 so enable it
377     env['CPPFLAGS'].append('-DWITH_MOD_OCEANSIM')
378
379
380 if btools.ENDIAN == "big":
381     env['CPPFLAGS'].append('-D__BIG_ENDIAN__')
382 else:
383     env['CPPFLAGS'].append('-D__LITTLE_ENDIAN__')
384
385 # TODO, make optional (as with CMake)
386 env['CPPFLAGS'].append('-DWITH_AUDASPACE')
387 env['CPPFLAGS'].append('-DWITH_AVI')
388 env['CPPFLAGS'].append('-DWITH_BOOL_COMPAT')
389 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc') and env['MSVC_VERSION'] == '11.0':
390     env['CPPFLAGS'].append('-D_ALLOW_KEYWORD_MACROS')
391
392 if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
393     env['CPPFLAGS'].append('-DHAVE_STDBOOL_H')
394
395 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
396 B.root_build_dir = env['BF_BUILDDIR']
397 B.doc_build_dir = os.path.join(env['BF_INSTALLDIR'], 'doc')
398 if not B.root_build_dir[-1]==os.sep:
399     B.root_build_dir += os.sep
400 if not B.doc_build_dir[-1]==os.sep:
401     B.doc_build_dir += os.sep
402
403 # We do a shortcut for clean when no quicklist is given: just delete
404 # builddir without reading in SConscripts
405 do_clean = None
406 if 'clean' in B.targets:
407     do_clean = True
408
409 if not quickie and do_clean:
410     if os.path.exists(B.doc_build_dir):
411         print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
412         dirs = os.listdir(B.doc_build_dir)
413         for entry in dirs:
414             if os.path.isdir(B.doc_build_dir + entry) == 1:
415                 print "clean dir %s"%(B.doc_build_dir+entry)
416                 shutil.rmtree(B.doc_build_dir+entry)
417             else: # remove file
418                 print "remove file %s"%(B.doc_build_dir+entry)
419                 os.remove(B.root_build_dir+entry)
420     if os.path.exists(B.root_build_dir):
421         print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
422         dirs = os.listdir(B.root_build_dir)
423         for entry in dirs:
424             if os.path.isdir(B.root_build_dir + entry) == 1:
425                 print "clean dir %s"%(B.root_build_dir+entry)
426                 shutil.rmtree(B.root_build_dir+entry)
427             else: # remove file
428                 print "remove file %s"%(B.root_build_dir+entry)
429                 os.remove(B.root_build_dir+entry)
430         for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
431                 'extern/xvidcore/build/generic/platform.inc', 'extern/ffmpeg/include']:
432             if os.path.exists(confile):
433                 print "clean file %s"%confile
434                 if os.path.isdir(confile):
435                     for root, dirs, files in os.walk(confile):
436                         for name in files:
437                             os.remove(os.path.join(root, name))
438                 else:
439                     os.remove(confile)
440         print B.bc.OKGREEN+'...done'+B.bc.ENDC
441     else:
442         print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
443     Exit()
444
445
446 # ensure python header is found since detection can fail, this could happen
447 # with _any_ library but since we used a fixed python version this tends to
448 # be most problematic.
449 if env['WITH_BF_PYTHON']:
450     found_python_h = found_pyconfig_h = False
451     for bf_python_inc in env.subst('${BF_PYTHON_INC}').split():
452         py_h = os.path.join(Dir(bf_python_inc).abspath, "Python.h")
453         if os.path.exists(py_h):
454             found_python_h = True
455         py_h = os.path.join(Dir(bf_python_inc).abspath, "pyconfig.h")
456         if os.path.exists(py_h):
457             found_pyconfig_h = True
458
459     if not (found_python_h and found_pyconfig_h):
460         print("""\nMissing: Python.h and/or pyconfig.h in "%s"
461          Set 'BF_PYTHON_INC' to point to valid include path(s),
462          containing Python.h and pyconfig.h for Python version "%s".
463
464          Example: python scons/scons.py BF_PYTHON_INC=../Python/include
465               """ % (env.subst('${BF_PYTHON_INC}'), env.subst('${BF_PYTHON_VERSION}')))
466         Exit()
467
468
469 if not os.path.isdir ( B.root_build_dir):
470     os.makedirs ( B.root_build_dir )
471     os.makedirs ( B.root_build_dir + 'source' )
472     os.makedirs ( B.root_build_dir + 'intern' )
473     os.makedirs ( B.root_build_dir + 'extern' )
474     os.makedirs ( B.root_build_dir + 'lib' )
475     os.makedirs ( B.root_build_dir + 'bin' )
476 # # Docs not working with epy anymore
477 # if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']:
478 #     os.makedirs ( B.doc_build_dir )
479
480 ###################################
481 # Ensure all data files are valid #
482 ###################################
483 if not os.path.isdir ( B.root_build_dir + 'data_headers'):
484     os.makedirs ( B.root_build_dir + 'data_headers' )
485 if not os.path.isdir ( B.root_build_dir + 'data_sources'):
486     os.makedirs ( B.root_build_dir + 'data_sources' )
487 # use for includes
488 env['DATA_HEADERS'] = os.path.join(os.path.abspath(env['BF_BUILDDIR']), "data_headers")
489 env['DATA_SOURCES'] = os.path.join(os.path.abspath(env['BF_BUILDDIR']), "data_sources")
490 def data_to_c(FILE_FROM, FILE_TO, VAR_NAME):
491     if os.sep == "\\":
492         FILE_FROM = FILE_FROM.replace("/", "\\")
493         FILE_TO   = FILE_TO.replace("/", "\\")
494
495     # first check if we need to bother.
496     if os.path.exists(FILE_TO):
497         if os.path.getmtime(FILE_FROM) < os.path.getmtime(FILE_TO):
498             return
499
500     print(B.bc.HEADER + "Generating: " + B.bc.ENDC + "%r" % os.path.basename(FILE_TO))
501     fpin = open(FILE_FROM, "rb")
502     fpin.seek(0, os.SEEK_END)
503     size = fpin.tell()
504     fpin.seek(0)
505
506     fpout = open(FILE_TO, "w")
507     fpout.write("int  %s_size = %d;\n" % (VAR_NAME, size))
508     fpout.write("char %s[] = {\n" % VAR_NAME)
509
510     while size > 0:
511         size -= 1
512         if size % 32 == 31:
513             fpout.write("\n")
514
515         fpout.write("%3d," % ord(fpin.read(1)))
516     fpout.write("\n  0};\n\n")
517
518     fpin.close()
519     fpout.close()
520
521 def data_to_c_simple(FILE_FROM):
522         filename_only = os.path.basename(FILE_FROM)
523         FILE_TO = os.path.join(env['DATA_SOURCES'], filename_only + ".c")
524         VAR_NAME = "datatoc_" + filename_only.replace(".", "_")
525
526         data_to_c(FILE_FROM, FILE_TO, VAR_NAME)
527
528
529 if B.targets != ['cudakernels']:
530     data_to_c("source/blender/compositor/operations/COM_OpenCLKernels.cl",
531               B.root_build_dir + "data_headers/COM_OpenCLKernels.cl.h",
532               "datatoc_COM_OpenCLKernels_cl")
533
534     data_to_c_simple("release/datafiles/startup.blend")
535     data_to_c_simple("release/datafiles/preview.blend")
536     data_to_c_simple("release/datafiles/preview_cycles.blend")
537
538     # --- glsl ---
539     data_to_c_simple("source/blender/gpu/shaders/gpu_shader_simple_frag.glsl")
540     data_to_c_simple("source/blender/gpu/shaders/gpu_shader_simple_vert.glsl")
541     data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
542     data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
543     data_to_c_simple("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_frag.glsl")
544     data_to_c_simple("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_vert.glsl")
545     data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vertex.glsl")
546     data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl")
547     data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl")
548
549     # --- blender ---
550     data_to_c_simple("release/datafiles/bfont.pfb")
551     data_to_c_simple("release/datafiles/bfont.ttf")
552     data_to_c_simple("release/datafiles/bmonofont.ttf")
553
554     data_to_c_simple("release/datafiles/splash.png")
555     data_to_c_simple("release/datafiles/blender_icons16.png")
556     data_to_c_simple("release/datafiles/blender_icons32.png")
557     data_to_c_simple("release/datafiles/prvicons.png")
558
559     data_to_c_simple("release/datafiles/brushicons/add.png")
560     data_to_c_simple("release/datafiles/brushicons/blob.png")
561     data_to_c_simple("release/datafiles/brushicons/blur.png")
562     data_to_c_simple("release/datafiles/brushicons/clay.png")
563     data_to_c_simple("release/datafiles/brushicons/claystrips.png")
564     data_to_c_simple("release/datafiles/brushicons/clone.png")
565     data_to_c_simple("release/datafiles/brushicons/crease.png")
566     data_to_c_simple("release/datafiles/brushicons/darken.png")
567     data_to_c_simple("release/datafiles/brushicons/draw.png")
568     data_to_c_simple("release/datafiles/brushicons/fill.png")
569     data_to_c_simple("release/datafiles/brushicons/flatten.png")
570     data_to_c_simple("release/datafiles/brushicons/grab.png")
571     data_to_c_simple("release/datafiles/brushicons/inflate.png")
572     data_to_c_simple("release/datafiles/brushicons/layer.png")
573     data_to_c_simple("release/datafiles/brushicons/lighten.png")
574     data_to_c_simple("release/datafiles/brushicons/mask.png")
575     data_to_c_simple("release/datafiles/brushicons/mix.png")
576     data_to_c_simple("release/datafiles/brushicons/multiply.png")
577     data_to_c_simple("release/datafiles/brushicons/nudge.png")
578     data_to_c_simple("release/datafiles/brushicons/pinch.png")
579     data_to_c_simple("release/datafiles/brushicons/scrape.png")
580     data_to_c_simple("release/datafiles/brushicons/smear.png")
581     data_to_c_simple("release/datafiles/brushicons/smooth.png")
582     data_to_c_simple("release/datafiles/brushicons/snake_hook.png")
583     data_to_c_simple("release/datafiles/brushicons/soften.png")
584     data_to_c_simple("release/datafiles/brushicons/subtract.png")
585     data_to_c_simple("release/datafiles/brushicons/texdraw.png")
586     data_to_c_simple("release/datafiles/brushicons/thumb.png")
587     data_to_c_simple("release/datafiles/brushicons/twist.png")
588     data_to_c_simple("release/datafiles/brushicons/vertexdraw.png")
589
590     data_to_c_simple("release/datafiles/matcaps/mc01.jpg")
591     data_to_c_simple("release/datafiles/matcaps/mc02.jpg")
592     data_to_c_simple("release/datafiles/matcaps/mc03.jpg")
593     data_to_c_simple("release/datafiles/matcaps/mc04.jpg")
594     data_to_c_simple("release/datafiles/matcaps/mc05.jpg")
595     data_to_c_simple("release/datafiles/matcaps/mc06.jpg")
596     data_to_c_simple("release/datafiles/matcaps/mc07.jpg")
597     data_to_c_simple("release/datafiles/matcaps/mc08.jpg")
598     data_to_c_simple("release/datafiles/matcaps/mc09.jpg")
599     data_to_c_simple("release/datafiles/matcaps/mc10.jpg")
600     data_to_c_simple("release/datafiles/matcaps/mc11.jpg")
601     data_to_c_simple("release/datafiles/matcaps/mc12.jpg")
602     data_to_c_simple("release/datafiles/matcaps/mc13.jpg")
603     data_to_c_simple("release/datafiles/matcaps/mc14.jpg")
604     data_to_c_simple("release/datafiles/matcaps/mc15.jpg")
605     data_to_c_simple("release/datafiles/matcaps/mc16.jpg")
606     data_to_c_simple("release/datafiles/matcaps/mc17.jpg")
607     data_to_c_simple("release/datafiles/matcaps/mc18.jpg")
608     data_to_c_simple("release/datafiles/matcaps/mc19.jpg")
609     data_to_c_simple("release/datafiles/matcaps/mc20.jpg")
610     data_to_c_simple("release/datafiles/matcaps/mc21.jpg")
611     data_to_c_simple("release/datafiles/matcaps/mc22.jpg")
612     data_to_c_simple("release/datafiles/matcaps/mc23.jpg")
613     data_to_c_simple("release/datafiles/matcaps/mc24.jpg")
614
615 ##### END DATAFILES ##########
616
617 Help(opts.GenerateHelpText(env))
618
619 # default is new quieter output, but if you need to see the
620 # commands, do 'scons BF_QUIET=0'
621 bf_quietoutput = B.arguments.get('BF_QUIET', '1')
622 if env['BF_QUIET']:
623     B.set_quiet_output(env)
624 else:
625     if toolset=='msvc':
626         B.msvc_hack(env)
627
628 print B.bc.HEADER+'Building in: ' + B.bc.ENDC + os.path.abspath(B.root_build_dir)
629 env.SConsignFile(B.root_build_dir+'scons-signatures')
630 B.init_lib_dict()
631
632 ##### END SETUP ##########
633
634 Export('env')
635
636 VariantDir(B.root_build_dir+'/source', 'source', duplicate=0)
637 SConscript(B.root_build_dir+'/source/SConscript')
638 VariantDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
639 SConscript(B.root_build_dir+'/intern/SConscript')
640 VariantDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
641 SConscript(B.root_build_dir+'/extern/SConscript')
642
643 # now that we have read all SConscripts, we know what
644 # libraries will be built. Create list of
645 # libraries to give as objects to linking phase
646 mainlist = []
647 for tp in B.possible_types:
648     if (not tp == 'player') and (not tp == 'player2'):
649         mainlist += B.create_blender_liblist(env, tp)
650
651 if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
652     B.propose_priorities()
653
654 dobj = B.buildinfo(env, "dynamic") + B.resources
655 creob = B.creator(env)
656 thestatlibs, thelibincs = B.setup_staticlibs(env)
657 thesyslibs = B.setup_syslibs(env)
658
659 if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
660     env.BlenderProg(B.root_build_dir, "blender", creob + mainlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
661 if env['WITH_BF_PLAYER']:
662     playerlist = B.create_blender_liblist(env, 'player')
663     playerlist += B.create_blender_liblist(env, 'player2')
664     playerlist += B.create_blender_liblist(env, 'intern')
665     playerlist += B.create_blender_liblist(env, 'extern')
666     env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
667
668 ##### Now define some targets
669
670
671 #------------ INSTALL
672
673 #-- binaries
674 blenderinstall = []
675 if  env['OURPLATFORM']=='darwin':
676     for prg in B.program_list:
677         bundle = '%s.app' % prg[0]
678         bundledir = os.path.dirname(bundle)
679         for dp, dn, df in os.walk(bundle):
680             if '.svn' in dn:
681                 dn.remove('.svn')
682             if '_svn' in dn:
683                 dn.remove('_svn')
684             dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
685             source=[dp+os.sep+f for f in df]
686             blenderinstall.append(env.Install(dir=dir,source=source))
687 else:
688     blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
689
690 #-- local path = config files in install dir: installdir\VERSION
691 #- dont do config and scripts for darwin, it is already in the bundle
692 dotblendlist = []
693 datafileslist = []
694 datafilestargetlist = []
695 dottargetlist = []
696 scriptinstall = []
697 cubininstall = []
698
699 if env['OURPLATFORM']!='darwin':
700     dotblenderinstall = []
701     for targetdir,srcfile in zip(dottargetlist, dotblendlist):
702         td, tf = os.path.split(targetdir)
703         dotblenderinstall.append(env.Install(dir=td, source=srcfile))
704     for targetdir,srcfile in zip(datafilestargetlist, datafileslist):
705         td, tf = os.path.split(targetdir)
706         dotblenderinstall.append(env.Install(dir=td, source=srcfile))
707
708     if env['WITH_BF_PYTHON']:
709         #-- local/VERSION/scripts
710         scriptpaths=['release/scripts']
711         for scriptpath in scriptpaths:
712             for dp, dn, df in os.walk(scriptpath):
713                 if '.svn' in dn:
714                     dn.remove('.svn')
715                 if '_svn' in dn:
716                     dn.remove('_svn')
717                 if '__pycache__' in dn:  # py3.2 cache dir
718                     dn.remove('__pycache__')
719
720                 # only for testing builds
721                 if VERSION_RELEASE_CYCLE == "release" and "addons_contrib" in dn:
722                     dn.remove('addons_contrib')
723
724                 # do not install freestyle if disabled
725                 if not env['WITH_BF_FREESTYLE'] and "freestyle" in dn:
726                     dn.remove("freestyle")
727
728                 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
729                 dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):]
730
731                 source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
732                 # To ensure empty dirs are created too
733                 if len(source)==0 and not os.path.exists(dir):
734                     env.Execute(Mkdir(dir))
735                 scriptinstall.append(env.Install(dir=dir,source=source))
736         if env['WITH_BF_CYCLES']:
737             # cycles python code
738             dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles')
739             source=os.listdir('intern/cycles/blender/addon')
740             if '.svn' in source: source.remove('.svn')
741             if '_svn' in source: source.remove('_svn')
742             if '__pycache__' in source: source.remove('__pycache__')
743             source=['intern/cycles/blender/addon/'+s for s in source]
744             scriptinstall.append(env.Install(dir=dir,source=source))
745
746             # cycles kernel code
747             dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel')
748             source=os.listdir('intern/cycles/kernel')
749             if '.svn' in source: source.remove('.svn')
750             if '_svn' in source: source.remove('_svn')
751             if '__pycache__' in source: source.remove('__pycache__')
752             source.remove('kernel.cpp')
753             source.remove('CMakeLists.txt')
754             source.remove('svm')
755             source.remove('closure')
756             source.remove('shaders')
757             source.remove('osl')
758             source=['intern/cycles/kernel/'+s for s in source]
759             source.append('intern/cycles/util/util_color.h')
760             source.append('intern/cycles/util/util_math.h')
761             source.append('intern/cycles/util/util_transform.h')
762             source.append('intern/cycles/util/util_types.h')
763             scriptinstall.append(env.Install(dir=dir,source=source))
764             # svm
765             dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'svm')
766             source=os.listdir('intern/cycles/kernel/svm')
767             if '.svn' in source: source.remove('.svn')
768             if '_svn' in source: source.remove('_svn')
769             if '__pycache__' in source: source.remove('__pycache__')
770             source=['intern/cycles/kernel/svm/'+s for s in source]
771             scriptinstall.append(env.Install(dir=dir,source=source))
772             # closure
773             dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'closure')
774             source=os.listdir('intern/cycles/kernel/closure')
775             if '.svn' in source: source.remove('.svn')
776             if '_svn' in source: source.remove('_svn')
777             if '__pycache__' in source: source.remove('__pycache__')
778             source=['intern/cycles/kernel/closure/'+s for s in source]
779             scriptinstall.append(env.Install(dir=dir,source=source))
780
781             # licenses
782             dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license')
783             source=os.listdir('intern/cycles/doc/license')
784             if '.svn' in source: source.remove('.svn')
785             if '_svn' in source: source.remove('_svn')
786             if '__pycache__' in source: source.remove('__pycache__')
787             source.remove('CMakeLists.txt')
788             source=['intern/cycles/doc/license/'+s for s in source]
789             scriptinstall.append(env.Install(dir=dir,source=source))
790
791     if env['WITH_BF_CYCLES']:
792         # cuda binaries
793         if env['WITH_BF_CYCLES_CUDA_BINARIES']:
794             dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'lib')
795             for arch in env['BF_CYCLES_CUDA_BINARIES_ARCH']:
796                 kernel_build_dir = os.path.join(B.root_build_dir, 'intern/cycles/kernel')
797                 cubin_file = os.path.join(kernel_build_dir, "kernel_%s.cubin" % arch)
798                 cubininstall.append(env.Install(dir=dir,source=cubin_file))
799
800         # osl shaders
801         if env['WITH_BF_CYCLES_OSL']:
802             dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'shader')
803
804             osl_source_dir = Dir('./intern/cycles/kernel/shaders').srcnode().path
805             oso_build_dir = os.path.join(B.root_build_dir, 'intern/cycles/kernel/shaders')
806
807             headers='node_color.h node_fresnel.h node_texture.h oslutil.h stdosl.h'.split()
808             source=['intern/cycles/kernel/shaders/'+s for s in headers]
809             scriptinstall.append(env.Install(dir=dir,source=source))
810
811             for f in os.listdir(osl_source_dir):
812                 if f.endswith('.osl'):
813                     oso_file = os.path.join(oso_build_dir, f.replace('.osl', '.oso'))
814                     scriptinstall.append(env.Install(dir=dir,source=oso_file))
815
816     if env['WITH_BF_OCIO']:
817         colormanagement = os.path.join('release', 'datafiles', 'colormanagement')
818
819         for dp, dn, df in os.walk(colormanagement):
820             if '.svn' in dn:
821                 dn.remove('.svn')
822             if '_svn' in dn:
823                 dn.remove('_svn')
824
825             dir = os.path.join(env['BF_INSTALLDIR'], VERSION, 'datafiles')
826             dir += os.sep + os.path.basename(colormanagement) + dp[len(colormanagement):]
827
828             source = [os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
829
830             # To ensure empty dirs are created too
831             if len(source) == 0:
832                 env.Execute(Mkdir(dir))
833
834             scriptinstall.append(env.Install(dir=dir,source=source))
835
836     if env['WITH_BF_INTERNATIONAL']:
837         internationalpaths=['release' + os.sep + 'datafiles']
838
839         def check_path(path, member):
840             return (member in path.split(os.sep))
841
842         for intpath in internationalpaths:
843             for dp, dn, df in os.walk(intpath):
844                 if '.svn' in dn:
845                     dn.remove('.svn')
846                 if '_svn' in dn:
847                     dn.remove('_svn')
848
849                 # we only care about release/datafiles/fonts, release/datafiles/locales
850                 if check_path(dp, "fonts") or check_path(dp, "locale"):
851                     pass
852                 else:
853                     continue
854
855                 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
856                 dir += os.sep + os.path.basename(intpath) + dp[len(intpath):]
857
858                 source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
859                 # To ensure empty dirs are created too
860                 if len(source)==0:
861                     env.Execute(Mkdir(dir))
862                 scriptinstall.append(env.Install(dir=dir,source=source))
863
864 #-- icons
865 if env['OURPLATFORM']=='linux':
866     iconlist = []
867     icontargetlist = []
868
869     for tp, tn, tf in os.walk('release/freedesktop/icons'):
870         if '.svn' in tn:
871             tn.remove('.svn')
872         if '_svn' in tn:
873             tn.remove('_svn')
874         for f in tf:
875             iconlist.append(os.path.join(tp, f))
876             icontargetlist.append( os.path.join(*([env['BF_INSTALLDIR']] + tp.split(os.sep)[2:] + [f])) )
877
878     iconinstall = []
879     for targetdir,srcfile in zip(icontargetlist, iconlist):
880         td, tf = os.path.split(targetdir)
881         iconinstall.append(env.Install(dir=td, source=srcfile))
882
883     scriptinstall.append(env.Install(dir=env['BF_INSTALLDIR'], source='release/bin/blender-thumbnailer.py'))
884
885 # dlls for linuxcross
886 # TODO - add more libs, for now this lets blenderlite run
887 if env['OURPLATFORM']=='linuxcross':
888     dir=env['BF_INSTALLDIR']
889     source = []
890
891     if env['WITH_BF_OPENMP']:
892         source += ['../lib/windows/pthreads/lib/pthreadGC2.dll']
893
894     scriptinstall.append(env.Install(dir=dir, source=source))
895
896 textlist = []
897 texttargetlist = []
898 for tp, tn, tf in os.walk('release/text'):
899     if '.svn' in tn:
900         tn.remove('.svn')
901     if '_svn' in tn:
902         tn.remove('_svn')
903     for f in tf:
904         textlist.append(tp+os.sep+f)
905
906 textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
907
908 if  env['OURPLATFORM']=='darwin':
909         allinstall = [blenderinstall, textinstall]
910 elif env['OURPLATFORM']=='linux':
911         allinstall = [blenderinstall, dotblenderinstall, scriptinstall, textinstall, iconinstall, cubininstall]
912 else:
913         allinstall = [blenderinstall, dotblenderinstall, scriptinstall, textinstall, cubininstall]
914
915 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
916     dllsources = []
917
918     # Used when linking to libtiff was dynamic
919     # keep it here until compilation on all platform would be ok
920     # dllsources += ['${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
921
922     if env['OURPLATFORM'] != 'linuxcross':
923         # pthreads library is already added
924         dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
925
926     if env['WITH_BF_SDL']:
927         if env['OURPLATFORM'] == 'win64-vc':
928             pass # we link statically already to SDL on win64
929         else:
930             dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
931
932     if env['WITH_BF_PYTHON']:
933         if env['BF_DEBUG']:
934             dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
935         else:
936             dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
937
938     if env['WITH_BF_ICONV']:
939         if env['OURPLATFORM'] == 'win64-vc':
940             pass # we link statically to iconv on win64
941         elif not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
942             #gettext for MinGW and cross-compilation is compiled staticly
943             dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
944
945     if env['WITH_BF_OPENAL']:
946         dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
947         if env['OURPLATFORM'] in ('win32-vc', 'win64-vc') and env['MSVC_VERSION'] == '11.0':
948             pass
949         else:
950             dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
951
952     if env['WITH_BF_SNDFILE']:
953         dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
954
955     if env['WITH_BF_FFMPEG']:
956         dllsources += env['BF_FFMPEG_DLL'].split()
957
958     # Since the thumb handler is loaded by Explorer, architecture is
959     # strict: the x86 build fails on x64 Windows. We need to ship
960     # both builds in x86 packages.
961     if bitness == 32:
962         dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll')
963     dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
964
965     if env['WITH_BF_OCIO']:
966         if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
967             dllsources.append('${LCGDIR}/opencolorio/bin/OpenColorIO.dll')
968
969         else:
970             dllsources.append('${LCGDIR}/opencolorio/bin/libOpenColorIO.dll')
971
972     dllsources.append('#source/icons/blender.exe.manifest')
973
974     windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
975     allinstall += windlls
976
977 if env['OURPLATFORM'] == 'win64-mingw':
978     dllsources = []
979
980     if env['WITH_BF_PYTHON']:
981         if env['BF_DEBUG']:
982             dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
983         else:
984             dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
985
986     if env['WITH_BF_FFMPEG']:
987         dllsources += env['BF_FFMPEG_DLL'].split()
988
989     if env['WITH_BF_OPENAL']:
990         dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
991         dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
992
993     if env['WITH_BF_SNDFILE']:
994         dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
995
996     if env['WITH_BF_SDL']:
997         dllsources.append('${LCGDIR}/sdl/lib/SDL.dll')
998
999     if(env['WITH_BF_OPENMP']):
1000         dllsources.append('${LCGDIR}/binaries/libgomp-1.dll')
1001
1002     if env['WITH_BF_OCIO']:
1003         dllsources.append('${LCGDIR}/opencolorio/bin/libOpenColorIO.dll')
1004
1005     dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
1006     dllsources.append('${LCGDIR}/binaries/libgcc_s_sjlj-1.dll')
1007     dllsources.append('${LCGDIR}/binaries/libwinpthread-1.dll')
1008     dllsources.append('${LCGDIR}/binaries/libstdc++-6.dll')
1009     dllsources.append('#source/icons/blender.exe.manifest')
1010
1011     windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
1012     allinstall += windlls
1013
1014 installtarget = env.Alias('install', allinstall)
1015 bininstalltarget = env.Alias('install-bin', blenderinstall)
1016
1017 nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
1018 nsiscmd = env.Command('nsisinstaller', None, nsisaction)
1019 nsisalias = env.Alias('nsis', nsiscmd)
1020
1021 if 'blender' in B.targets:
1022     blenderexe= env.Alias('blender', B.program_list)
1023     Depends(blenderexe,installtarget)
1024
1025 if env['WITH_BF_PLAYER']:
1026     blenderplayer = env.Alias('blenderplayer', B.program_list)
1027     Depends(blenderplayer,installtarget)
1028
1029 if not env['WITH_BF_GAMEENGINE']:
1030     blendernogame = env.Alias('blendernogame', B.program_list)
1031     Depends(blendernogame,installtarget)
1032
1033 if 'blenderlite' in B.targets:
1034     blenderlite = env.Alias('blenderlite', B.program_list)
1035     Depends(blenderlite,installtarget)
1036
1037 Depends(nsiscmd, allinstall)
1038
1039 buildslave_action = env.Action(btools.buildslave, btools.buildslave_print)
1040 buildslave_cmd = env.Command('buildslave_exec', None, buildslave_action)
1041 buildslave_alias = env.Alias('buildslave', buildslave_cmd)
1042
1043 Depends(buildslave_cmd, allinstall)
1044
1045 cudakernels_action = env.Action(btools.cudakernels, btools.cudakernels_print)
1046 cudakernels_cmd = env.Command('cudakernels_exec', None, cudakernels_action)
1047 cudakernels_alias = env.Alias('cudakernels', cudakernels_cmd)
1048
1049 cudakernel_dir = os.path.join(os.path.abspath(os.path.normpath(B.root_build_dir)), 'intern/cycles/kernel')
1050 cuda_kernels = []
1051
1052 for x in env['BF_CYCLES_CUDA_BINARIES_ARCH']:
1053     cubin = os.path.join(cudakernel_dir, 'kernel_' + x + '.cubin')
1054     cuda_kernels.append(cubin)
1055
1056 Depends(cudakernels_cmd, cuda_kernels)
1057 Depends(cudakernels_cmd, cubininstall)
1058
1059 Default(B.program_list)
1060
1061 if not env['WITHOUT_BF_INSTALL']:
1062         Default(installtarget)
1063