diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2019-07-19 10:34:11 -0400 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2020-02-06 14:11:24 -0500 |
commit | 3ba0073df6014d4b594df052f8e1fa75ce17b20e (patch) | |
tree | aac412650192c2e934c3e58241b00287bb08b6f9 /mesonbuild/interpreter.py | |
parent | 0bf3c4ac4d9128154bf27649a39645b7d804582e (diff) | |
download | meson-3ba0073df6014d4b594df052f8e1fa75ce17b20e.zip meson-3ba0073df6014d4b594df052f8e1fa75ce17b20e.tar.gz meson-3ba0073df6014d4b594df052f8e1fa75ce17b20e.tar.bz2 |
Make 'default_library' per-subproject builtin option
Currently it's just like if all builtin/base/compiler options are
yielding. This patch makes possible to have non-yielding builtin
options. The value in is overriden in this order:
- Value from parent project
- Value from subproject's default_options if set
- Value from subproject() default_options if set
- Value from command line if set
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 74882b2..d824e3c 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2750,19 +2750,21 @@ external dependencies (including libraries) must go to "dependencies".''') return result def get_option_internal(self, optname): + raw_optname = optname + if self.is_subproject(): + optname = self.subproject + ':' + optname + for opts in chain( [self.coredata.base_options, compilers.base_options, self.coredata.builtins], self.coredata.get_prefixed_options_per_machine(self.coredata.builtins_per_machine), self.coredata.get_prefixed_options_per_machine(self.coredata.compiler_options), ): v = opts.get(optname) + if v is None or v.yielding: + v = opts.get(raw_optname) if v is not None: return v - raw_optname = optname - if self.is_subproject(): - optname = self.subproject + ':' + optname - try: opt = self.coredata.user_options[optname] if opt.yielding and ':' in optname and raw_optname in self.coredata.user_options: @@ -2869,6 +2871,7 @@ external dependencies (including libraries) must go to "dependencies".''') if self.environment.first_invocation: default_options = self.project_default_options default_options.update(self.default_project_options) + self.coredata.init_builtins(self.subproject) else: default_options = {} self.coredata.set_default_options(default_options, self.subproject, self.environment) @@ -4368,7 +4371,7 @@ Try setting b_lundef to false instead.'''.format(self.coredata.base_options['b_s return BothLibrariesHolder(shared_holder, static_holder, self) def build_library(self, node, args, kwargs): - default_library = self.coredata.get_builtin_option('default_library') + default_library = self.coredata.get_builtin_option('default_library', self.subproject) if default_library == 'shared': return self.build_target(node, args, kwargs, SharedLibraryHolder) elif default_library == 'static': |