diff options
author | Matthias Klumpp <matthias@tenstral.net> | 2018-02-18 16:54:49 +0100 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-02-20 23:15:24 +0530 |
commit | d41af0c7407d7e2c1d12f4220e05488283d363b5 (patch) | |
tree | 71c6de48471172aee0e1eae4b981304636e5af61 | |
parent | 530af9dbb8bd92fe787e7bdf1b4e86ea8fcfe625 (diff) | |
download | meson-d41af0c7407d7e2c1d12f4220e05488283d363b5.zip meson-d41af0c7407d7e2c1d12f4220e05488283d363b5.tar.gz meson-d41af0c7407d7e2c1d12f4220e05488283d363b5.tar.bz2 |
d: gdc: Implement proper dependency gen support
Older versions of GDC had broken support for the -MQ flag (resulting in
a compiler error). New versions of GDC have this issue fixed (some older
versions received a backport). Starting with GCC 7.1 we can assume
dependency generation to always work reliably.
-rw-r--r-- | mesonbuild/compilers/d.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index 9739f28..6725646 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -81,7 +81,7 @@ class DCompiler(Compiler): return objfile + '.' + self.get_depfile_suffix() def get_depfile_suffix(self): - return 'dep' + return 'deps' def get_pic_args(self): return ['-fPIC'] @@ -233,13 +233,20 @@ class GnuDCompiler(DCompiler): '3': default_warn_args + ['-Wextra', '-Wpedantic']} self.base_options = ['b_colorout', 'b_sanitize', 'b_staticpic'] + self._has_color_support = version_compare(self.version, '>=4.9') + # dependencies were implemented before, but broken - support was fixed in GCC 7.1+ + # (and some backported versions) + self._has_deps_support = version_compare(self.version, '>=7.1') + def get_colorout_args(self, colortype): - if version_compare(self.version, '>=4.9.0'): + if self._has_color_support: return gnu_color_args[colortype][:] return [] def get_dependency_gen_args(self, outtarget, outfile): - return ['-fmake-deps=' + outfile] + if not self._has_deps_support: + return [] + return ['-MD', '-MQ', outtarget, '-MF', outfile] def get_output_args(self, target): return ['-o', target] |