summaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-01-16 22:42:54 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2019-01-16 23:42:54 +0200
commitaf38722f8976d2527cade370dcd09b3b7ea62e04 (patch)
treeec54b9bea6df431d5336b6f947bd200b08157dc0 /mesonbuild/interpreter.py
parent2bb69ad50b3267bb18252cb5f87b339736658076 (diff)
downloadmeson-af38722f8976d2527cade370dcd09b3b7ea62e04.tar.gz
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/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py51
1 files changed, 2 insertions, 49 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 7ee9a3f97..d2c1ffe2a 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2657,36 +2657,6 @@ external dependencies (including libraries) must go to "dependencies".''')
self.validate_arguments(args, 0, [])
raise Exception()
- def detect_compilers(self, lang, need_cross_compiler):
- comp, cross_comp = self.environment.detect_compilers(lang, need_cross_compiler)
- if comp is None:
- raise InvalidCode('Tried to use unknown language "%s".' % lang)
-
- comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
- self.coredata.compilers[lang] = comp
- # Native compiler always exist so always add its options.
- new_options = comp.get_options()
- if cross_comp is not None:
- cross_comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
- self.coredata.cross_compilers[lang] = cross_comp
- new_options.update(cross_comp.get_options())
-
- optprefix = lang + '_'
- for k, o in new_options.items():
- if not k.startswith(optprefix):
- raise InterpreterException('Internal error, %s has incorrect prefix.' % k)
- if k in self.environment.cmd_line_options:
- o.set_value(self.environment.cmd_line_options[k])
- self.coredata.compiler_options.setdefault(k, o)
-
- # Unlike compiler and linker flags, preprocessor flags are not in
- # compiler_options because they are not visible to user.
- preproc_flags = comp.get_preproc_flags()
- preproc_flags = shlex.split(preproc_flags)
- self.coredata.external_preprocess_args.setdefault(lang, preproc_flags)
-
- return comp, cross_comp
-
def add_languages(self, args, required):
success = True
need_cross_compiler = self.environment.is_cross_build()
@@ -2697,7 +2667,8 @@ external dependencies (including libraries) must go to "dependencies".''')
cross_comp = self.coredata.cross_compilers.get(lang, None)
else:
try:
- (comp, cross_comp) = self.detect_compilers(lang, need_cross_compiler)
+ (comp, cross_comp) = self.environment.detect_compilers(lang, need_cross_compiler)
+ self.environment.check_compilers(lang, comp, cross_comp)
except Exception:
if not required:
mlog.log('Compiler for language', mlog.bold(lang), 'not found.')
@@ -2717,26 +2688,8 @@ external dependencies (including libraries) must go to "dependencies".''')
mlog.log('Cross', cross_comp.get_display_language(), 'compiler:',
mlog.bold(' '.join(cross_comp.get_exelist())), version_string)
self.build.ensure_static_cross_linker(comp)
- self.add_base_options(comp)
return success
- def emit_base_options_warnings(self, enabled_opts):
- if 'b_bitcode' in enabled_opts:
- mlog.warning('Base option \'b_bitcode\' is enabled, which is incompatible with many linker options. Incompatible options such as such as \'b_asneeded\' have been disabled.')
- mlog.warning('Please see https://mesonbuild.com/Builtin-options.html#Notes_about_Apple_Bitcode_support for more details.')
-
- def add_base_options(self, compiler):
- enabled_opts = []
- for optname in compiler.base_options:
- if optname in self.coredata.base_options:
- continue
- oobj = compilers.base_options[optname]
- if optname in self.environment.cmd_line_options:
- oobj.set_value(self.environment.cmd_line_options[optname])
- enabled_opts.append(optname)
- self.coredata. base_options[optname] = oobj
- self.emit_base_options_warnings(enabled_opts)
-
def program_from_file_for(self, for_machine, prognames, silent):
bins = self.environment.binaries[for_machine]
for p in prognames: