aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2019-01-05 15:18:17 +0000
committerJon Turney <jon.turney@dronecode.org.uk>2019-01-05 20:22:13 +0000
commita223b20bb60c7c643d3d4e9581101e5f54522c57 (patch)
tree253d5342b479cb9c30a7fc988d75132dc532c39d /mesonbuild/compilers
parent818c1619cc15785d95b492eab80746ee403e08e3 (diff)
downloadmeson-a223b20bb60c7c643d3d4e9581101e5f54522c57.zip
meson-a223b20bb60c7c643d3d4e9581101e5f54522c57.tar.gz
meson-a223b20bb60c7c643d3d4e9581101e5f54522c57.tar.bz2
Fix linking when cross-compiling and a windows resource is first object
It appears that LIB/LINK default to the host architecture if they can't guess it from the first object. With the MSVC toolchain, resource files are (usually) compiled to an arch-neutral .res format. Always explicitly provide a '/MACHINE:' argument to avoid it guessing incorrectly when cross-compiling.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/c.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 46f4181..a1694d1 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -1302,6 +1302,13 @@ class VisualStudioCCompiler(CCompiler):
self.base_options = ['b_pch', 'b_ndebug', 'b_vscrt'] # FIXME add lto, pgo and the like
self.target = target
self.is_64 = ('x64' in target) or ('x86_64' in target)
+ # do some canonicalization of target machine
+ if 'x86_64' in target:
+ self.machine = 'x64'
+ elif '86' in target:
+ self.machine = 'x86'
+ else:
+ self.machine = target
# Override CCompiler.get_always_args
def get_always_args(self):
@@ -1378,7 +1385,7 @@ class VisualStudioCCompiler(CCompiler):
return ['/nologo']
def get_linker_output_args(self, outputname):
- return ['/OUT:' + outputname]
+ return ['/MACHINE:' + self.machine, '/OUT:' + outputname]
def get_linker_search_args(self, dirname):
return ['/LIBPATH:' + dirname]