diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2019-06-12 18:08:45 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-04-20 23:23:15 +0300 |
commit | 278c294aa45efc3e8b068bcd7632828ed5c92523 (patch) | |
tree | 36372ef2c9a5897cca87e8c44628c8f9e00c368e /mesonbuild/compilers/compilers.py | |
parent | e04b0ae6b6220381b4aa493289960a3555201717 (diff) | |
download | meson-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/compilers/compilers.py')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 52b9592..3d3a503 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1272,10 +1272,10 @@ def get_global_options(lang: str, """Retreive options that apply to all compilers for a given language.""" description = 'Extra arguments passed to the {}'.format(lang) opts = { - lang + '_args': coredata.UserArrayOption( + 'args': coredata.UserArrayOption( description + ' compiler', [], split_args=True, user_input=True, allow_dups=True), - lang + '_link_args': coredata.UserArrayOption( + 'link_args': coredata.UserArrayOption( description + ' linker', [], split_args=True, user_input=True, allow_dups=True), } @@ -1288,12 +1288,13 @@ def get_global_options(lang: str, comp.INVOKES_LINKER) for k, o in opts.items(): - if k in properties: + user_k = lang + '_' + k + if user_k in properties: # Get from configuration files. - o.set_value(properties[k]) - elif k == lang + '_args': + o.set_value(properties[user_k]) + elif k == 'args': o.set_value(compile_args) - elif k == lang + '_link_args': + elif k == 'link_args': o.set_value(link_args) return opts |