~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to SConstruct

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
 
# $Id: SConstruct 30494 2010-07-19 10:15:49Z jesterking $
 
2
#
3
3
# ***** BEGIN GPL LICENSE BLOCK *****
4
4
#
5
5
# This program is free software; you can redistribute it and/or
28
28
# Main entry-point for the SCons building system
29
29
# Set up some custom actions and target/argument handling
30
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
31
35
 
32
36
import platform as pltfrm
33
37
 
34
38
# Need a better way to do this. Automagical maybe is not the best thing, maybe it is.
35
39
if pltfrm.architecture()[0] == '64bit':
36
 
        bitness = 64
 
40
    bitness = 64
37
41
else:
38
 
        bitness = 32
 
42
    bitness = 32
39
43
 
40
44
import sys
41
45
import os
58
62
 
59
63
EnsureSConsVersion(1,0,0)
60
64
 
 
65
# Before we do anything, let's check if we have a sane os.environ
 
66
if not btools.check_environ():
 
67
    Exit()
 
68
 
61
69
BlenderEnvironment = Blender.BlenderEnvironment
62
70
B = Blender
63
71
 
64
72
VERSION = btools.VERSION # This is used in creating the local config directories
 
73
VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE
65
74
 
66
75
### globals ###
67
76
platform = sys.platform
70
79
 
71
80
##### BEGIN SETUP #####
72
81
 
73
 
B.possible_types = ['core', 'player', 'intern', 'extern']
 
82
B.possible_types = ['core', 'player', 'player2', 'intern', 'extern']
74
83
 
75
84
B.binarykind = ['blender' , 'blenderplayer']
76
85
##################################
79
88
# XX cheating for BF_FANCY, we check for BF_FANCY before args are validated
80
89
use_color = ARGUMENTS.get('BF_FANCY', '1')
81
90
if platform=='win32':
82
 
        use_color = None
 
91
    use_color = None
83
92
 
84
93
if not use_color=='1':
85
 
        B.bc.disable()
86
 
        
 
94
    B.bc.disable()
 
95
    
87
96
 #on defaut white Os X terminal, some colors are totally unlegible
88
97
if platform=='darwin':
89
 
        B.bc.OKGREEN = '\033[34m'
90
 
        B.bc.WARNING = '\033[36m'
 
98
    B.bc.OKGREEN = '\033[34m'
 
99
    B.bc.WARNING = '\033[36m'
91
100
 
92
101
# arguments
93
102
print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
105
114
 
106
115
# handling cmd line arguments & config file
107
116
 
 
117
# bitness stuff
 
118
tempbitness = int(B.arguments.get('BF_BITNESS', bitness)) # default to bitness found as per starting python
 
119
if tempbitness in (32, 64): # only set if 32 or 64 has been given
 
120
    bitness = int(tempbitness)
 
121
 
 
122
if bitness:
 
123
    B.bitness = bitness
 
124
else: 
 
125
    B.bitness = tempbitness
 
126
    
 
127
 
108
128
# first check cmdline for toolset and we create env to work on
109
129
quickie = B.arguments.get('BF_QUICK', None)
110
130
quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
111
131
 
112
132
if quickdebug:
113
 
        B.quickdebug=string.split(quickdebug, ',')
 
133
    B.quickdebug=string.split(quickdebug, ',')
114
134
else:
115
 
        B.quickdebug=[]
 
135
    B.quickdebug=[]
116
136
 
117
137
if quickie:
118
 
        B.quickie=string.split(quickie,',')
 
138
    B.quickie=string.split(quickie,',')
119
139
else:
120
 
        B.quickie=[]
121
 
        
 
140
    B.quickie=[]
 
141
    
122
142
toolset = B.arguments.get('BF_TOOLSET', None)
123
143
if toolset:
124
 
        print "Using " + toolset
125
 
        if toolset=='mstoolkit':
126
 
                env = BlenderEnvironment(ENV = os.environ)
127
 
                env.Tool('mstoolkit', [toolpath])
128
 
        else:
129
 
                env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
130
 
                # xxx commented out, as was supressing warnings under mingw..
131
 
                #if env:
132
 
                #       btools.SetupSpawn(env)
 
144
    print "Using " + toolset
 
145
    if toolset=='mstoolkit':
 
146
        env = BlenderEnvironment(ENV = os.environ)
 
147
        env.Tool('mstoolkit', [toolpath])
 
148
    else:
 
149
        env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
 
150
        if env:
 
151
            btools.SetupSpawn(env)
133
152
else:
134
 
        if bitness==64 and platform=='win32':
135
 
                env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64')
136
 
        else:
137
 
                env = BlenderEnvironment(ENV = os.environ)
 
153
    if bitness==64 and platform=='win32':
 
154
        env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64')
 
155
    else:
 
156
        env = BlenderEnvironment(ENV = os.environ)
138
157
 
139
158
if not env:
140
 
        print "Could not create a build environment"
141
 
        Exit()
142
 
 
 
159
    print "Could not create a build environment"
 
160
    Exit()
143
161
 
144
162
cc = B.arguments.get('CC', None)
145
163
cxx = B.arguments.get('CXX', None)
146
164
if cc:
147
 
        env['CC'] = cc
 
165
    env['CC'] = cc
148
166
if cxx:
149
 
        env['CXX'] = cxx
 
167
    env['CXX'] = cxx
150
168
 
151
 
if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
152
 
        if bitness == 64:
153
 
                platform = 'win64-vc'
154
 
        else:
155
 
                platform = 'win32-vc'
156
 
elif env['CC'] in ['gcc'] and sys.platform=='win32':
157
 
        platform = 'win32-mingw'
 
169
if sys.platform=='win32':
 
170
    if env['CC'] in ['cl', 'cl.exe']:
 
171
        platform = 'win64-vc' if bitness == 64 else 'win32-vc'
 
172
    elif env['CC'] in ['gcc']:
 
173
        platform = 'win64-mingw' if bitness == 64 else 'win32-mingw'
158
174
 
159
175
env.SConscriptChdir(0)
160
176
 
 
177
# Remove major kernel version from linux platform.
 
178
# After Linus switched kernel to new version model this major version
 
179
# shouldn't take much sense for building rules.
 
180
 
 
181
if re.match('linux[0-9]+', platform):
 
182
    platform = 'linux'
 
183
 
161
184
crossbuild = B.arguments.get('BF_CROSS', None)
162
185
if crossbuild and platform not in ('win32-vc', 'win64-vc'):
163
 
        platform = 'linuxcross'
 
186
    platform = 'linuxcross'
164
187
 
165
188
env['OURPLATFORM'] = platform
166
189
 
167
190
configfile = os.path.join("build_files", "scons", "config", platform + "-config.py")
168
191
 
169
192
if os.path.exists(configfile):
170
 
        print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
 
193
    print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
171
194
else:
172
 
        print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
 
195
    print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
173
196
 
174
197
if crossbuild and env['PLATFORM'] != 'win32':
175
 
        print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
176
 
        env.Tool('crossmingw', [toolpath])
177
 
        # todo: determine proper libs/includes etc.
178
 
        # Needed for gui programs, console programs should do without it
 
198
    print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
 
199
    env.Tool('crossmingw', [toolpath])
 
200
    # todo: determine proper libs/includes etc.
 
201
    # Needed for gui programs, console programs should do without it
179
202
 
180
 
        # Now we don't need this option to have console window
181
 
        # env.Append(LINKFLAGS=['-mwindows'])
 
203
    # Now we don't need this option to have console window
 
204
    # env.Append(LINKFLAGS=['-mwindows'])
182
205
 
183
206
userconfig = B.arguments.get('BF_CONFIG', 'user-config.py')
184
207
# first read platform config. B.arguments will override
185
208
optfiles = [configfile]
186
209
if os.path.exists(userconfig):
187
 
        print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
188
 
        optfiles += [userconfig]
 
210
    print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
 
211
    optfiles += [userconfig]
189
212
else:
190
 
        print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
 
213
    print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
191
214
 
192
215
opts = btools.read_opts(env, optfiles, B.arguments)
193
216
opts.Update(env)
194
217
 
 
218
if sys.platform=='win32':
 
219
    if bitness==64:
 
220
        env.Append(CPPFLAGS=['-DWIN64']) # -DWIN32 needed too, as it's used all over to target Windows generally
 
221
 
195
222
if not env['BF_FANCY']:
196
 
        B.bc.disable()
 
223
    B.bc.disable()
197
224
 
198
225
 
199
226
# remove install dir so old and new files are not mixed.
200
227
# NOTE: only do the scripts directory for now, otherwise is too disruptive for developers
201
228
# TODO: perhaps we need an option (off by default) to not do this altogether...
202
229
if not env['WITHOUT_BF_INSTALL'] and not env['WITHOUT_BF_OVERWRITE_INSTALL']:
203
 
        scriptsDir = os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts')
204
 
        if os.path.isdir(scriptsDir):
205
 
                print B.bc.OKGREEN + "Clearing installation directory%s: %s" % (B.bc.ENDC, os.path.abspath(scriptsDir))
206
 
                shutil.rmtree(scriptsDir)
 
230
    scriptsDir = os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts')
 
231
    if os.path.isdir(scriptsDir):
 
232
        print B.bc.OKGREEN + "Clearing installation directory%s: %s" % (B.bc.ENDC, os.path.abspath(scriptsDir))
 
233
        shutil.rmtree(scriptsDir)
207
234
 
208
235
 
209
236
SetOption('num_jobs', int(env['BF_NUMJOBS']))
210
237
print B.bc.OKGREEN + "Build with parallel jobs%s: %s" % (B.bc.ENDC, GetOption('num_jobs'))
211
238
print B.bc.OKGREEN + "Build with debug symbols%s: %s" % (B.bc.ENDC, env['BF_DEBUG'])
212
239
 
213
 
# BLENDERPATH is a unix only option to enable typical style paths this is
214
 
# spesifically a data-dir, which is used a lot but cant replace BF_INSTALLDIR
215
 
# because the blender binary is installed in $BF_INSTALLDIR/bin/blender
216
 
 
217
 
if env['WITH_BF_FHS']:
218
 
        BLENDERPATH = os.path.join(env['BF_INSTALLDIR'], 'share', 'blender', env['BF_VERSION'])
219
 
else:
220
 
        BLENDERPATH = env['BF_INSTALLDIR']
 
240
if 'blenderlite' in B.targets:
 
241
    target_env_defs = {}
 
242
    target_env_defs['WITH_BF_GAMEENGINE'] = False
 
243
    target_env_defs['WITH_BF_OPENAL'] = False
 
244
    target_env_defs['WITH_BF_OPENEXR'] = False
 
245
    target_env_defs['WITH_BF_OPENMP'] = False
 
246
    target_env_defs['WITH_BF_ICONV'] = False
 
247
    target_env_defs['WITH_BF_INTERNATIONAL'] = False
 
248
    target_env_defs['WITH_BF_OPENJPEG'] = False
 
249
    target_env_defs['WITH_BF_FFMPEG'] = False
 
250
    target_env_defs['WITH_BF_QUICKTIME'] = False
 
251
    target_env_defs['WITH_BF_REDCODE'] = False
 
252
    target_env_defs['WITH_BF_DDS'] = False
 
253
    target_env_defs['WITH_BF_CINEON'] = False
 
254
    target_env_defs['WITH_BF_FRAMESERVER'] = False
 
255
    target_env_defs['WITH_BF_HDR'] = False
 
256
    target_env_defs['WITH_BF_ZLIB'] = False
 
257
    target_env_defs['WITH_BF_SDL'] = False
 
258
    target_env_defs['WITH_BF_JPEG'] = False
 
259
    target_env_defs['WITH_BF_PNG'] = False
 
260
    target_env_defs['WITH_BF_BULLET'] = False
 
261
    target_env_defs['WITH_BF_BINRELOC'] = False
 
262
    target_env_defs['BF_BUILDINFO'] = False
 
263
    target_env_defs['WITH_BF_FLUID'] = False
 
264
    target_env_defs['WITH_BF_OCEANSIM'] = False
 
265
    target_env_defs['WITH_BF_SMOKE'] = False
 
266
    target_env_defs['WITH_BF_DECIMATE'] = False
 
267
    target_env_defs['WITH_BF_BOOLEAN'] = False
 
268
    target_env_defs['WITH_BF_REMESH'] = False
 
269
    target_env_defs['WITH_BF_PYTHON'] = False
 
270
    target_env_defs['WITH_BF_3DMOUSE'] = False
 
271
    target_env_defs['WITH_BF_LIBMV'] = False
 
272
    
 
273
    # Merge blenderlite, let command line to override
 
274
    for k,v in target_env_defs.iteritems():
 
275
        if k not in B.arguments:
 
276
            env[k] = v
 
277
 
 
278
# Extended OSX_SDK and 3D_CONNEXION_CLIENT_LIBRARY and JAckOSX detection for OSX
 
279
if env['OURPLATFORM']=='darwin':
 
280
    print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'] + " --"
 
281
    print "Available " + env['MACOSX_SDK_CHECK']
 
282
    if not 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']:
 
283
        print  B.bc.OKGREEN + "MacOSX10.5.sdk not available:" + B.bc.ENDC + " using MacOSX10.6.sdk"
 
284
    else:
 
285
        print B.bc.OKGREEN + "Found recommended sdk :" + B.bc.ENDC + " using MacOSX10.5.sdk"
 
286
 
 
287
    # for now, Mac builders must download and install the 3DxWare 10 Beta 4 driver framework from 3Dconnexion
 
288
    # necessary header file lives here when installed:
 
289
    # /Library/Frameworks/3DconnexionClient.framework/Versions/Current/Headers/ConnexionClientAPI.h
 
290
    if env['WITH_BF_3DMOUSE'] == 1:
 
291
        if not os.path.exists('/Library/Frameworks/3DconnexionClient.framework'):
 
292
            print "3D_CONNEXION_CLIENT_LIBRARY not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
 
293
            env['WITH_BF_3DMOUSE'] = 0
 
294
        else:
 
295
            env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','3DconnexionClient'])
 
296
 
 
297
    # for now, Mac builders must download and install the JackOSX framework 
 
298
    # necessary header file lives here when installed:
 
299
    # /Library/Frameworks/Jackmp.framework/Versions/A/Headers/jack.h
 
300
    if env['WITH_BF_JACK'] == 1:
 
301
        if not os.path.exists('/Library/Frameworks/Jackmp.framework'):
 
302
            print "JackOSX install not found, disabling WITH_BF_JACK" # avoid build errors !
 
303
            env['WITH_BF_JACK'] = 0
 
304
        else:
 
305
            env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','Jackmp'])
221
306
 
222
307
if env['WITH_BF_OPENMP'] == 1:
223
 
                if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
224
 
                                env['CCFLAGS'].append('/openmp')
225
 
                                env['CPPFLAGS'].append('/openmp')
226
 
                                env['CXXFLAGS'].append('/openmp')
227
 
                else:
228
 
                        if env['CC'].endswith('icc'): # to be able to handle CC=/opt/bla/icc case
229
 
                                env.Append(LINKFLAGS=['-openmp', '-static-intel'])
230
 
                                env['CCFLAGS'].append('-openmp')
231
 
                                env['CPPFLAGS'].append('-openmp')
232
 
                                env['CXXFLAGS'].append('-openmp')
233
 
                        else:
234
 
                                env.Append(CCFLAGS=['-fopenmp']) 
235
 
                                env.Append(CPPFLAGS=['-fopenmp'])
236
 
                                env.Append(CXXFLAGS=['-fopenmp'])
 
308
        if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
 
309
                env['CCFLAGS'].append('/openmp')
 
310
        else:
 
311
            if env['CC'].endswith('icc'): # to be able to handle CC=/opt/bla/icc case
 
312
                env.Append(LINKFLAGS=['-openmp', '-static-intel'])
 
313
                env['CCFLAGS'].append('-openmp')
 
314
            else:
 
315
                env.Append(CCFLAGS=['-fopenmp']) 
237
316
 
238
317
if env['WITH_GHOST_COCOA'] == True:
239
 
        env.Append(CFLAGS=['-DGHOST_COCOA']) 
240
 
        env.Append(CXXFLAGS=['-DGHOST_COCOA'])
241
 
        env.Append(CPPFLAGS=['-DGHOST_COCOA'])
 
318
    env.Append(CPPFLAGS=['-DGHOST_COCOA']) 
242
319
    
243
320
if env['USE_QTKIT'] == True:
244
 
        env.Append(CFLAGS=['-DUSE_QTKIT']) 
245
 
        env.Append(CXXFLAGS=['-DUSE_QTKIT'])
246
 
        env.Append(CPPFLAGS=['-DUSE_QTKIT'])
 
321
    env.Append(CPPFLAGS=['-DUSE_QTKIT'])
247
322
 
248
323
#check for additional debug libnames
249
324
 
250
325
if env.has_key('BF_DEBUG_LIBS'):
251
 
        B.quickdebug += env['BF_DEBUG_LIBS']
 
326
    B.quickdebug += env['BF_DEBUG_LIBS']
252
327
 
253
328
printdebug = B.arguments.get('BF_LISTDEBUG', 0)
254
329
 
255
330
if len(B.quickdebug) > 0 and printdebug != 0:
256
 
        print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
257
 
        for l in B.quickdebug:
258
 
                print "\t" + l
 
331
    print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
 
332
    for l in B.quickdebug:
 
333
        print "\t" + l
259
334
 
260
335
# remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
261
336
if env['WITH_BF_STATICCXX']:
262
 
        if 'stdc++' in env['LLIBS']:
263
 
                env['LLIBS'].remove('stdc++')
264
 
        else:
265
 
                print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
 
337
    if 'stdc++' in env['LLIBS']:
 
338
        env['LLIBS'].remove('stdc++')
 
339
    else:
 
340
        print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
266
341
 
267
342
# check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
268
343
if 'blenderplayer' in B.targets:
269
 
        env['WITH_BF_PLAYER'] = True
 
344
    env['WITH_BF_PLAYER'] = True
270
345
 
271
346
if 'blendernogame' in B.targets:
272
 
        env['WITH_BF_GAMEENGINE'] = False
273
 
 
274
 
if 'blenderlite' in B.targets:
275
 
        target_env_defs = {}
276
 
        target_env_defs['WITH_BF_GAMEENGINE'] = False
277
 
        target_env_defs['WITH_BF_OPENAL'] = False
278
 
        target_env_defs['WITH_BF_OPENEXR'] = False
279
 
        target_env_defs['WITH_BF_OPENMP'] = False
280
 
        target_env_defs['WITH_BF_ICONV'] = False
281
 
        target_env_defs['WITH_BF_INTERNATIONAL'] = False
282
 
        target_env_defs['WITH_BF_OPENJPEG'] = False
283
 
        target_env_defs['WITH_BF_FFMPEG'] = False
284
 
        target_env_defs['WITH_BF_QUICKTIME'] = False
285
 
        target_env_defs['WITH_BF_REDCODE'] = False
286
 
        target_env_defs['WITH_BF_DDS'] = False
287
 
        target_env_defs['WITH_BF_ZLIB'] = False
288
 
        target_env_defs['WITH_BF_SDL'] = False
289
 
        target_env_defs['WITH_BF_JPEG'] = False
290
 
        target_env_defs['WITH_BF_PNG'] = False
291
 
        target_env_defs['WITH_BF_BULLET'] = False
292
 
        target_env_defs['WITH_BF_BINRELOC'] = False
293
 
        target_env_defs['BF_BUILDINFO'] = False
294
 
        target_env_defs['BF_NO_ELBEEM'] = True
295
 
        target_env_defs['WITH_BF_PYTHON'] = False
296
 
        
297
 
        # Merge blenderlite, let command line to override
298
 
        for k,v in target_env_defs.iteritems():
299
 
                if k not in B.arguments:
300
 
                        env[k] = v
301
 
 
302
 
# disable elbeem (fluidsim) compilation?
303
 
if env['BF_NO_ELBEEM'] == 1:
304
 
        env['CPPFLAGS'].append('-DDISABLE_ELBEEM')
305
 
        env['CXXFLAGS'].append('-DDISABLE_ELBEEM')
306
 
        env['CCFLAGS'].append('-DDISABLE_ELBEEM')
307
 
 
308
 
if env['WITH_BF_SDL'] == False and env['OURPLATFORM'] in ('win32-vc', 'win32-ming', 'win64-vc'):
309
 
        env['PLATFORM_LINKFLAGS'].remove('/ENTRY:mainCRTStartup')
310
 
        env['PLATFORM_LINKFLAGS'].append('/ENTRY:main')
 
347
    env['WITH_BF_GAMEENGINE'] = False
 
348
 
 
349
# build without elbeem (fluidsim)?
 
350
if env['WITH_BF_FLUID'] == 1:
 
351
    env['CPPFLAGS'].append('-DWITH_MOD_FLUID')
 
352
 
 
353
# build with ocean sim?
 
354
if env['WITH_BF_OCEANSIM'] == 1:
 
355
    env['WITH_BF_FFTW3']  = 1  # ocean needs fftw3 so enable it 
 
356
    env['CPPFLAGS'].append('-DWITH_MOD_OCEANSIM')
 
357
 
 
358
 
 
359
if btools.ENDIAN == "big":
 
360
    env['CPPFLAGS'].append('-D__BIG_ENDIAN__')
 
361
else:
 
362
    env['CPPFLAGS'].append('-D__LITTLE_ENDIAN__')
 
363
 
 
364
# TODO, make optional
 
365
env['CPPFLAGS'].append('-DWITH_AUDASPACE')
311
366
 
312
367
# lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
313
368
B.root_build_dir = env['BF_BUILDDIR']
314
 
B.doc_build_dir = os.path.join(BLENDERPATH, 'doc')
 
369
B.doc_build_dir = os.path.join(env['BF_INSTALLDIR'], 'doc')
315
370
if not B.root_build_dir[-1]==os.sep:
316
 
        B.root_build_dir += os.sep
 
371
    B.root_build_dir += os.sep
317
372
if not B.doc_build_dir[-1]==os.sep:
318
 
        B.doc_build_dir += os.sep
319
 
        
 
373
    B.doc_build_dir += os.sep
 
374
    
320
375
# We do a shortcut for clean when no quicklist is given: just delete
321
376
# builddir without reading in SConscripts
322
377
do_clean = None
323
378
if 'clean' in B.targets:
324
 
        do_clean = True
 
379
    do_clean = True
325
380
 
326
381
if not quickie and do_clean:
327
 
        if os.path.exists(B.doc_build_dir):
328
 
                print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
329
 
                dirs = os.listdir(B.doc_build_dir)
330
 
                for entry in dirs:
331
 
                        if os.path.isdir(B.doc_build_dir + entry) == 1:
332
 
                                print "clean dir %s"%(B.doc_build_dir+entry)
333
 
                                shutil.rmtree(B.doc_build_dir+entry)
334
 
                        else: # remove file
335
 
                                print "remove file %s"%(B.doc_build_dir+entry)
336
 
                                os.remove(B.root_build_dir+entry)
337
 
        if os.path.exists(B.root_build_dir):
338
 
                print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
339
 
                dirs = os.listdir(B.root_build_dir)
340
 
                for entry in dirs:
341
 
                        if os.path.isdir(B.root_build_dir + entry) == 1:
342
 
                                print "clean dir %s"%(B.root_build_dir+entry)
343
 
                                shutil.rmtree(B.root_build_dir+entry)
344
 
                        else: # remove file
345
 
                                print "remove file %s"%(B.root_build_dir+entry)
346
 
                                os.remove(B.root_build_dir+entry)
347
 
                for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
348
 
                                'extern/xvidcore/build/generic/platform.inc', 'extern/ffmpeg/include']:
349
 
                        if os.path.exists(confile):
350
 
                                print "clean file %s"%confile
351
 
                                if os.path.isdir(confile):
352
 
                                        for root, dirs, files in os.walk(confile):
353
 
                                                for name in files:
354
 
                                                        os.remove(os.path.join(root, name))
355
 
                                else:
356
 
                                        os.remove(confile)
357
 
                print B.bc.OKGREEN+'...done'+B.bc.ENDC
358
 
        else:
359
 
                print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
360
 
        Exit()
 
382
    if os.path.exists(B.doc_build_dir):
 
383
        print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
 
384
        dirs = os.listdir(B.doc_build_dir)
 
385
        for entry in dirs:
 
386
            if os.path.isdir(B.doc_build_dir + entry) == 1:
 
387
                print "clean dir %s"%(B.doc_build_dir+entry)
 
388
                shutil.rmtree(B.doc_build_dir+entry)
 
389
            else: # remove file
 
390
                print "remove file %s"%(B.doc_build_dir+entry)
 
391
                os.remove(B.root_build_dir+entry)
 
392
    if os.path.exists(B.root_build_dir):
 
393
        print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
 
394
        dirs = os.listdir(B.root_build_dir)
 
395
        for entry in dirs:
 
396
            if os.path.isdir(B.root_build_dir + entry) == 1:
 
397
                print "clean dir %s"%(B.root_build_dir+entry)
 
398
                shutil.rmtree(B.root_build_dir+entry)
 
399
            else: # remove file
 
400
                print "remove file %s"%(B.root_build_dir+entry)
 
401
                os.remove(B.root_build_dir+entry)
 
402
        for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
 
403
                'extern/xvidcore/build/generic/platform.inc', 'extern/ffmpeg/include']:
 
404
            if os.path.exists(confile):
 
405
                print "clean file %s"%confile
 
406
                if os.path.isdir(confile):
 
407
                    for root, dirs, files in os.walk(confile):
 
408
                        for name in files:
 
409
                            os.remove(os.path.join(root, name))
 
410
                else:
 
411
                    os.remove(confile)
 
412
        print B.bc.OKGREEN+'...done'+B.bc.ENDC
 
413
    else:
 
414
        print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
 
415
    Exit()
 
416
 
 
417
 
 
418
# ensure python header is found since detection can fail, this could happen
 
419
# with _any_ library but since we used a fixed python version this tends to
 
420
# be most problematic.
 
421
if env['WITH_BF_PYTHON']:
 
422
        py_h = os.path.join(Dir(env.subst('${BF_PYTHON_INC}')).abspath, "Python.h")
 
423
 
 
424
        if not os.path.exists(py_h):
 
425
                print("\nMissing: \"" + env.subst('${BF_PYTHON_INC}') + os.sep + "Python.h\",\n"
 
426
                          "  Set 'BF_PYTHON_INC' to point "
 
427
                          "to a valid python include path.\n  Containing "
 
428
                          "Python.h for python version \"" + env.subst('${BF_PYTHON_VERSION}') + "\"")
 
429
 
 
430
                Exit()
 
431
        del py_h
 
432
 
361
433
 
362
434
if not os.path.isdir ( B.root_build_dir):
363
 
        os.makedirs ( B.root_build_dir )
364
 
        os.makedirs ( B.root_build_dir + 'source' )
365
 
        os.makedirs ( B.root_build_dir + 'intern' )
366
 
        os.makedirs ( B.root_build_dir + 'extern' )
367
 
        os.makedirs ( B.root_build_dir + 'lib' )
368
 
        os.makedirs ( B.root_build_dir + 'bin' )
369
 
if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']:
370
 
        os.makedirs ( B.doc_build_dir )
 
435
    os.makedirs ( B.root_build_dir )
 
436
    os.makedirs ( B.root_build_dir + 'source' )
 
437
    os.makedirs ( B.root_build_dir + 'intern' )
 
438
    os.makedirs ( B.root_build_dir + 'extern' )
 
439
    os.makedirs ( B.root_build_dir + 'lib' )
 
440
    os.makedirs ( B.root_build_dir + 'bin' )
 
441
# # Docs not working with epy anymore
 
442
# if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']:
 
443
#     os.makedirs ( B.doc_build_dir )
371
444
 
372
445
Help(opts.GenerateHelpText(env))
373
446
 
375
448
# commands, do 'scons BF_QUIET=0'
376
449
bf_quietoutput = B.arguments.get('BF_QUIET', '1')
377
450
if env['BF_QUIET']:
378
 
        B.set_quiet_output(env)
 
451
    B.set_quiet_output(env)
379
452
else:
380
 
        if toolset=='msvc':
381
 
                B.msvc_hack(env)
 
453
    if toolset=='msvc':
 
454
        B.msvc_hack(env)
382
455
 
383
456
print B.bc.HEADER+'Building in: ' + B.bc.ENDC + os.path.abspath(B.root_build_dir)
384
457
env.SConsignFile(B.root_build_dir+'scons-signatures')
388
461
 
389
462
Export('env')
390
463
 
 
464
BuildDir(B.root_build_dir+'/source', 'source', duplicate=0)
 
465
SConscript(B.root_build_dir+'/source/SConscript')
391
466
BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
392
467
SConscript(B.root_build_dir+'/intern/SConscript')
393
468
BuildDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
394
469
SConscript(B.root_build_dir+'/extern/SConscript')
395
 
BuildDir(B.root_build_dir+'/source', 'source', duplicate=0)
396
 
SConscript(B.root_build_dir+'/source/SConscript')
397
470
 
398
471
# now that we have read all SConscripts, we know what
399
472
# libraries will be built. Create list of
400
473
# libraries to give as objects to linking phase
401
474
mainlist = []
402
475
for tp in B.possible_types:
403
 
        if not tp == 'player':
404
 
                mainlist += B.create_blender_liblist(env, tp)
 
476
    if (not tp == 'player') and (not tp == 'player2'):
 
477
        mainlist += B.create_blender_liblist(env, tp)
405
478
 
406
479
if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
407
 
        B.propose_priorities()
 
480
    B.propose_priorities()
408
481
 
409
482
dobj = B.buildinfo(env, "dynamic") + B.resources
 
483
creob = B.creator(env)
410
484
thestatlibs, thelibincs = B.setup_staticlibs(env)
411
485
thesyslibs = B.setup_syslibs(env)
412
486
 
413
487
if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
414
 
        env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
 
488
    env.BlenderProg(B.root_build_dir, "blender", creob + mainlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
415
489
if env['WITH_BF_PLAYER']:
416
 
        playerlist = B.create_blender_liblist(env, 'player')
417
 
        playerlist += B.create_blender_liblist(env, 'intern')
418
 
        playerlist += B.create_blender_liblist(env, 'extern')
419
 
        env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
 
490
    playerlist = B.create_blender_liblist(env, 'player')
 
491
    playerlist += B.create_blender_liblist(env, 'player2')
 
492
    playerlist += B.create_blender_liblist(env, 'intern')
 
493
    playerlist += B.create_blender_liblist(env, 'extern')
 
494
    env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
420
495
 
421
496
##### Now define some targets
422
497
 
426
501
#-- binaries
427
502
blenderinstall = []
428
503
if  env['OURPLATFORM']=='darwin':
429
 
        for prg in B.program_list:
430
 
                bundle = '%s.app' % prg[0]
431
 
                bundledir = os.path.dirname(bundle)
432
 
                for dp, dn, df in os.walk(bundle):
433
 
                        if '.svn' in dn:
434
 
                                dn.remove('.svn')
435
 
                        dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
436
 
                        source=[dp+os.sep+f for f in df]
437
 
                        blenderinstall.append(env.Install(dir=dir,source=source))
 
504
    for prg in B.program_list:
 
505
        bundle = '%s.app' % prg[0]
 
506
        bundledir = os.path.dirname(bundle)
 
507
        for dp, dn, df in os.walk(bundle):
 
508
            if '.svn' in dn:
 
509
                dn.remove('.svn')
 
510
            if '_svn' in dn:
 
511
                dn.remove('_svn')
 
512
            dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
 
513
            source=[dp+os.sep+f for f in df]
 
514
            blenderinstall.append(env.Install(dir=dir,source=source))
438
515
else:
439
 
        if env['WITH_BF_FHS']:  dir= os.path.join(env['BF_INSTALLDIR'], 'bin')
440
 
        else:                                   dir= env['BF_INSTALLDIR']
441
 
        
442
 
        blenderinstall = env.Install(dir=dir, source=B.program_list)
 
516
    blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
443
517
 
444
518
#-- local path = config files in install dir: installdir\VERSION
445
519
#- dont do config and scripts for darwin, it is already in the bundle
449
523
dottargetlist = []
450
524
scriptinstall = []
451
525
 
452
 
if  env['OURPLATFORM']!='darwin':
453
 
                for dp, dn, df in os.walk('bin/.blender'):
454
 
                        if '.svn' in dn:
455
 
                                dn.remove('.svn')
456
 
                        
457
 
                        for f in df:
458
 
                                if not env['WITH_BF_INTERNATIONAL']:
459
 
                                        if 'locale' in dp:
460
 
                                                continue
461
 
                                        if f == '.Blanguages':
462
 
                                                continue
463
 
                                if not env['WITH_BF_FREETYPE']:
464
 
                                        if f.endswith('.ttf'):
465
 
                                                continue
466
 
                                
467
 
                                if 'locale' in dp:
468
 
                                        datafileslist.append(os.path.join(dp,f))
469
 
                                        if env['WITH_BF_FHS']:  dir= os.path.join(*([BLENDERPATH] + ['datafiles'] + dp.split(os.sep)[2:]))      # skip bin/.blender
470
 
                                        else:                                   dir= os.path.join(*([BLENDERPATH] + [VERSION] + ['datafiles'] + dp.split(os.sep)[1:]))  # skip bin
471
 
                                        datafilestargetlist.append(dir + os.sep + f)
472
 
 
473
 
                                else:
474
 
                                        dotblendlist.append(os.path.join(dp, f))
475
 
                                        if env['WITH_BF_FHS']:  dir= os.path.join(*([BLENDERPATH] + ['config'] + dp.split(os.sep)[2:])) # skip bin/.blender
476
 
                                        else:                                   dir= os.path.join(*([BLENDERPATH] + [VERSION] + ['config'] + dp.split(os.sep)[1:]))     # skip bin
477
 
                                        
478
 
                                        dottargetlist.append(dir + os.sep + f)
479
 
                                        
480
 
                dotblenderinstall = []
481
 
                for targetdir,srcfile in zip(dottargetlist, dotblendlist):
482
 
                        td, tf = os.path.split(targetdir)
483
 
                        dotblenderinstall.append(env.Install(dir=td, source=srcfile))
484
 
                for targetdir,srcfile in zip(datafilestargetlist, datafileslist):
485
 
                        td, tf = os.path.split(targetdir)
486
 
                        dotblenderinstall.append(env.Install(dir=td, source=srcfile))
487
 
                
488
 
                if env['WITH_BF_PYTHON']:
489
 
                        #-- local/VERSION/scripts
490
 
                        scriptpaths=['release/scripts']
491
 
                        for scriptpath in scriptpaths:
492
 
                                for dp, dn, df in os.walk(scriptpath):
493
 
                                        if '.svn' in dn:
494
 
                                                dn.remove('.svn')
495
 
                                        
496
 
                                        if env['WITH_BF_FHS']:          dir = BLENDERPATH
497
 
                                        else:                                           dir = os.path.join(env['BF_INSTALLDIR'], VERSION)                               
498
 
                                        dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):]
499
 
                                        
500
 
                                        source=[os.path.join(dp, f) for f in df if f[-3:]!='pyc']
501
 
                                        scriptinstall.append(env.Install(dir=dir,source=source))
 
526
if env['OURPLATFORM']!='darwin':
 
527
    dotblenderinstall = []
 
528
    for targetdir,srcfile in zip(dottargetlist, dotblendlist):
 
529
        td, tf = os.path.split(targetdir)
 
530
        dotblenderinstall.append(env.Install(dir=td, source=srcfile))
 
531
    for targetdir,srcfile in zip(datafilestargetlist, datafileslist):
 
532
        td, tf = os.path.split(targetdir)
 
533
        dotblenderinstall.append(env.Install(dir=td, source=srcfile))
 
534
    
 
535
    if env['WITH_BF_PYTHON']:
 
536
        #-- local/VERSION/scripts
 
537
        scriptpaths=['release/scripts']
 
538
        for scriptpath in scriptpaths:
 
539
            for dp, dn, df in os.walk(scriptpath):
 
540
                if '.svn' in dn:
 
541
                    dn.remove('.svn')
 
542
                if '_svn' in dn:
 
543
                    dn.remove('_svn')
 
544
                if '__pycache__' in dn:  # py3.2 cache dir
 
545
                    dn.remove('__pycache__')
 
546
 
 
547
                # only for testing builds
 
548
                if VERSION_RELEASE_CYCLE == "release" and "addons_contrib" in dn:
 
549
                    dn.remove('addons_contrib')
 
550
 
 
551
                dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
 
552
                dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):]
 
553
 
 
554
                source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
 
555
                # To ensure empty dirs are created too
 
556
                if len(source)==0:
 
557
                    env.Execute(Mkdir(dir))
 
558
                scriptinstall.append(env.Install(dir=dir,source=source))
 
559
        if env['WITH_BF_CYCLES']:
 
560
            # cycles python code
 
561
            dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles')
 
562
            source=os.listdir('intern/cycles/blender/addon')
 
563
            if '.svn' in source: source.remove('.svn')
 
564
            if '_svn' in source: source.remove('_svn')
 
565
            if '__pycache__' in source: source.remove('__pycache__')
 
566
            source=['intern/cycles/blender/addon/'+s for s in source]
 
567
            scriptinstall.append(env.Install(dir=dir,source=source))
 
568
 
 
569
            # cycles kernel code
 
570
            dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel')
 
571
            source=os.listdir('intern/cycles/kernel')
 
572
            if '.svn' in source: source.remove('.svn')
 
573
            if '_svn' in source: source.remove('_svn')
 
574
            if '__pycache__' in source: source.remove('__pycache__')
 
575
            source.remove('kernel.cpp')
 
576
            source.remove('CMakeLists.txt')
 
577
            source.remove('svm')
 
578
            source.remove('osl')
 
579
            source=['intern/cycles/kernel/'+s for s in source]
 
580
            source.append('intern/cycles/util/util_color.h')
 
581
            source.append('intern/cycles/util/util_math.h')
 
582
            source.append('intern/cycles/util/util_transform.h')
 
583
            source.append('intern/cycles/util/util_types.h')
 
584
            scriptinstall.append(env.Install(dir=dir,source=source))
 
585
            # svm
 
586
            dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'svm')
 
587
            source=os.listdir('intern/cycles/kernel/svm')
 
588
            if '.svn' in source: source.remove('.svn')
 
589
            if '_svn' in source: source.remove('_svn')
 
590
            if '__pycache__' in source: source.remove('__pycache__')
 
591
            source=['intern/cycles/kernel/svm/'+s for s in source]
 
592
            scriptinstall.append(env.Install(dir=dir,source=source))
 
593
 
 
594
            # licenses
 
595
            dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license')
 
596
            source=os.listdir('intern/cycles/doc/license')
 
597
            if '.svn' in source: source.remove('.svn')
 
598
            if '_svn' in source: source.remove('_svn')
 
599
            if '__pycache__' in source: source.remove('__pycache__')
 
600
            source.remove('CMakeLists.txt')
 
601
            source=['intern/cycles/doc/license/'+s for s in source]
 
602
            scriptinstall.append(env.Install(dir=dir,source=source))
 
603
 
 
604
            # cuda binaries
 
605
            if env['WITH_BF_CYCLES_CUDA_BINARIES']:
 
606
                dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'lib')
 
607
                for arch in env['BF_CYCLES_CUDA_BINARIES_ARCH']:
 
608
                    kernel_build_dir = os.path.join(B.root_build_dir, 'intern/cycles/kernel')
 
609
                    cubin_file = os.path.join(kernel_build_dir, "kernel_%s.cubin" % arch)
 
610
                    scriptinstall.append(env.Install(dir=dir,source=cubin_file))
 
611
    
 
612
    if env['WITH_BF_INTERNATIONAL']:
 
613
        internationalpaths=['release' + os.sep + 'datafiles']
 
614
        
 
615
        def check_path(path, member):
 
616
            return (member in path.split(os.sep))
 
617
        
 
618
        for intpath in internationalpaths:
 
619
            for dp, dn, df in os.walk(intpath):
 
620
                if '.svn' in dn:
 
621
                    dn.remove('.svn')
 
622
                if '_svn' in dn:
 
623
                    dn.remove('_svn')
 
624
 
 
625
                # we only care about release/datafiles/fonts, release/datafiles/locales
 
626
                if check_path(dp, "fonts") or check_path(dp, "locale"):
 
627
                    pass
 
628
                else:
 
629
                    continue
 
630
                
 
631
                dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
 
632
                dir += os.sep + os.path.basename(intpath) + dp[len(intpath):]
 
633
 
 
634
                source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
 
635
                # To ensure empty dirs are created too
 
636
                if len(source)==0:
 
637
                    env.Execute(Mkdir(dir))
 
638
                scriptinstall.append(env.Install(dir=dir,source=source))
502
639
 
503
640
#-- icons
504
 
if env['OURPLATFORM']=='linux2':
505
 
        iconlist = []
506
 
        icontargetlist = []
507
 
 
508
 
        for tp, tn, tf in os.walk('release/freedesktop/icons'):
509
 
                if '.svn' in tn:
510
 
                        tn.remove('.svn')
511
 
                for f in tf:
512
 
                        iconlist.append(os.path.join(tp, f))
513
 
                        icontargetlist.append( os.path.join(*([BLENDERPATH] + tp.split(os.sep)[2:] + [f])) )
514
 
 
515
 
        iconinstall = []
516
 
        for targetdir,srcfile in zip(icontargetlist, iconlist):
517
 
                td, tf = os.path.split(targetdir)
518
 
                iconinstall.append(env.Install(dir=td, source=srcfile))
 
641
if env['OURPLATFORM']=='linux':
 
642
    iconlist = []
 
643
    icontargetlist = []
 
644
 
 
645
    for tp, tn, tf in os.walk('release/freedesktop/icons'):
 
646
        if '.svn' in tn:
 
647
            tn.remove('.svn')
 
648
        if '_svn' in tn:
 
649
            tn.remove('_svn')
 
650
        for f in tf:
 
651
            iconlist.append(os.path.join(tp, f))
 
652
            icontargetlist.append( os.path.join(*([env['BF_INSTALLDIR']] + tp.split(os.sep)[2:] + [f])) )
 
653
 
 
654
    iconinstall = []
 
655
    for targetdir,srcfile in zip(icontargetlist, iconlist):
 
656
        td, tf = os.path.split(targetdir)
 
657
        iconinstall.append(env.Install(dir=td, source=srcfile))
519
658
 
520
659
# dlls for linuxcross
521
660
# TODO - add more libs, for now this lets blenderlite run
522
661
if env['OURPLATFORM']=='linuxcross':
523
 
        dir=env['BF_INSTALLDIR']
524
 
        source = []
525
 
 
526
 
        if env['WITH_BF_OPENMP']:
527
 
                source += ['../lib/windows/pthreads/lib/pthreadGC2.dll']
528
 
 
529
 
        scriptinstall.append(env.Install(dir=dir, source=source))
 
662
    dir=env['BF_INSTALLDIR']
 
663
    source = []
 
664
 
 
665
    if env['WITH_BF_OPENMP']:
 
666
        source += ['../lib/windows/pthreads/lib/pthreadGC2.dll']
 
667
 
 
668
    scriptinstall.append(env.Install(dir=dir, source=source))
530
669
 
531
670
#-- plugins
532
671
pluglist = []
533
672
plugtargetlist = []
534
673
for tp, tn, tf in os.walk('release/plugins'):
535
 
        if '.svn' in tn:
536
 
                tn.remove('.svn')
537
 
        df = tp[8:] # remove 'release/'
538
 
        for f in tf:
539
 
                pluglist.append(os.path.join(tp, f))
540
 
                plugtargetlist.append( os.path.join(BLENDERPATH, df, f) )
 
674
    if '.svn' in tn:
 
675
        tn.remove('.svn')
 
676
    if '_svn' in tn:
 
677
        tn.remove('_svn')
 
678
    df = tp[8:] # remove 'release/'
 
679
    for f in tf:
 
680
        pluglist.append(os.path.join(tp, f))
 
681
        plugtargetlist.append( os.path.join(env['BF_INSTALLDIR'], VERSION, df, f) )
541
682
 
542
683
 
543
684
# header files for plugins
544
685
pluglist.append('source/blender/blenpluginapi/documentation.h')
545
 
plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'documentation.h'))
 
686
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'documentation.h'))
546
687
pluglist.append('source/blender/blenpluginapi/externdef.h')
547
 
plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'externdef.h'))
 
688
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'externdef.h'))
548
689
pluglist.append('source/blender/blenpluginapi/floatpatch.h')
549
 
plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'floatpatch.h'))
 
690
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'floatpatch.h'))
550
691
pluglist.append('source/blender/blenpluginapi/iff.h')
551
 
plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'iff.h'))
 
692
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'iff.h'))
552
693
pluglist.append('source/blender/blenpluginapi/plugin.h')
553
 
plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'plugin.h'))
 
694
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'plugin.h'))
554
695
pluglist.append('source/blender/blenpluginapi/util.h')
555
 
plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'util.h'))
 
696
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'util.h'))
556
697
pluglist.append('source/blender/blenpluginapi/plugin.DEF')
557
 
plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'plugin.def'))
 
698
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'plugin.def'))
558
699
 
559
700
plugininstall = []
560
 
for targetdir,srcfile in zip(plugtargetlist, pluglist):
561
 
        td, tf = os.path.split(targetdir)
562
 
        plugininstall.append(env.Install(dir=td, source=srcfile))
 
701
# plugins in blender 2.5 don't work at the moment.
 
702
#for targetdir,srcfile in zip(plugtargetlist, pluglist):
 
703
#    td, tf = os.path.split(targetdir)
 
704
#    plugininstall.append(env.Install(dir=td, source=srcfile))
563
705
 
564
706
textlist = []
565
707
texttargetlist = []
566
708
for tp, tn, tf in os.walk('release/text'):
567
 
        if '.svn' in tn:
568
 
                tn.remove('.svn')
569
 
        for f in tf:
570
 
                textlist.append(tp+os.sep+f)
 
709
    if '.svn' in tn:
 
710
        tn.remove('.svn')
 
711
    if '_svn' in tn:
 
712
        tn.remove('_svn')
 
713
    for f in tf:
 
714
        textlist.append(tp+os.sep+f)
571
715
 
572
 
textinstall = env.Install(dir=BLENDERPATH, source=textlist)
 
716
textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
573
717
 
574
718
if  env['OURPLATFORM']=='darwin':
575
 
                allinstall = [blenderinstall, plugininstall, textinstall]
576
 
elif env['OURPLATFORM']=='linux2':
577
 
                allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
 
719
        allinstall = [blenderinstall, plugininstall, textinstall]
 
720
elif env['OURPLATFORM']=='linux':
 
721
        allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
578
722
else:
579
 
                allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
 
723
        allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
580
724
 
581
725
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
582
 
        dllsources = []
583
 
 
584
 
        if not env['OURPLATFORM'] in ('win32-mingw', 'win64-vc', 'linuxcross'):
585
 
                # For MinGW and linuxcross static linking will be used
586
 
                dllsources += ['${LCGDIR}/gettext/lib/gnu_gettext.dll']
587
 
 
588
 
        #currently win64-vc doesn't appear to have libpng.dll
589
 
        if env['OURPLATFORM'] != 'win64-vc':
590
 
                dllsources += ['${BF_PNG_LIBPATH}/libpng.dll']
591
 
 
592
 
        dllsources += ['${BF_ZLIB_LIBPATH}/zlib.dll']
593
 
        # Used when linking to libtiff was dynamic
594
 
        # keep it here until compilation on all platform would be ok
595
 
        # dllsources += ['${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
596
 
 
597
 
        if env['OURPLATFORM'] != 'linuxcross':
598
 
                # pthreads library is already added
599
 
                dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
600
 
 
601
 
        if env['WITH_BF_SDL']:
602
 
                if env['OURPLATFORM'] == 'win64-vc':
603
 
                        pass # we link statically already to SDL on win64
604
 
                else:
605
 
                        dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
606
 
 
607
 
        if env['WITH_BF_PYTHON']:
608
 
                if env['BF_DEBUG']:
609
 
                        dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
610
 
                else:
611
 
                        dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
612
 
 
613
 
        if env['WITH_BF_ICONV']:
614
 
                if env['OURPLATFORM'] == 'win64-vc':
615
 
                        pass # we link statically to iconv on win64
616
 
                elif not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
617
 
                        #gettext for MinGW and cross-compilation is compiled staticly
618
 
                        dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
619
 
 
620
 
        if env['WITH_BF_OPENAL']:
621
 
                dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
622
 
                dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
623
 
 
624
 
        if env['WITH_BF_SNDFILE']:
625
 
                dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
626
 
 
627
 
        if env['WITH_BF_FFMPEG']:
628
 
                dllsources += ['${BF_FFMPEG_LIBPATH}/avcodec-52.dll',
629
 
                                        '${BF_FFMPEG_LIBPATH}/avformat-52.dll',
630
 
                                        '${BF_FFMPEG_LIBPATH}/avdevice-52.dll',
631
 
                                        '${BF_FFMPEG_LIBPATH}/avutil-50.dll',
632
 
                                        '${BF_FFMPEG_LIBPATH}/swscale-0.dll']
633
 
        windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
634
 
        allinstall += windlls
 
726
    dllsources = []
 
727
 
 
728
    if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
 
729
        # For MinGW and linuxcross static linking will be used
 
730
        dllsources += ['${LCGDIR}/gettext/lib/gnu_gettext.dll']
 
731
 
 
732
    dllsources += ['${BF_ZLIB_LIBPATH}/zlib.dll']
 
733
    # Used when linking to libtiff was dynamic
 
734
    # keep it here until compilation on all platform would be ok
 
735
    # dllsources += ['${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
 
736
 
 
737
    if env['OURPLATFORM'] != 'linuxcross':
 
738
        # pthreads library is already added
 
739
        dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
 
740
 
 
741
    if env['WITH_BF_SDL']:
 
742
        if env['OURPLATFORM'] == 'win64-vc':
 
743
            pass # we link statically already to SDL on win64
 
744
        else:
 
745
            dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
 
746
 
 
747
    if env['WITH_BF_PYTHON']:
 
748
        if env['BF_DEBUG']:
 
749
            dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
 
750
        else:
 
751
            dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
 
752
 
 
753
    if env['WITH_BF_ICONV']:
 
754
        if env['OURPLATFORM'] == 'win64-vc':
 
755
            pass # we link statically to iconv on win64
 
756
        elif not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
 
757
            #gettext for MinGW and cross-compilation is compiled staticly
 
758
            dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
 
759
 
 
760
    if env['WITH_BF_OPENAL']:
 
761
        dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
 
762
        dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
 
763
 
 
764
    if env['WITH_BF_SNDFILE']:
 
765
        dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
 
766
 
 
767
    if env['WITH_BF_FFMPEG']:
 
768
        dllsources += env['BF_FFMPEG_DLL'].split()
 
769
 
 
770
    # Since the thumb handler is loaded by Explorer, architecture is
 
771
    # strict: the x86 build fails on x64 Windows. We need to ship
 
772
    # both builds in x86 packages.
 
773
    if bitness == 32:
 
774
        dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll')  
 
775
    dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
 
776
 
 
777
    if env['WITH_BF_OIIO'] and env['OURPLATFORM'] != 'win32-mingw':
 
778
        dllsources.append('${LCGDIR}/openimageio/bin/OpenImageIO.dll')
 
779
 
 
780
    dllsources.append('#source/icons/blender.exe.manifest')
 
781
 
 
782
    windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
 
783
    allinstall += windlls
 
784
 
 
785
if env['OURPLATFORM'] == 'win64-mingw':
 
786
    dllsources = []
 
787
    
 
788
    if env['WITH_BF_PYTHON']:
 
789
        if env['BF_DEBUG']:
 
790
            dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
 
791
        else:
 
792
            dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
 
793
 
 
794
    if env['WITH_BF_FFMPEG']:
 
795
        dllsources += env['BF_FFMPEG_DLL'].split()
 
796
 
 
797
    if env['WITH_BF_OPENAL']:
 
798
        dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
 
799
        dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
 
800
 
 
801
    if env['WITH_BF_SNDFILE']:
 
802
        dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
 
803
 
 
804
    if env['WITH_BF_SDL']:
 
805
        dllsources.append('${LCGDIR}/sdl/lib/SDL.dll')
 
806
        
 
807
    dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
 
808
    dllsources.append('#source/icons/blender.exe.manifest')
 
809
 
 
810
    windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
 
811
    allinstall += windlls
635
812
 
636
813
installtarget = env.Alias('install', allinstall)
637
814
bininstalltarget = env.Alias('install-bin', blenderinstall)
641
818
nsisalias = env.Alias('nsis', nsiscmd)
642
819
 
643
820
if 'blender' in B.targets:
644
 
        blenderexe= env.Alias('blender', B.program_list)
645
 
        Depends(blenderexe,installtarget)
 
821
    blenderexe= env.Alias('blender', B.program_list)
 
822
    Depends(blenderexe,installtarget)
646
823
 
647
824
if env['WITH_BF_PLAYER']:
648
 
        blenderplayer = env.Alias('blenderplayer', B.program_list)
649
 
        Depends(blenderplayer,installtarget)
 
825
    blenderplayer = env.Alias('blenderplayer', B.program_list)
 
826
    Depends(blenderplayer,installtarget)
650
827
 
651
828
if not env['WITH_BF_GAMEENGINE']:
652
 
        blendernogame = env.Alias('blendernogame', B.program_list)
653
 
        Depends(blendernogame,installtarget)
 
829
    blendernogame = env.Alias('blendernogame', B.program_list)
 
830
    Depends(blendernogame,installtarget)
654
831
 
655
832
if 'blenderlite' in B.targets:
656
 
        blenderlite = env.Alias('blenderlite', B.program_list)
657
 
        Depends(blenderlite,installtarget)
 
833
    blenderlite = env.Alias('blenderlite', B.program_list)
 
834
    Depends(blenderlite,installtarget)
658
835
 
659
836
Depends(nsiscmd, allinstall)
660
837
 
 
838
buildslave_action = env.Action(btools.buildslave, btools.buildslave_print)
 
839
buildslave_cmd = env.Command('buildslave_exec', None, buildslave_action)
 
840
buildslave_alias = env.Alias('buildslave', buildslave_cmd)
 
841
 
 
842
Depends(buildslave_cmd, allinstall)
 
843
 
661
844
Default(B.program_list)
662
845
 
663
846
if not env['WITHOUT_BF_INSTALL']:
664
 
                Default(installtarget)
665
 
 
666
 
#------------ EPYDOC
667
 
if env['WITH_BF_DOCS']:
668
 
    try:
669
 
        import epydoc
670
 
    except ImportError:
671
 
        epydoc = None
672
 
 
673
 
    if epydoc:
674
 
        SConscript('source/gameengine/PyDoc/SConscript')
675
 
    else:
676
 
        print "No epydoc install detected, Python API and Gameengine API Docs will not be generated "
677
 
 
 
847
        Default(installtarget)
678
848