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