Skip to content
Snippets Groups Projects
Commit cb0a5adc authored by Lawrence D'Oliveiro's avatar Lawrence D'Oliveiro Committed by Brecht Van Lommel
Browse files

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
parent 959da747
No related branches found
No related tags found
No related merge requests found
...@@ -33,14 +33,6 @@ ...@@ -33,14 +33,6 @@
# TODO: directory copy functions are far too complicated, see: # TODO: directory copy functions are far too complicated, see:
# http://wiki.blender.org/index.php/User:Ideasman42/SConsNotSimpleInstallingFiles # 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 sys
import os import os
import os.path import os.path
...@@ -112,16 +104,10 @@ btools.print_targets(B.targets, B.bc) ...@@ -112,16 +104,10 @@ btools.print_targets(B.targets, B.bc)
# handling cmd line arguments & config file # handling cmd line arguments & config file
# bitness stuff # bitness stuff
tempbitness = int(B.arguments.get('BF_BITNESS', bitness)) # default to bitness found as per starting python tempbitness = int(B.arguments.get('BF_BITNESS', B.bitness)) # default to bitness found as per starting python
if tempbitness in (32, 64): # only set if 32 or 64 has been given if tempbitness in B.allowed_bitnesses.values() :
bitness = int(tempbitness)
if bitness:
B.bitness = bitness
else:
B.bitness = tempbitness B.bitness = tempbitness
# first check cmdline for toolset and we create env to work on # first check cmdline for toolset and we create env to work on
quickie = B.arguments.get('BF_QUICK', None) quickie = B.arguments.get('BF_QUICK', None)
quickdebug = B.arguments.get('BF_QUICKDEBUG', None) quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
...@@ -149,7 +135,7 @@ if toolset: ...@@ -149,7 +135,7 @@ if toolset:
if env: if env:
btools.SetupSpawn(env) btools.SetupSpawn(env)
else: 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) env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64', TARGET_ARCH='x86_64', MSVC_VERSION=vcver)
else: else:
env = BlenderEnvironment(ENV = os.environ, TARGET_ARCH='x86', MSVC_VERSION=vcver) env = BlenderEnvironment(ENV = os.environ, TARGET_ARCH='x86', MSVC_VERSION=vcver)
...@@ -167,9 +153,9 @@ if cxx: ...@@ -167,9 +153,9 @@ if cxx:
if sys.platform=='win32': if sys.platform=='win32':
if env['CC'] in ['cl', 'cl.exe']: 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']: 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: if 'mingw' in platform:
print "Setting custom spawn function" print "Setting custom spawn function"
...@@ -219,7 +205,7 @@ opts = btools.read_opts(env, optfiles, B.arguments) ...@@ -219,7 +205,7 @@ opts = btools.read_opts(env, optfiles, B.arguments)
opts.Update(env) opts.Update(env)
if sys.platform=='win32': 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 env.Append(CPPFLAGS=['-DWIN64']) # -DWIN32 needed too, as it's used all over to target Windows generally
if not env['BF_FANCY']: if not env['BF_FANCY']:
...@@ -1111,7 +1097,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): ...@@ -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 # Since the thumb handler is loaded by Explorer, architecture is
# strict: the x86 build fails on x64 Windows. We need to ship # strict: the x86 build fails on x64 Windows. We need to ship
# both builds in x86 packages. # both builds in x86 packages.
if bitness == 32: if B.bitness == 32:
dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll') dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll')
dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll') dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
......
import os import os
import platform
def FindPython(): def FindPython():
all_abi_flags = ['m', 'mu', ''] all_abi_flags = ['m', 'mu', '']
...@@ -7,7 +8,7 @@ def FindPython(): ...@@ -7,7 +8,7 @@ def FindPython():
abi_flags = "m" # Most common for linux distros abi_flags = "m" # Most common for linux distros
version = "3.3" version = "3.3"
_arch = "x86_64-linux-gnu" _arch = platform.uname()[4] + "-linux-gnu"
# Determine ABI flags used on this system # Determine ABI flags used on this system
include = os.path.join(python, "include") include = os.path.join(python, "include")
......
...@@ -15,8 +15,8 @@ to kill any code duplication ...@@ -15,8 +15,8 @@ to kill any code duplication
""" """
import os import os
import os.path
import string import string
import ctypes as ct
import glob import glob
import time import time
import sys import sys
...@@ -51,10 +51,8 @@ program_list = [] # A list holding Nodes to final binaries, used to create insta ...@@ -51,10 +51,8 @@ program_list = [] # A list holding Nodes to final binaries, used to create insta
arguments = None arguments = None
targets = None targets = None
resources = [] resources = []
bitness = 0 allowed_bitnesses = {4 : 32, 8 : 64} # only expecting 32-bit or 64-bit
bitness = allowed_bitnesses[ct.sizeof(ct.c_void_p)]
#some internals
blenderdeps = [] # don't manipulate this one outside this module!
##### LIB STUFF ########## ##### LIB STUFF ##########
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment