Commits

William Deegan committed 6c6ed54

should resolve issues with VS2012 (and probably VS2010) on 64(and probably 32)bit win. Addressing at least bugs 2883 and 2817

Comments (0)

Files changed (2)

src/engine/SCons/Tool/MSCommon/common.py

             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):
     # 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',
     # 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.

src/engine/SCons/Tool/MSCommon/vc.py

     "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
 _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"
     # 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.
             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:
         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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.