aboutsummaryrefslogtreecommitdiff
path: root/mesalib/scons/gallium.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/scons/gallium.py')
-rw-r--r--mesalib/scons/gallium.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/mesalib/scons/gallium.py b/mesalib/scons/gallium.py
index d51ffb5aa..ac8888cf6 100644
--- a/mesalib/scons/gallium.py
+++ b/mesalib/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
@@ -141,6 +142,10 @@ def pkg_config_modules(env, name, modules):
def generate(env):
"""Common environment generation code"""
+ # Tell tools which machine to compile for
+ env['TARGET_ARCH'] = env['machine']
+ env['MSVS_ARCH'] = env['machine']
+
# Toolchain
platform = env['platform']
if env['toolchain'] == 'default':
@@ -175,6 +180,10 @@ def generate(env):
env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
env['msvc'] = env['CC'] == 'cl'
+ if env['msvc'] and env['toolchain'] == 'default' and env['machine'] == 'x86_64':
+ # MSVC x64 support is broken in earlier versions of scons
+ env.EnsurePythonVersion(2, 0)
+
# shortcuts
machine = env['machine']
platform = env['platform']
@@ -183,6 +192,24 @@ 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
+ env['hostonly'] = False
+
# Backwards compatability with the debug= profile= options
if env['build'] == 'debug':
if not env['debug']:
@@ -349,12 +376,15 @@ def generate(env):
'-m32',
#'-march=pentium4',
]
- if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2'):
+ if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2') \
+ and (platform != 'windows' or env['build'] == 'debug' or True):
# NOTE: We need to ensure stack is realigned given that we
# produce shared objects, and have no control over the stack
# alignment policy of the application. Therefore we need
# -mstackrealign ore -mincoming-stack-boundary=2.
#
+ # XXX: -O and -mstackrealign causes stack corruption on MinGW
+ #
# XXX: We could have SSE without -mstackrealign if we always used
# __attribute__((force_align_arg_pointer)), but that's not
# always the case.