| OLD | NEW |
| 1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 Google Inc. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Handle version information related to Visual Stuio.""" | 5 """Handle version information related to Visual Stuio.""" |
| 6 | 6 |
| 7 import errno | 7 import errno |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import subprocess | 10 import subprocess |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 assert target_arch in ('x86', 'x64') | 76 assert target_arch in ('x86', 'x64') |
| 77 sdk_dir = os.environ.get('WindowsSDKDir') | 77 sdk_dir = os.environ.get('WindowsSDKDir') |
| 78 if self.sdk_based and sdk_dir: | 78 if self.sdk_based and sdk_dir: |
| 79 return [os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')), | 79 return [os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')), |
| 80 '/' + target_arch] | 80 '/' + target_arch] |
| 81 else: | 81 else: |
| 82 # We don't use VC/vcvarsall.bat for x86 because vcvarsall calls | 82 # We don't use VC/vcvarsall.bat for x86 because vcvarsall calls |
| 83 # vcvars32, which it can only find if VS??COMNTOOLS is set, which it | 83 # vcvars32, which it can only find if VS??COMNTOOLS is set, which it |
| 84 # isn't always. | 84 # isn't always. |
| 85 if target_arch == 'x86': | 85 if target_arch == 'x86': |
| 86 if self.short_name == '2013' and ( |
| 87 os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or |
| 88 os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'): |
| 89 # VS2013 non-Express has a x64-x86 cross that we want to prefer. |
| 90 return [os.path.normpath( |
| 91 os.path.join(self.path, 'VC/vcvarsall.bat')), 'amd64_x86'] |
| 92 # Otherwise, the standard x86 compiler. |
| 86 return [os.path.normpath( | 93 return [os.path.normpath( |
| 87 os.path.join(self.path, 'Common7/Tools/vsvars32.bat'))] | 94 os.path.join(self.path, 'Common7/Tools/vsvars32.bat'))] |
| 88 else: | 95 else: |
| 89 assert target_arch == 'x64' | 96 assert target_arch == 'x64' |
| 90 arg = 'x86_amd64' | 97 arg = 'x86_amd64' |
| 91 if (os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or | 98 if (os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or |
| 92 os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'): | 99 os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'): |
| 93 # Use the 64-on-64 compiler if we can. | 100 # Use the 64-on-64 compiler if we can. |
| 94 arg = 'amd64' | 101 arg = 'amd64' |
| 95 return [os.path.normpath( | 102 return [os.path.normpath( |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return _CreateVersion(msvs_version, override_path, sdk_based=True) | 397 return _CreateVersion(msvs_version, override_path, sdk_based=True) |
| 391 version = str(version) | 398 version = str(version) |
| 392 versions = _DetectVisualStudioVersions(version_map[version], 'e' in version) | 399 versions = _DetectVisualStudioVersions(version_map[version], 'e' in version) |
| 393 if not versions: | 400 if not versions: |
| 394 if version == 'auto': | 401 if version == 'auto': |
| 395 # Default to 2005 if we couldn't find anything | 402 # Default to 2005 if we couldn't find anything |
| 396 return _CreateVersion('2005', None) | 403 return _CreateVersion('2005', None) |
| 397 else: | 404 else: |
| 398 return _CreateVersion(version, None) | 405 return _CreateVersion(version, None) |
| 399 return versions[0] | 406 return versions[0] |
| OLD | NEW |