diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-11-05 09:59:01 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-11-14 15:57:37 -0800 |
commit | e338e9ad2f08c52ec96541704e8f798d5a6e2742 (patch) | |
tree | c933b894e362c6d75153a4e3f48403931bfe0d73 /mesonbuild/environment.py | |
parent | aa04147a4a2a37aee197ebc0ed179c6fb582b3e9 (diff) | |
download | meson-e338e9ad2f08c52ec96541704e8f798d5a6e2742.zip meson-e338e9ad2f08c52ec96541704e8f798d5a6e2742.tar.gz meson-e338e9ad2f08c52ec96541704e8f798d5a6e2742.tar.bz2 |
environment: detect compilers from native files
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 72ca6a2..01a7c51 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -512,7 +512,10 @@ class Environment: The list of compilers is detected in the exact same way for C, C++, ObjC, ObjC++, Fortran, CS so consolidate it here. ''' + is_cross = False + exe_wrap = None evar = BinaryTable.evarMap[lang] + if self.is_cross_build() and want_cross: if lang not in self.cross_info.config['binaries']: raise EnvironmentException('{!r} compiler binary not defined in cross file'.format(lang)) @@ -528,13 +531,13 @@ class Environment: shlex.split(os.environ[evar])) # Return value has to be a list of compiler 'choices' compilers = [compilers] - is_cross = False - exe_wrap = None + elif lang in self.config_info.binaries: + compilers, ccache = BinaryTable.parse_entry( + mesonlib.stringlistify(self.config_info.binaries[lang])) + compilers = [compilers] else: compilers = getattr(self, 'default_' + lang) ccache = BinaryTable.detect_ccache() - is_cross = False - exe_wrap = None return compilers, ccache, is_cross, exe_wrap def _handle_exceptions(self, exceptions, binaries, bintype='compiler'): @@ -805,7 +808,11 @@ class Environment: self._handle_exceptions(popen_exceptions, compilers) def detect_java_compiler(self): - exelist = ['javac'] + if 'java' in self.config_info.binaries: + exelist = mesonlib.stringlistify(self.config_info.binaries['java']) + else: + exelist = ['javac'] + try: p, out, err = Popen_safe(exelist + ['-version']) except OSError: @@ -838,6 +845,8 @@ class Environment: def detect_vala_compiler(self): if 'VALAC' in os.environ: exelist = shlex.split(os.environ['VALAC']) + elif 'vala' in self.config_info.binaries: + exelist = mesonlib.stringlistify(self.config_info.binaries['vala']) else: exelist = ['valac'] try: @@ -882,6 +891,8 @@ class Environment: elif self.is_cross_build() and want_cross: exelist = mesonlib.stringlistify(self.cross_info.config['binaries']['d']) is_cross = True + elif 'd' in self.config_info.binaries: + exelist = mesonlib.stringlistify(self.config_info.binaries['d']) elif shutil.which("ldc2"): exelist = ['ldc2'] elif shutil.which("ldc"): @@ -919,7 +930,10 @@ class Environment: raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"') def detect_swift_compiler(self): - exelist = ['swiftc'] + if 'swift' in self.config_info.binaries: + exelist = mesonlib.stringlistify(self.config_info.binaries['swift']) + else: + exelist = ['swiftc'] try: p, _, err = Popen_safe(exelist + ['-v']) except OSError: |