summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-11-19 04:57:30 (GMT)
committerDavid Cournapeau <cournape@gmail.com>2009-11-19 04:57:30 (GMT)
commit5fab4fb36d92d61f5cb79c147dd2f2b592c744ee (patch)
treeaa27b5d6251b82cbd700905865f2ddf299548b6b
parent42e13c090772ab22fb5b7700f8fa5932d0501399 (diff)
downloadSCons-5fab4fb36d92d61f5cb79c147dd2f2b592c744ee.zip
SCons-5fab4fb36d92d61f5cb79c147dd2f2b592c744ee.tar.gz
SCons-5fab4fb36d92d61f5cb79c147dd2f2b592c744ee.tar.bz2
BUG: fix cross-compilation from x86 -> x86_64 for VS 2008.
-rw-r--r--src/engine/SCons/Tool/MSCommon/vc.py31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py
index 8d5dba8..6a49196 100644
--- a/src/engine/SCons/Tool/MSCommon/vc.py
+++ b/src/engine/SCons/Tool/MSCommon/vc.py
@@ -27,6 +27,7 @@ __doc__ = """Module for Visual C/C++ detection and configuration.
"""
import os
+import platform
import SCons.Warnings
@@ -298,21 +299,35 @@ def get_default_version(env):
return msvc_version
-_TARGET_ARCH_TO_BAT_ARCH = {
- "x86_64": "amd64",
+# Dict to 'canonalize' the arch
+_ARCH_TO_CANONICAL = {
+ "x86": "x86",
+ "amd64": "amd64",
"i386": "x86",
- "amd64": "amd64"}
+ "emt64": "amd64",
+ "x86_64": "amd64"
+}
+
+# Given a (host, target) tuple, return the argument for the bat file. Both host
+# and targets should be canonalized.
+_HOST_TARGET_ARCH_TO_BAT_ARCH = {
+ ("x86", "x86"): "x86",
+ ("x86", "amd64"): "x86_amd64",
+ ("amd64", "amd64"): "amd64",
+ ("amd64", "x86"): "x86"
+}
def get_host_target(env):
host_platform = env.get('HOST_ARCH')
if not host_platform:
#host_platform = get_default_host_platform()
- host_platform = 'x86'
+ host_platform = platform.machine()
target_platform = env.get('TARGET_ARCH')
if not target_platform:
target_platform = host_platform
- return host_platform, target_platform
+ return (_ARCH_TO_CANONICAL[host_platform],
+ _ARCH_TO_CANONICAL[target_platform])
def msvc_setup_env_once(env):
try:
@@ -347,9 +362,9 @@ def msvc_setup_env(env):
# XXX: this is VS 2008 specific, fix this
script = os.path.join(msvc.find_vc_dir(), "vcvarsall.bat")
- arch = _TARGET_ARCH_TO_BAT_ARCH[target_platform]
- debug('use_script 2 %s, args:%s\n' % (repr(script), arch))
- d = script_env(script, args=arch)
+ arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[(host_platform, target_platform)]
+ debug('use_script 2 %s, args:%s\n' % (repr(script), arg))
+ d = script_env(script, args=arg)
else:
debug('msvc.get_default_env()\n')
d = msvc.get_default_env()