diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-03-24 19:04:43 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-03-25 17:56:13 +0200 |
commit | cfc3605b730060b41856d3029dcfffc1ccce7ce6 (patch) | |
tree | e0f6c2ce27fd9b80938f19a7b4a4a7e66819271c | |
parent | 650ad9dc8875ddfc0a0db31cbca4111ada40c556 (diff) | |
download | meson-cfc3605b730060b41856d3029dcfffc1ccce7ce6.zip meson-cfc3605b730060b41856d3029dcfffc1ccce7ce6.tar.gz meson-cfc3605b730060b41856d3029dcfffc1ccce7ce6.tar.bz2 |
Detect 'ccache' in evars and cross-info files
Then, only use it if it's actually available.
Closes https://github.com/mesonbuild/meson/issues/1471
-rw-r--r-- | mesonbuild/environment.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 5217626..92040c4 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -377,16 +377,30 @@ class Environment: C, C++, ObjC, ObjC++, Fortran so consolidate it here. ''' if self.is_cross_build() and want_cross: - compilers = [mesonlib.stringlistify(self.cross_info.config['binaries'][lang])] - ccache = [] + compilers = mesonlib.stringlistify(self.cross_info.config['binaries'][lang]) + # Ensure ccache exists and remove it if it doesn't + if compilers[0] == 'ccache': + compilers = compilers[1:] + ccache = self.detect_ccache() + else: + ccache = [] + # Return value has to be a list of compiler 'choices' + compilers = [compilers] is_cross = True if self.cross_info.need_exe_wrapper(): exe_wrap = self.cross_info.config['binaries'].get('exe_wrapper', None) else: exe_wrap = [] elif evar in os.environ: - compilers = [shlex.split(os.environ[evar])] - ccache = [] + compilers = shlex.split(os.environ[evar]) + # Ensure ccache exists and remove it if it doesn't + if compilers[0] == 'ccache': + compilers = compilers[1:] + ccache = self.detect_ccache() + else: + ccache = [] + # Return value has to be a list of compiler 'choices' + compilers = [compilers] is_cross = False exe_wrap = None else: |