aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.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/interpreter.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/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 214b1eb..48b6bd6 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -42,7 +42,6 @@ import re
import shlex
import subprocess
import collections
-from itertools import chain
import functools
import typing as T
@@ -1112,7 +1111,7 @@ class CompilerHolder(InterpreterObject):
args += self.compiler.get_include_args(idir, False)
if not nobuiltins:
for_machine = Interpreter.machine_from_native_kwarg(kwargs)
- opts = self.environment.coredata.compiler_options[for_machine]
+ opts = self.environment.coredata.compiler_options[for_machine][self.compiler.language]
args += self.compiler.get_option_compile_args(opts)
if mode == 'link':
args += self.compiler.get_option_link_args(opts)
@@ -2800,11 +2799,12 @@ external dependencies (including libraries) must go to "dependencies".''')
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),
- ):
+ for opts in [
+ self.coredata.base_options, compilers.base_options, self.coredata.builtins,
+ dict(self.coredata.get_prefixed_options_per_machine(self.coredata.builtins_per_machine)),
+ dict(self.coredata.flatten_lang_iterator(
+ 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)