diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-07-11 16:57:15 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-07-11 17:11:49 +0530 |
commit | 666083795369abbffc7d5d0c31c5420cf8a0d40b (patch) | |
tree | 64550242432a5d670d98d59493bdacb7259681e0 | |
parent | 358598816f69fd05842f30c9f55be21de7603c34 (diff) | |
download | meson-666083795369abbffc7d5d0c31c5420cf8a0d40b.zip meson-666083795369abbffc7d5d0c31c5420cf8a0d40b.tar.gz meson-666083795369abbffc7d5d0c31c5420cf8a0d40b.tar.bz2 |
vs: Target platform is not always Win32
It depends on the target machine. Without this building for 64-bit fails
when using external dependencies.
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 89b2b22..12f224c 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -148,7 +148,17 @@ class Vs2010Backend(backends.Backend): def generate(self, interp): self.resolve_source_conflicts() self.interpreter = interp - self.platform = 'Win32' + target_machine = self.interpreter.builtin['target_machine'].cpu_family_method(None, None) + if target_machine.endswith('64'): + # amd64 or x86_64 + self.platform = 'x64' + elif target_machine == 'x86': + # x86 + self.platform = 'Win32' + elif 'arm' in target_machine.lower(): + self.platform = 'ARM' + else: + raise MesonException('Unsupported Visual Studio platform: ' + target_machine) self.buildtype = self.environment.coredata.get_builtin_option('buildtype') sln_filename = os.path.join(self.environment.get_build_dir(), self.build.project_name + '.sln') projlist = self.generate_projects() @@ -746,7 +756,15 @@ class Vs2010Backend(backends.Backend): if isinstance(target, build.Executable): ET.SubElement(link, 'EntryPointSymbol').text = entrypoint targetmachine = ET.SubElement(link, 'TargetMachine') - targetmachine.text = 'MachineX86' + targetplatform = self.platform.lower() + if targetplatform == 'win32': + targetmachine.text = 'MachineX86' + elif targetplatform == 'x64': + targetmachine.text = 'MachineX64' + elif targetplatform == 'arm': + targetmachine.text = 'MachineARM' + else: + raise MesonException('Unsupported Visual Studio target machine: ' + targetmachine) extra_files = target.extra_files if len(headers) + len(gen_hdrs) + len(extra_files) > 0: |