diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index ced2b6fb5..8f8851f4d 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1846,11 +1846,7 @@ class VisualStudioCCompiler(CCompiler): } def get_option_link_args(self, options): - # FIXME: See GnuCCompiler.get_option_link_args - if 'c_winlibs' in options: - return options['c_winlibs'].value[:] - else: - return msvc_winlibs[:] + return options['c_winlibs'].value[:] def unix_link_flags_to_native(self, args): result = [] @@ -1955,11 +1951,7 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): return args def get_option_link_args(self, options): - # FIXME: See GnuCCompiler.get_option_link_args - if 'cpp_winlibs' in options: - return options['cpp_winlibs'].value[:] - else: - return msvc_winlibs[:] + return options['cpp_winlibs'].value[:] GCC_STANDARD = 0 GCC_OSX = 1 @@ -2071,17 +2063,7 @@ class GnuCCompiler(GnuCompiler, CCompiler): def get_option_link_args(self, options): if self.gcc_type == GCC_MINGW: - # FIXME: This check is needed because we currently pass - # cross-compiler options to the native compiler too and when - # cross-compiling from Windows to Linux, `options` will contain - # Linux-specific options which doesn't include `c_winlibs`. The - # proper fix is to allow cross-info files to specify compiler - # options and to maintain both cross and native compiler options in - # coredata: https://github.com/mesonbuild/meson/issues/1029 - if 'c_winlibs' in options: - return options['c_winlibs'].value[:] - else: - return gnu_winlibs[:] + return options['c_winlibs'].value[:] return [] class GnuCPPCompiler(GnuCompiler, CPPCompiler): @@ -2119,11 +2101,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): def get_option_link_args(self, options): if self.gcc_type == GCC_MINGW: - # FIXME: See GnuCCompiler.get_option_link_args - if 'cpp_winlibs' in options: - return options['cpp_winlibs'].value[:] - else: - return gnu_winlibs[:] + return options['cpp_winlibs'].value[:] return [] def get_compiler_check_args(self): diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 3b9f97524..ef99511d4 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1762,12 +1762,12 @@ class Interpreter(): raise InvalidCode('Tried to use unknown language "%s".' % lang) comp.sanity_check(self.environment.get_scratch_dir(), self.environment) self.coredata.compilers[lang] = comp + # Native compiler always exist so always add its options. + new_options = comp.get_options() if cross_comp is not None: cross_comp.sanity_check(self.environment.get_scratch_dir(), self.environment) self.coredata.cross_compilers[lang] = cross_comp - new_options = cross_comp.get_options() - else: - new_options = comp.get_options() + new_options.update(cross_comp.get_options()) optprefix = lang + '_' for i in new_options: if not i.startswith(optprefix):