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/backend/vs2010backend.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/backend/vs2010backend.py')
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 9a7ebf2..ef849e1 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -891,8 +891,10 @@ class Vs2010Backend(backends.Backend): # generate_single_compile() and generate_basic_compiler_args() for l, comp in target.compilers.items(): if l in file_args: - file_args[l] += compilers.get_base_compile_args(self.get_base_options_for_target(target), comp) - file_args[l] += comp.get_option_compile_args(self.environment.coredata.compiler_options[target.for_machine]) + file_args[l] += compilers.get_base_compile_args( + self.get_base_options_for_target(target), comp) + file_args[l] += comp.get_option_compile_args( + self.environment.coredata.compiler_options[target.for_machine][comp.language]) # Add compile args added using add_project_arguments() for l, args in self.build.projects_args[target.for_machine].get(target.subproject, {}).items(): @@ -905,10 +907,11 @@ class Vs2010Backend(backends.Backend): file_args[l] += args # Compile args added from the env or cross file: CFLAGS/CXXFLAGS, etc. We want these # to override all the defaults, but not the per-target compile args. - for key, opt in self.environment.coredata.compiler_options[target.for_machine].items(): - l, suffix = key.split('_', 1) - if suffix == 'args' and l in file_args: - file_args[l] += opt.value + for l in file_args.keys(): + opts = self.environment.coredata.compiler_options[target.for_machine][l] + k = 'args' + if k in opts: + file_args[l] += opts[k].value for args in file_args.values(): # This is where Visual Studio will insert target_args, target_defines, # etc, which are added later from external deps (see below). @@ -1115,7 +1118,8 @@ class Vs2010Backend(backends.Backend): # to be after all internal and external libraries so that unresolved # symbols from those can be found here. This is needed when the # *_winlibs that we want to link to are static mingw64 libraries. - extra_link_args += compiler.get_option_link_args(self.environment.coredata.compiler_options[compiler.for_machine]) + extra_link_args += compiler.get_option_link_args( + self.environment.coredata.compiler_options[compiler.for_machine][comp.language]) (additional_libpaths, additional_links, extra_link_args) = self.split_link_args(extra_link_args.to_native()) # Add more libraries to be linked if needed |