aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/coredata.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/coredata.py
parent2bb69ad50b3267bb18252cb5f87b339736658076 (diff)
downloadmeson-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/coredata.py')
-rw-r--r--mesonbuild/coredata.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 8c9d513..d5f7d94 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -553,6 +553,45 @@ class CoreData:
self.set_options(options, subproject)
+ def process_new_compilers(self, lang: str, comp, cross_comp, cmd_line_options):
+ from . import compilers
+ self.compilers[lang] = comp
+ # Native compiler always exist so always add its options.
+ new_options = comp.get_options()
+ if cross_comp is not None:
+ self.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 MesonException('Internal error, %s has incorrect prefix.' % k)
+ if k in cmd_line_options:
+ o.set_value(cmd_line_options[k])
+ self.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.external_preprocess_args.setdefault(lang, preproc_flags)
+
+ enabled_opts = []
+ for optname in comp.base_options:
+ if optname in self.base_options:
+ continue
+ oobj = compilers.base_options[optname]
+ if optname in cmd_line_options:
+ oobj.set_value(cmd_line_options[optname])
+ enabled_opts.append(optname)
+ self.base_options[optname] = oobj
+ self.emit_base_options_warnings(enabled_opts)
+
+ def emit_base_options_warnings(self, enabled_opts: list):
+ 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.')
+
class CmdLineFileParser(configparser.ConfigParser):
def __init__(self):
# We don't want ':' as key delimiter, otherwise it would break when