Add both native and cross compiler options to option list.

pull/1055/merge
Jussi Pakkanen 8 years ago
parent bfd190279c
commit 7e1b674704
  1. 30
      mesonbuild/compilers.py
  2. 6
      mesonbuild/interpreter.py

@ -1846,11 +1846,7 @@ class VisualStudioCCompiler(CCompiler):
} }
def get_option_link_args(self, options): def get_option_link_args(self, options):
# FIXME: See GnuCCompiler.get_option_link_args return options['c_winlibs'].value[:]
if 'c_winlibs' in options:
return options['c_winlibs'].value[:]
else:
return msvc_winlibs[:]
def unix_link_flags_to_native(self, args): def unix_link_flags_to_native(self, args):
result = [] result = []
@ -1955,11 +1951,7 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler):
return args return args
def get_option_link_args(self, options): def get_option_link_args(self, options):
# FIXME: See GnuCCompiler.get_option_link_args return options['cpp_winlibs'].value[:]
if 'cpp_winlibs' in options:
return options['cpp_winlibs'].value[:]
else:
return msvc_winlibs[:]
GCC_STANDARD = 0 GCC_STANDARD = 0
GCC_OSX = 1 GCC_OSX = 1
@ -2071,17 +2063,7 @@ class GnuCCompiler(GnuCompiler, CCompiler):
def get_option_link_args(self, options): def get_option_link_args(self, options):
if self.gcc_type == GCC_MINGW: if self.gcc_type == GCC_MINGW:
# FIXME: This check is needed because we currently pass return options['c_winlibs'].value[:]
# 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 [] return []
class GnuCPPCompiler(GnuCompiler, CPPCompiler): class GnuCPPCompiler(GnuCompiler, CPPCompiler):
@ -2119,11 +2101,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
def get_option_link_args(self, options): def get_option_link_args(self, options):
if self.gcc_type == GCC_MINGW: if self.gcc_type == GCC_MINGW:
# FIXME: See GnuCCompiler.get_option_link_args return options['cpp_winlibs'].value[:]
if 'cpp_winlibs' in options:
return options['cpp_winlibs'].value[:]
else:
return gnu_winlibs[:]
return [] return []
def get_compiler_check_args(self): def get_compiler_check_args(self):

@ -1762,12 +1762,12 @@ class Interpreter():
raise InvalidCode('Tried to use unknown language "%s".' % lang) raise InvalidCode('Tried to use unknown language "%s".' % lang)
comp.sanity_check(self.environment.get_scratch_dir(), self.environment) comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
self.coredata.compilers[lang] = comp 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: if cross_comp is not None:
cross_comp.sanity_check(self.environment.get_scratch_dir(), self.environment) cross_comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
self.coredata.cross_compilers[lang] = cross_comp self.coredata.cross_compilers[lang] = cross_comp
new_options = cross_comp.get_options() new_options.update(cross_comp.get_options())
else:
new_options = comp.get_options()
optprefix = lang + '_' optprefix = lang + '_'
for i in new_options: for i in new_options:
if not i.startswith(optprefix): if not i.startswith(optprefix):

Loading…
Cancel
Save