SCons: cleaner determination of 32-bit/64-bit builds

Try not to be x86-centric, remove unneeded blenderdeps variable.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D240
This commit is contained in:
Lawrence D'Oliveiro
2014-02-04 18:55:32 +01:00
committed by Brecht Van Lommel
parent 959da7477d
commit cb0a5adc56
3 changed files with 12 additions and 27 deletions

View File

@@ -33,14 +33,6 @@
# TODO: directory copy functions are far too complicated, see:
# http://wiki.blender.org/index.php/User:Ideasman42/SConsNotSimpleInstallingFiles
import platform as pltfrm
# Need a better way to do this. Automagical maybe is not the best thing, maybe it is.
if pltfrm.architecture()[0] == '64bit':
bitness = 64
else:
bitness = 32
import sys
import os
import os.path
@@ -112,16 +104,10 @@ btools.print_targets(B.targets, B.bc)
# handling cmd line arguments & config file
# bitness stuff
tempbitness = int(B.arguments.get('BF_BITNESS', bitness)) # default to bitness found as per starting python
if tempbitness in (32, 64): # only set if 32 or 64 has been given
bitness = int(tempbitness)
if bitness:
B.bitness = bitness
else:
tempbitness = int(B.arguments.get('BF_BITNESS', B.bitness)) # default to bitness found as per starting python
if tempbitness in B.allowed_bitnesses.values() :
B.bitness = tempbitness
# first check cmdline for toolset and we create env to work on
quickie = B.arguments.get('BF_QUICK', None)
quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
@@ -149,7 +135,7 @@ if toolset:
if env:
btools.SetupSpawn(env)
else:
if bitness==64 and platform=='win32':
if B.bitness==64 and platform=='win32':
env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64', TARGET_ARCH='x86_64', MSVC_VERSION=vcver)
else:
env = BlenderEnvironment(ENV = os.environ, TARGET_ARCH='x86', MSVC_VERSION=vcver)
@@ -167,9 +153,9 @@ if cxx:
if sys.platform=='win32':
if env['CC'] in ['cl', 'cl.exe']:
platform = 'win64-vc' if bitness == 64 else 'win32-vc'
platform = 'win64-vc' if B.bitness == 64 else 'win32-vc'
elif env['CC'] in ['gcc']:
platform = 'win64-mingw' if bitness == 64 else 'win32-mingw'
platform = 'win64-mingw' if B.bitness == 64 else 'win32-mingw'
if 'mingw' in platform:
print "Setting custom spawn function"
@@ -219,7 +205,7 @@ opts = btools.read_opts(env, optfiles, B.arguments)
opts.Update(env)
if sys.platform=='win32':
if bitness==64:
if B.bitness==64:
env.Append(CPPFLAGS=['-DWIN64']) # -DWIN32 needed too, as it's used all over to target Windows generally
if not env['BF_FANCY']:
@@ -1111,7 +1097,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
# Since the thumb handler is loaded by Explorer, architecture is
# strict: the x86 build fails on x64 Windows. We need to ship
# both builds in x86 packages.
if bitness == 32:
if B.bitness == 32:
dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll')
dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')

View File

@@ -1,4 +1,5 @@
import os
import platform
def FindPython():
all_abi_flags = ['m', 'mu', '']
@@ -7,7 +8,7 @@ def FindPython():
abi_flags = "m" # Most common for linux distros
version = "3.3"
_arch = "x86_64-linux-gnu"
_arch = platform.uname()[4] + "-linux-gnu"
# Determine ABI flags used on this system
include = os.path.join(python, "include")

View File

@@ -15,8 +15,8 @@ to kill any code duplication
"""
import os
import os.path
import string
import ctypes as ct
import glob
import time
import sys
@@ -51,10 +51,8 @@ program_list = [] # A list holding Nodes to final binaries, used to create insta
arguments = None
targets = None
resources = []
bitness = 0
#some internals
blenderdeps = [] # don't manipulate this one outside this module!
allowed_bitnesses = {4 : 32, 8 : 64} # only expecting 32-bit or 64-bit
bitness = allowed_bitnesses[ct.sizeof(ct.c_void_p)]
##### LIB STUFF ##########