summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2011-02-11 16:44:13 +0000
committerJosé Fonseca <jfonseca@vmware.com>2011-02-11 20:09:26 +0000
commitae760279f142244590c8aa76e3139529ca42952f (patch)
treed293943af92cd7514536d9506d52858bf772225c
parent051f8bbfee6618e8bf04712cf214d96cec433e38 (diff)
downloadexternal_mesa3d-ae760279f142244590c8aa76e3139529ca42952f.zip
external_mesa3d-ae760279f142244590c8aa76e3139529ca42952f.tar.gz
external_mesa3d-ae760279f142244590c8aa76e3139529ca42952f.tar.bz2
scons: Try to support building 64bit binaries on 32bit windows.
-rw-r--r--SConstruct2
-rw-r--r--common.py12
-rwxr-xr-xscons/gallium.py18
-rw-r--r--src/glsl/SConscript5
4 files changed, 22 insertions, 15 deletions
diff --git a/SConstruct b/SConstruct
index a2c2047..3908840 100644
--- a/SConstruct
+++ b/SConstruct
@@ -132,7 +132,7 @@ Export('env')
#
# Create host environent
-if env['platform'] != common.host_platform:
+if env['crosscompile'] and env['platform'] != 'embedded':
host_env = Environment(
options = opts,
# no tool used
diff --git a/common.py b/common.py
index cbb6162..e794126 100644
--- a/common.py
+++ b/common.py
@@ -14,13 +14,7 @@ import SCons.Script.SConscript
#######################################################################
# Defaults
-_platform_map = {
- 'linux2': 'linux',
- 'win32': 'windows',
-}
-
-host_platform = sys.platform
-host_platform = _platform_map.get(host_platform, host_platform)
+host_platform = _platform.system().lower()
# Search sys.argv[] for a "platform=foo" argument since we don't have
# an 'env' variable at this point.
@@ -29,8 +23,6 @@ if 'platform' in SCons.Script.ARGUMENTS:
else:
target_platform = host_platform
-cross_compiling = target_platform != host_platform
-
_machine_map = {
'x86': 'x86',
'i386': 'x86',
@@ -52,7 +44,7 @@ host_machine = _machine_map.get(host_machine, 'generic')
default_machine = host_machine
default_toolchain = 'default'
-if target_platform == 'windows' and cross_compiling:
+if target_platform == 'windows' and host_platform != 'windows':
default_machine = 'x86'
default_toolchain = 'crossmingw'
diff --git a/scons/gallium.py b/scons/gallium.py
index ea09b5d..f9a2e59 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -35,6 +35,7 @@ import os
import os.path
import re
import subprocess
+import platform as _platform
import SCons.Action
import SCons.Builder
@@ -191,6 +192,23 @@ def generate(env):
gcc = env['gcc']
msvc = env['msvc']
+ # Determine whether we are cross compiling; in particular, whether we need
+ # to compile code generators with a different compiler as the target code.
+ host_platform = _platform.system().lower()
+ host_machine = os.environ.get('PROCESSOR_ARCHITECTURE', _platform.machine())
+ host_machine = {
+ 'x86': 'x86',
+ 'i386': 'x86',
+ 'i486': 'x86',
+ 'i586': 'x86',
+ 'i686': 'x86',
+ 'ppc' : 'ppc',
+ 'x86_64': 'x86_64',
+ }.get(host_machine, 'generic')
+ env['crosscompile'] = platform != host_platform
+ if machine == 'x86_64' and host_machine != 'x86_64':
+ env['crosscompile'] = True
+
# Backwards compatability with the debug= profile= options
if env['build'] == 'debug':
if not env['debug']:
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index f55d7de..ca17ddd 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -82,7 +82,7 @@ sources = [
]
-if env['platform'] == common.host_platform:
+if not env['crosscompile'] or env['platform'] == 'embedded':
if env['msvc']:
env.Prepend(CPPPATH = ['#/src/getopt'])
env.PrependUnique(LIBS = [getopt])
@@ -105,9 +105,6 @@ if env['platform'] == common.host_platform:
Export('builtin_glsl_function')
- if common.cross_compiling:
- Return()
-
sources += builtin_glsl_function
glsl = env.ConvenienceLibrary(