backend/vs: use the host machine instead of the target machine

This could lead to subtle bugs if you happened to be building a project
that is some sort of toolchain (compiler, linker, etc)
This commit is contained in:
Dylan Baker 2023-12-22 10:00:13 -08:00
parent c37cd4fe9a
commit 7cbaa6613a
1 changed files with 8 additions and 8 deletions

View File

@ -225,27 +225,27 @@ class Vs2010Backend(backends.Backend):
# Check for (currently) unexpected capture arg use cases - # Check for (currently) unexpected capture arg use cases -
if capture: if capture:
raise MesonBugException('We do not expect any vs backend to generate with \'capture = True\'') raise MesonBugException('We do not expect any vs backend to generate with \'capture = True\'')
target_machine = self.environment.machines.target.cpu_family host_machine = self.environment.machines.host.cpu_family
if target_machine in {'64', 'x86_64'}: if host_machine in {'64', 'x86_64'}:
# amd64 or x86_64 # amd64 or x86_64
target_system = self.environment.machines.target.system target_system = self.environment.machines.host.system
if detect_microsoft_gdk(target_system): if detect_microsoft_gdk(target_system):
self.platform = target_system self.platform = target_system
else: else:
self.platform = 'x64' self.platform = 'x64'
elif target_machine == 'x86': elif host_machine == 'x86':
# x86 # x86
self.platform = 'Win32' self.platform = 'Win32'
elif target_machine in {'aarch64', 'arm64'}: elif host_machine in {'aarch64', 'arm64'}:
target_cpu = self.environment.machines.target.cpu target_cpu = self.environment.machines.host.cpu
if target_cpu == 'arm64ec': if target_cpu == 'arm64ec':
self.platform = 'arm64ec' self.platform = 'arm64ec'
else: else:
self.platform = 'arm64' self.platform = 'arm64'
elif 'arm' in target_machine.lower(): elif 'arm' in host_machine.lower():
self.platform = 'ARM' self.platform = 'ARM'
else: else:
raise MesonException('Unsupported Visual Studio platform: ' + target_machine) raise MesonException('Unsupported Visual Studio platform: ' + host_machine)
build_machine = self.environment.machines.build.cpu_family build_machine = self.environment.machines.build.cpu_family
if build_machine in {'64', 'x86_64'}: if build_machine in {'64', 'x86_64'}: