diff options
Diffstat (limited to 'mesonbuild/coredata.py')
-rw-r--r-- | mesonbuild/coredata.py | 39 |
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 |