diff options
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/backend/backends.py | 16 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 12 | ||||
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 2 | ||||
-rw-r--r-- | mesonbuild/backend/xcodebackend.py | 2 | ||||
-rw-r--r-- | mesonbuild/build.py | 11 |
5 files changed, 18 insertions, 25 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index fbcb616..2a955db 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -32,7 +32,7 @@ from .. import mesonlib from .. import mlog from ..compilers import LANGUAGES_USING_LDFLAGS, detect from ..mesonlib import ( - File, MachineChoice, MesonException, OptionType, OrderedSet, OptionOverrideProxy, + File, MachineChoice, MesonException, OrderedSet, OptionOverrideProxy, classify_unity_sources, OptionKey, join_args ) @@ -310,15 +310,9 @@ class Backend: def get_target_filename_abs(self, target: T.Union[build.Target, build.CustomTargetIndex]) -> str: return os.path.join(self.environment.get_build_dir(), self.get_target_filename(target)) - def get_base_options_for_target(self, target: build.BuildTarget) -> OptionOverrideProxy: - return OptionOverrideProxy(target.option_overrides_base, - {k: v for k, v in self.environment.coredata.options.items() - if k.type in {OptionType.BASE, OptionType.BUILTIN}}) - - def get_compiler_options_for_target(self, target: build.BuildTarget) -> OptionOverrideProxy: - comp_reg = {k: v for k, v in self.environment.coredata.options.items() if k.is_compiler()} - comp_override = target.option_overrides_compiler - return OptionOverrideProxy(comp_override, comp_reg) + def get_options_for_target(self, target: build.BuildTarget) -> OptionOverrideProxy: + return OptionOverrideProxy(target.option_overrides, + self.environment.coredata.options) def get_option_for_target(self, option_name: 'OptionKey', target: build.BuildTarget) -> T.Union[str, int, bool, 'WrapMode']: if option_name in target.option_overrides_base: @@ -926,7 +920,7 @@ class Backend: # starting from hard-coded defaults followed by build options and so on. commands = compiler.compiler_args() - copt_proxy = self.get_compiler_options_for_target(target) + copt_proxy = self.get_options_for_target(target) # First, the trivial ones that are impossible to override. # # Add -nostdinc/-nostdinc++ if needed; can't be overridden diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index c630cc3..d3216b1 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1605,7 +1605,7 @@ class NinjaBackend(backends.Backend): cython = target.compilers['cython'] - opt_proxy = self.get_compiler_options_for_target(target) + opt_proxy = self.get_options_for_target(target) args: T.List[str] = [] args += cython.get_always_args() @@ -1692,7 +1692,7 @@ class NinjaBackend(backends.Backend): # Rust compiler takes only the main file as input and # figures out what other files are needed via import # statements and magic. - base_proxy = self.get_base_options_for_target(target) + base_proxy = self.get_options_for_target(target) args = rustc.compiler_args() # Compiler args for compiling this target args += compilers.get_base_compile_args(base_proxy, rustc) @@ -2463,7 +2463,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) return linker.get_link_debugfile_args(outname) def generate_llvm_ir_compile(self, target, src): - base_proxy = self.get_base_options_for_target(target) + base_proxy = self.get_options_for_target(target) compiler = get_compiler_for_source(target.compilers.values(), src) commands = compiler.compiler_args() # Compiler args for compiling this target @@ -2523,7 +2523,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) return commands def _generate_single_compile_base_args(self, target: build.BuildTarget, compiler: 'Compiler') -> 'CompilerArgs': - base_proxy = self.get_base_options_for_target(target) + base_proxy = self.get_options_for_target(target) # Create an empty commands list, and start adding arguments from # various sources in the order in which they must override each other commands = compiler.compiler_args() @@ -3025,9 +3025,9 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) # options passed on the command-line, in default_options, etc. # These have the lowest priority. if isinstance(target, build.StaticLibrary): - commands += linker.get_base_link_args(self.get_base_options_for_target(target)) + commands += linker.get_base_link_args(self.get_options_for_target(target)) else: - commands += compilers.get_base_link_args(self.get_base_options_for_target(target), + commands += compilers.get_base_link_args(self.get_options_for_target(target), linker, isinstance(target, build.SharedModule)) # Add -nostdlib if needed; can't be overridden diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 7a56041..3190630 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -990,7 +990,7 @@ class Vs2010Backend(backends.Backend): 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) + self.get_options_for_target(target), comp) file_args[l] += comp.get_option_compile_args( self.environment.coredata.options) diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index 64a49ba..1cf1765 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -1504,7 +1504,7 @@ class XCodeBackend(backends.Backend): continue # Start with warning args warn_args = compiler.get_warn_args(self.get_option_for_target(OptionKey('warning_level'), target)) - copt_proxy = self.get_compiler_options_for_target(target) + copt_proxy = self.get_options_for_target(target) std_args = compiler.get_option_compile_args(copt_proxy) # Add compile args added using add_project_arguments() pargs = self.build.projects_args[target.for_machine].get(target.subproject, {}).get(lang, []) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 2c841a6..43a6df5 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -588,8 +588,7 @@ class Target(HoldableObject): ''')) self.install = False self.build_always_stale = False - self.option_overrides_base: T.Dict[OptionKey, str] = {} - self.option_overrides_compiler: T.Dict[OptionKey, str] = {} + self.option_overrides: T.Dict[OptionKey, str] = {} self.extra_files = [] # type: T.List[File] if not hasattr(self, 'typename'): raise RuntimeError(f'Target type is not set for target class "{type(self).__name__}". This is a bug') @@ -697,9 +696,9 @@ class Target(HoldableObject): for k, v in option_overrides.items(): if k.lang: - self.option_overrides_compiler[k.evolve(machine=self.for_machine)] = v + self.option_overrides[k.evolve(machine=self.for_machine)] = v continue - self.option_overrides_base[k] = v + self.option_overrides[k] = v @staticmethod def parse_overrides(kwargs: T.Dict[str, T.Any]) -> T.Dict[OptionKey, str]: @@ -968,8 +967,8 @@ class BuildTarget(Target): self.compilers['c'] = compilers['c'] if 'cython' in self.compilers: key = OptionKey('language', machine=self.for_machine, lang='cython') - if key in self.option_overrides_compiler: - value = self.option_overrides_compiler[key] + if key in self.option_overrides: + value = self.option_overrides[key] else: value = self.environment.coredata.options[key].value |