diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-01-16 22:42:54 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-01-16 23:42:54 +0200 |
commit | af38722f8976d2527cade370dcd09b3b7ea62e04 (patch) | |
tree | ec54b9bea6df431d5336b6f947bd200b08157dc0 /mesonbuild/environment.py | |
parent | 2bb69ad50b3267bb18252cb5f87b339736658076 (diff) | |
download | meson-af38722f8976d2527cade370dcd09b3b7ea62e04.zip meson-af38722f8976d2527cade370dcd09b3b7ea62e04.tar.gz meson-af38722f8976d2527cade370dcd09b3b7ea62e04.tar.bz2 |
mintro: Introspection interpreter refactoring (#4733)
* Fixed spelling
* Merged the Buildoptions and Projectinfo interpreter
* Moved detect_compilers to Environment
* Added removed test case
* Split detect_compilers and moved even more code into Environment
* Moved set_default_options to coredata
* Small code simplification in mintro.run
* Move cmd_line_options back to `environment`
We don't actually wish to persist something this unstructured, so we
shouldn't make it a field on `coredata`. It would also be data
denormalization since the information we already store in coredata
depends on the CLI args.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 277b8d8..0e74851 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -33,6 +33,7 @@ from .compilers import ( is_source, ) from .compilers import ( + Compiler, ArmCCompiler, ArmCPPCompiler, ArmclangCCompiler, @@ -973,7 +974,7 @@ class Environment: return compilers.SwiftCompiler(exelist, version) raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"') - def detect_compilers(self, lang, need_cross_compiler): + def compilers_from_language(self, lang: str, need_cross_compiler: bool): comp = None cross_comp = None if lang == 'c': @@ -1021,7 +1022,23 @@ class Environment: if need_cross_compiler: raise EnvironmentException('Cross compilation with Swift is not working yet.') # cross_comp = self.environment.detect_fortran_compiler(True) + else: + return None, None + + return comp, cross_comp + + def check_compilers(self, lang: str, comp: Compiler, cross_comp: Compiler): + if comp is None: + raise EnvironmentException('Tried to use unknown language "%s".' % lang) + + comp.sanity_check(self.get_scratch_dir(), self) + if cross_comp: + cross_comp.sanity_check(self.get_scratch_dir(), self) + def detect_compilers(self, lang: str, need_cross_compiler: bool): + (comp, cross_comp) = self.compilers_from_language(lang, need_cross_compiler) + if comp is not None: + self.coredata.process_new_compilers(lang, comp, cross_comp, self.cmd_line_options) return comp, cross_comp def detect_static_linker(self, compiler): |