aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mconf.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/mconf.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/mconf.py')
-rw-r--r--mesonbuild/mconf.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index cadc1f5..05e9518 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -97,9 +97,9 @@ class Conf:
else:
print('{0:{width[0]}} {1:{width[1]}} {3}'.format(*line, width=col_widths))
- def split_options_per_subproject(self, options):
+ def split_options_per_subproject(self, options_iter):
result = {}
- for k, o in options.items():
+ for k, o in options_iter:
subproject = ''
if ':' in k:
subproject, optname = k.split(':')
@@ -211,10 +211,15 @@ class Conf:
return 'build.' + k
return k[:idx + 1] + 'build.' + k[idx + 1:]
- core_options = self.split_options_per_subproject(core_options)
- host_compiler_options = self.split_options_per_subproject(self.coredata.compiler_options.host)
- build_compiler_options = self.split_options_per_subproject({insert_build_prefix(k): o for k, o in self.coredata.compiler_options.build.items()})
- project_options = self.split_options_per_subproject(self.coredata.user_options)
+ core_options = self.split_options_per_subproject(core_options.items())
+ host_compiler_options = self.split_options_per_subproject(
+ self.coredata.flatten_lang_iterator(
+ self.coredata.compiler_options.host.items()))
+ build_compiler_options = self.split_options_per_subproject(
+ self.coredata.flatten_lang_iterator(
+ (insert_build_prefix(k), o)
+ for k, o in self.coredata.compiler_options.build.items()))
+ project_options = self.split_options_per_subproject(self.coredata.user_options.items())
show_build_options = self.default_values_only or self.build.environment.is_cross_build()
self.add_section('Main project options')