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