aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorMatthias Klumpp <matthias@tenstral.net>2017-08-29 04:57:06 +0200
committerMatthias Klumpp <matthias@tenstral.net>2017-09-12 17:32:03 +0200
commitd83c2894428104188cd5f75565ee7bd2b4fdcd54 (patch)
tree652870d859ef82232f3f28cdb2512b36e36fda2e /mesonbuild/interpreter.py
parente1fc17ef2a532d539678b9a9378bca59eda38a91 (diff)
downloadmeson-d83c2894428104188cd5f75565ee7bd2b4fdcd54.zip
meson-d83c2894428104188cd5f75565ee7bd2b4fdcd54.tar.gz
meson-d83c2894428104188cd5f75565ee7bd2b4fdcd54.tar.bz2
d: Add easy way to use D-specific features
Of course D compilers have different flags to set some important D-specific settings. This adds a simple method to change these flags in a compiler-agnostic way in Meson. This replaces the previous `unittest_args` method with a more generic variant.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 2bcf198..c6cface 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -655,6 +655,7 @@ class CompilerHolder(InterpreterObject):
'get_supported_arguments': self.get_supported_arguments_method,
'first_supported_argument': self.first_supported_argument_method,
'unittest_args': self.unittest_args_method,
+ 'feature_args': self.feature_args_method,
'symbols_have_underscore_prefix': self.symbols_have_underscore_prefix_method,
})
@@ -751,11 +752,19 @@ class CompilerHolder(InterpreterObject):
'''
return self.compiler.symbols_have_underscore_prefix(self.environment)
- def unittest_args_method(self, args, kwargs):
+ def feature_args_method(self, args, kwargs):
# At time, only D compilers have this feature.
- if not hasattr(self.compiler, 'get_unittest_args'):
- raise InterpreterException('This {} compiler has no unittest arguments.'.format(self.compiler.get_display_language()))
- return self.compiler.get_unittest_args()
+ if not hasattr(self.compiler, 'get_feature_args'):
+ raise InterpreterException('This {} compiler has no feature arguments.'.format(self.compiler.get_display_language()))
+ return self.compiler.get_feature_args(args, kwargs)
+
+ def unittest_args_method(self, args, kwargs):
+ '''
+ This function is deprecated and should not be used.
+ '''
+ if not hasattr(self.compiler, 'get_feature_args'):
+ raise InterpreterException('This {} compiler has no feature arguments.'.format(self.compiler.get_display_language()))
+ return self.compiler.get_feature_args(args, {'unittest': 'true'})
def has_member_method(self, args, kwargs):
if len(args) != 2: