Skip to content

Commit

Permalink
win ninja/make: Always use a native compiler executable with MSVS 2017
Browse files Browse the repository at this point in the history
A host-native executable will always be used, and it will be a cross
compiler if the target architecture differs from the host architecture.

BUG=683729

Change-Id: I02a09e1755dd2ab7eca5c9d1957d7aeb56db6af6
Reviewed-on: https://chromium-review.googlesource.com/486400
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
  • Loading branch information
markmentovai committed Apr 25, 2017
1 parent e885024 commit ffd524c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions pylib/gyp/MSVSVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,27 @@ def _SetupScriptInternal(self, target_arch):
if self.sdk_based and sdk_dir and os.path.exists(setup_path):
return [setup_path, '/' + target_arch]

is_host_arch_x64 = (
os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or
os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'
)

# For VS2017 (and newer) it's fairly easy
if self.short_name >= '2017':
script_path = JoinPath(self.path,
'VC', 'Auxiliary', 'Build', 'vcvarsall.bat')
return [script_path, target_arch]

# Always use a native executable, cross-compiling if necessary.
host_arch = 'amd64' if is_host_arch_x64 else 'x86'
msvc_target_arch = 'amd64' if target_arch == 'x64' else 'x86'
arg = host_arch
if host_arch != msvc_target_arch:
arg += '_' + msvc_target_arch

return [script_path, arg]

# We try to find the best version of the env setup batch.
vcvarsall = JoinPath(self.path, 'VC', 'vcvarsall.bat')
is_host_arch_x64 = (
os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or
os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'
)
if target_arch == 'x86':
if self.short_name >= '2013' and self.short_name[-1] != 'e' and \
is_host_arch_x64:
Expand Down

0 comments on commit ffd524c

Please sign in to comment.