diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2024-04-14 12:58:30 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2025-02-13 15:26:44 +0200 |
commit | 518c732ea9b0f1975f6f28accff3286be4106538 (patch) | |
tree | 2be9544828545a2f9f0676efc6eb82ac197ec4bd /mesonbuild/compilers/objcpp.py | |
parent | ea678ed82938ceac00682b2695b57193d36b71b4 (diff) | |
download | meson-optionrefactor3.zip meson-optionrefactor3.tar.gz meson-optionrefactor3.tar.bz2 |
Make all Meson level options overridable per subproject.optionrefactor3
Diffstat (limited to 'mesonbuild/compilers/objcpp.py')
-rw-r--r-- | mesonbuild/compilers/objcpp.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py index 104d0cb..743bbb9 100644 --- a/mesonbuild/compilers/objcpp.py +++ b/mesonbuild/compilers/objcpp.py @@ -20,6 +20,7 @@ if T.TYPE_CHECKING: from ..environment import Environment from ..linkers.linkers import DynamicLinker from ..mesonlib import MachineChoice + from ..build import BuildTarget class ObjCPPCompiler(CLikeCompiler, Compiler): @@ -80,14 +81,18 @@ class GnuObjCPPCompiler(GnuCPPStds, GnuCompiler, ObjCPPCompiler): self.supported_warn_args(gnu_common_warning_args) + self.supported_warn_args(gnu_objc_warning_args))} - def get_option_compile_args(self, options: 'coredata.KeyedOptionDictType') -> T.List[str]: - args = [] - std = options.get_value(self.form_compileropt_key('std')) + def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]: + args: T.List[str] = [] + key = OptionKey('cpp_std', machine=self.for_machine) + if target: + std = env.coredata.get_option_for_target(target, key) + else: + std = env.coredata.get_option_for_subproject(key, subproject) + assert isinstance(std, str) if std != 'none': args.append('-std=' + std) return args - class ClangObjCPPCompiler(ClangCPPStds, ClangCompiler, ObjCPPCompiler): def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, @@ -105,9 +110,11 @@ class ClangObjCPPCompiler(ClangCPPStds, ClangCompiler, ObjCPPCompiler): '3': default_warn_args + ['-Wextra', '-Wpedantic'], 'everything': ['-Weverything']} - def get_option_compile_args(self, options: 'coredata.KeyedOptionDictType') -> T.List[str]: + def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]: args = [] - std = options.get_value(self.form_compileropt_key('std')) + key = OptionKey('cpp_std', machine=self.for_machine) + std = self.get_compileropt_value(key, env, target, subproject) + assert isinstance(std, str) if std != 'none': args.append('-std=' + std) return args |