aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2019-06-12 18:08:45 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2020-04-20 23:23:15 +0300
commit278c294aa45efc3e8b068bcd7632828ed5c92523 (patch)
tree36372ef2c9a5897cca87e8c44628c8f9e00c368e /mesonbuild/backend/backends.py
parente04b0ae6b6220381b4aa493289960a3555201717 (diff)
downloadmeson-278c294aa45efc3e8b068bcd7632828ed5c92523.zip
meson-278c294aa45efc3e8b068bcd7632828ed5c92523.tar.gz
meson-278c294aa45efc3e8b068bcd7632828ed5c92523.tar.bz2
Compiler options per lang
A current rather untyped storage of options is one of the things that contributes to the options code being so complex. This takes a small step in synching down by storing the compiler options in dicts per language. Future work might be replacing the langauge strings with an enum, and defaultdict with a custom struct, just like `PerMachine` and `MachineChoice`.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 138708d..31ddfb4 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -166,18 +166,21 @@ class Backend:
return os.path.join(self.environment.get_build_dir(), self.get_target_filename(target))
def get_base_options_for_target(self, target):
- return OptionOverrideProxy(target.option_overrides,
+ return OptionOverrideProxy(target.option_overrides_base,
self.environment.coredata.builtins,
self.environment.coredata.base_options)
def get_compiler_options_for_target(self, target):
- return OptionOverrideProxy(
- target.option_overrides,
- self.environment.coredata.compiler_options[target.for_machine])
+ comp_reg = self.environment.coredata.compiler_options[target.for_machine]
+ comp_override = target.option_overrides_compiler
+ return {
+ lang: OptionOverrideProxy(comp_override[lang], comp_reg[lang])
+ for lang in set(comp_reg.keys()) | set(comp_override.keys())
+ }
def get_option_for_target(self, option_name, target):
- if option_name in target.option_overrides:
- override = target.option_overrides[option_name]
+ if option_name in target.option_overrides_base:
+ override = target.option_overrides_base[option_name]
return self.environment.coredata.validate_option_value(option_name, override)
return self.environment.coredata.get_builtin_option(option_name, target.subproject)
@@ -581,7 +584,7 @@ class Backend:
# starting from hard-coded defaults followed by build options and so on.
commands = CompilerArgs(compiler)
- copt_proxy = self.get_compiler_options_for_target(target)
+ copt_proxy = self.get_compiler_options_for_target(target)[compiler.language]
# First, the trivial ones that are impossible to override.
#
# Add -nostdinc/-nostdinc++ if needed; can't be overridden