aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-05-08 00:23:11 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2021-05-08 00:43:33 +0300
commitb29df2626723000039281a0238ca5d97b73bee7b (patch)
tree5b49bc17281d8aecf898975f68c38fdabae51a92 /mesonbuild
parentd433abf89cfe6be640d7a913bfdd4ae723f8b573 (diff)
downloadmeson-objversions.zip
meson-objversions.tar.gz
meson-objversions.tar.bz2
Make objective C use C standard version. Closes #5495.objversions
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/compilers/objc.py20
-rw-r--r--mesonbuild/compilers/objcpp.py21
2 files changed, 39 insertions, 2 deletions
diff --git a/mesonbuild/compilers/objc.py b/mesonbuild/compilers/objc.py
index 32f17ff..f707928 100644
--- a/mesonbuild/compilers/objc.py
+++ b/mesonbuild/compilers/objc.py
@@ -14,7 +14,8 @@
import typing as T
-from ..mesonlib import MachineChoice
+from .. import coredata
+from ..mesonlib import MachineChoice, OptionKey
from .compilers import Compiler
from .mixins.clike import CLikeCompiler
@@ -84,6 +85,23 @@ class ClangObjCCompiler(ClangCompiler, ObjCCompiler):
'2': default_warn_args + ['-Wextra'],
'3': default_warn_args + ['-Wextra', '-Wpedantic']}
+ def get_options(self) -> 'KeyedOptionDictType':
+ opts = super().get_options()
+ opts.update({
+ OptionKey('std', machine=self.for_machine, lang='c'): coredata.UserComboOption(
+ 'C language standard to use',
+ ['none', 'c89', 'c99', 'c11', 'c17'],
+ 'none',
+ )
+ })
+ return opts
+
+ def get_option_compile_args(self, options: 'KeyedOptionDictType') -> T.List[str]:
+ args = []
+ std = options[OptionKey('std', machine=self.for_machine, lang='c')]
+ if std.value != 'none':
+ args.append('-std=' + std.value)
+ return args
class AppleClangObjCCompiler(ClangObjCCompiler):
diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py
index 003da54..dbf5ba7 100644
--- a/mesonbuild/compilers/objcpp.py
+++ b/mesonbuild/compilers/objcpp.py
@@ -14,7 +14,8 @@
import typing as T
-from ..mesonlib import MachineChoice
+from .. import coredata
+from ..mesonlib import MachineChoice, OptionKey
from .mixins.clike import CLikeCompiler
from .compilers import Compiler
@@ -85,6 +86,24 @@ class ClangObjCPPCompiler(ClangCompiler, ObjCPPCompiler):
'3': default_warn_args + ['-Wextra', '-Wpedantic']}
+ def get_options(self) -> 'KeyedOptionDictType':
+ opts = super().get_options()
+ opts.update({
+ OptionKey('std', machine=self.for_machine, lang='cpp'): coredata.UserComboOption(
+ 'C++ language standard to use',
+ ['none', 'c++98', 'c++11', 'c++14', 'c++17'],
+ 'none',
+ )
+ })
+ return opts
+
+ def get_option_compile_args(self, options: 'KeyedOptionDictType') -> T.List[str]:
+ args = []
+ std = options[OptionKey('std', machine=self.for_machine, lang='cpp')]
+ if std.value != 'none':
+ args.append('-std=' + std.value)
+ return args
+
class AppleClangObjCPPCompiler(ClangObjCPPCompiler):