diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2013-04-20 17:24:51 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2013-04-20 17:24:51 (GMT) |
commit | 5fa8bd52909b7b5ba900b71f7aef5bf17aa9adc3 (patch) | |
tree | 8fc4b6ca62753e3943cbdddff5c80832dea7e296 | |
parent | 8ccc88f6a9e8ad685099c8407d582e55154da242 (diff) | |
parent | 08f0348e313d03a65e30f16c049c6a70faa0abf8 (diff) | |
download | SCons-5fa8bd52909b7b5ba900b71f7aef5bf17aa9adc3.zip SCons-5fa8bd52909b7b5ba900b71f7aef5bf17aa9adc3.tar.gz SCons-5fa8bd52909b7b5ba900b71f7aef5bf17aa9adc3.tar.bz2 |
Merged in bdbaddog/scons (pull request #70: MSVC2012 stuff)
-rw-r--r-- | src/CHANGES.txt | 8 | ||||
-rw-r--r-- | src/engine/SCons/Environment.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/common.py | 17 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/vc.py | 24 |
4 files changed, 45 insertions, 8 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index be43b16..e2f5e09 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -9,6 +9,14 @@ RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE From Gary Oberbrunner: - Test harness: fail_test() can now print a message to help debugging. + From William Deegan: + - VS2012 & VS2010 Resolve initialization issues by adding path to reg.exe + in shell used to run batch files. + - MSVC Support fixed defaulting TARGET_ARCH to HOST_ARCH. It should be + None if not explicitly set. + - MSVC Fixed issue where if more than one Architectures compilers are + detected, it would take the last one found, and not the first. + From Philipp Kraus: - Added optional ZIPROOT to Zip tool. diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 8cc033e..55a8206 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -966,8 +966,8 @@ class Base(SubstitutionEnvironment): self._dict['HOST_ARCH'] = self._dict.get('HOST_ARCH',None) # Now set defaults for TARGET_{OS|ARCH} - self._dict['TARGET_OS'] = self._dict.get('HOST_OS',None) - self._dict['TARGET_ARCH'] = self._dict.get('HOST_ARCH',None) + self._dict['TARGET_OS'] = self._dict.get('TARGET_OS',None) + self._dict['TARGET_ARCH'] = self._dict.get('TARGET_ARCH',None) # Apply the passed-in and customizable variables to the diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py index 4f8ee8c..3d220ae 100644 --- a/src/engine/SCons/Tool/MSCommon/common.py +++ b/src/engine/SCons/Tool/MSCommon/common.py @@ -120,6 +120,13 @@ def normalize_env(env, keys, force=False): if k in os.environ and (force or not k in normenv): normenv[k] = os.environ[k].encode('mbcs') + sys32_dir = os.path.join(os.environ.get("SystemRoot", os.environ.get("windir",r"C:\Windows\system32")),"System32") + + if sys32_dir not in normenv['PATH']: + normenv['PATH'] = normenv['PATH'] + os.pathsep + sys32_dir + + debug("PATH: %s"%normenv['PATH']) + return normenv def get_output(vcbat, args = None, env = None): @@ -136,8 +143,9 @@ def get_output(vcbat, args = None, env = None): # settings in vs.py. vars = [ 'COMSPEC', - 'VS110COMNTOOLS', - 'VS100COMNTOOLS', +# Still set, but setup script will discard these if registry has values. +# 'VS110COMNTOOLS', +# 'VS100COMNTOOLS', 'VS90COMNTOOLS', 'VS80COMNTOOLS', 'VS71COMNTOOLS', @@ -166,6 +174,11 @@ def get_output(vcbat, args = None, env = None): # and won't work under Pythons not built with threading. stdout = popen.stdout.read() stderr = popen.stderr.read() + + # Extra debug logic, uncomment if necessar +# debug('get_output():stdout:%s'%stdout) +# debug('get_output():stderr:%s'%stderr) + if stderr: # TODO: find something better to do with stderr; # this at least prevents errors from getting swallowed. diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index a3a8952..1266ee8 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -81,6 +81,7 @@ _ARCH_TO_CANONICAL = { "itanium" : "ia64", "x86" : "x86", "x86_64" : "amd64", + "x86_amd64" : "x86_amd64", # Cross compile to 64 bit from 32bits } # Given a (host, target) tuple, return the argument for the bat file. Both host @@ -88,6 +89,7 @@ _ARCH_TO_CANONICAL = { _HOST_TARGET_ARCH_TO_BAT_ARCH = { ("x86", "x86"): "x86", ("x86", "amd64"): "x86_amd64", + ("amd64", "x86_amd64"): "x86_amd64", # This is present in (at least) VS2012 express ("amd64", "amd64"): "amd64", ("amd64", "x86"): "x86", ("x86", "ia64"): "x86_ia64" @@ -357,13 +359,23 @@ def msvc_find_valid_batch_script(env,version): # target platform (host_platform, target_platform,req_target_platform) = get_host_target(env) - # If the user hasn't specifically requested a TARGET_ARCH, and - # The TARGET_ARCH is amd64 then also try 32 bits if there are no viable - # 64 bit tools installed try_target_archs = [target_platform] - if not req_target_platform and target_platform in ('amd64','x86_64'): + debug("msvs_find_valid_batch_script(): req_target_platform %s target_platform:%s"%(req_target_platform,target_platform)) + + # VS2012 has a "cross compile" environment to build 64 bit + # with x86_amd64 as the argument to the batch setup script + if req_target_platform in ('amd64','x86_64'): + try_target_archs.append('x86_amd64') + elif not req_target_platform and target_platform in ['amd64','x86_64']: + # There may not be "native" amd64, but maybe "cross" x86_amd64 tools + try_target_archs.append('x86_amd64') + # If the user hasn't specifically requested a TARGET_ARCH, and + # The TARGET_ARCH is amd64 then also try 32 bits if there are no viable + # 64 bit tools installed try_target_archs.append('x86') + debug("msvs_find_valid_batch_script(): host_platform: %s try_target_archs:%s"%(host_platform, try_target_archs)) + d = None for tp in try_target_archs: # Set to current arch. @@ -399,6 +411,7 @@ def msvc_find_valid_batch_script(env,version): except BatchFileExecutionError, e: debug('vc.py:msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e)) vc_script=None + continue if not vc_script and sdk_script: debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) try: @@ -409,6 +422,9 @@ def msvc_find_valid_batch_script(env,version): elif not vc_script and not sdk_script: debug('vc.py:msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found') continue + + debug("vc.py:msvc_find_valid_batch_script() Found a working script/target: %s %s"%(repr(sdk_script),arg)) + break # We've found a working target_platform, so stop looking # If we cannot find a viable installed compiler, reset the TARGET_ARCH # To it's initial value |