diff options
author | William Deegan <bill@baddogconsulting.com> | 2013-04-11 06:35:53 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2013-04-11 06:35:53 (GMT) |
commit | 58f7387b4eaf8a206edd765160715f644e10d3ab (patch) | |
tree | 522cb936987cd4dd8bc953028b26ae8c6af4c18b /src | |
parent | ea3cb031a0cdb496877bb22a65d2d5f6df6fdf14 (diff) | |
download | SCons-58f7387b4eaf8a206edd765160715f644e10d3ab.zip SCons-58f7387b4eaf8a206edd765160715f644e10d3ab.tar.gz SCons-58f7387b4eaf8a206edd765160715f644e10d3ab.tar.bz2 |
should resolve issues with VS2012 (and probably VS2010) on 64(and probably 32)bit win. Addressing at least bugs 2883 and 2817
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/common.py | 17 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/vc.py | 24 |
2 files changed, 35 insertions, 6 deletions
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 |