diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-11-13 15:08:13 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-11-14 11:44:51 -0500 |
commit | b438455ec174adf4893855327e3b3064b1a9e30e (patch) | |
tree | 1403a369da524cc13b4717c8bcccd807ab3fc8e6 | |
parent | 900438882c798d5dc61340e34c3e82b694875ac9 (diff) | |
download | meson-b438455ec174adf4893855327e3b3064b1a9e30e.zip meson-b438455ec174adf4893855327e3b3064b1a9e30e.tar.gz meson-b438455ec174adf4893855327e3b3064b1a9e30e.tar.bz2 |
Hotfix for cross-compilation from Windows to Linux
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, but
that will have to be done after the 0.36.0 release.
Also fixes a typo in MinGW cpp_winlibs option setting.
Closes #1029
-rw-r--r-- | mesonbuild/compilers.py | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 1505807..fef4c1d 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1844,7 +1844,11 @@ class VisualStudioCCompiler(CCompiler): } def get_option_link_args(self, options): - return options['c_winlibs'].value[:] + # FIXME: See GnuCCompiler.get_option_link_args + if 'c_winlibs' in options: + return options['c_winlibs'].value[:] + else: + return msvc_winlibs[:] def unix_link_flags_to_native(self, args): result = [] @@ -1949,7 +1953,11 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): return args def get_option_link_args(self, options): - return options['cpp_winlibs'].value[:] + # FIXME: See GnuCCompiler.get_option_link_args + if 'cpp_winlibs' in options: + return options['cpp_winlibs'].value[:] + else: + return msvc_winlibs[:] GCC_STANDARD = 0 GCC_OSX = 1 @@ -2061,7 +2069,17 @@ class GnuCCompiler(GnuCompiler, CCompiler): def get_option_link_args(self, options): if self.gcc_type == GCC_MINGW: - return options['c_winlibs'].value + # 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 [] class GnuCPPCompiler(GnuCompiler, CPPCompiler): @@ -2083,7 +2101,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): False)} if self.gcc_type == GCC_MINGW: opts.update({ - 'cpp_winlibs': coredata.UserStringArrayOption('c_winlibs', 'Standard Win libraries to link against', + 'cpp_winlibs': coredata.UserStringArrayOption('cpp_winlibs', 'Standard Win libraries to link against', gnu_winlibs), }) return opts @@ -2099,7 +2117,11 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): def get_option_link_args(self, options): if self.gcc_type == GCC_MINGW: - return options['cpp_winlibs'].value + # FIXME: See GnuCCompiler.get_option_link_args + if 'cpp_winlibs' in options: + return options['cpp_winlibs'].value[:] + else: + return gnu_winlibs[:] return [] def get_compiler_check_args(self): |