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