diff options
author | Matthias Klumpp <matthias@tenstral.net> | 2016-08-19 03:04:51 +0200 |
---|---|---|
committer | Matthias Klumpp <matthias@tenstral.net> | 2016-08-20 18:48:28 +0200 |
commit | 57c54a678c8eec18df345a44075d59f6384be8f0 (patch) | |
tree | a98c03f4d722eeb341b3465e9b5de11c35d66840 /mesonbuild/compilers.py | |
parent | 3eb90414f62f857abbb1c62e8e4c823b7b1473e6 (diff) | |
download | meson-57c54a678c8eec18df345a44075d59f6384be8f0.zip meson-57c54a678c8eec18df345a44075d59f6384be8f0.tar.gz meson-57c54a678c8eec18df345a44075d59f6384be8f0.tar.bz2 |
Allow build definitions to retrieve the unittest flag of a D compiler
D allows programmers to define their tests alongside the actual code in
a unittest scope[1].
When compiled with a special flag, the compiler will build a binary
containing the tests instead of the actual application.
This is a strightforward and easy way to run tests and works well with
Mesons test() command.
Since using just one flag name to enable unittest mode would be too
boring, compiler developers invented multiple ones.
Adding this helper method makes it easy for people writing Meson build
descriptions for D projects to enable unittestmode.
[1]: https://dlang.org/spec/unittest.html
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r-- | mesonbuild/compilers.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 88184cb..450e8a5 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1505,6 +1505,9 @@ class DCompiler(Compiler): def get_soname_args(self, shlib_name, path, soversion): return [] + def get_unittest_flag(self): + return ['-unittest'] + def build_rpath_args(self, build_dir, rpath_paths, install_rpath): # This method is to be used by LDC and DMD. # GDC can deal with the verbatim flags. @@ -1562,6 +1565,9 @@ class GnuDCompiler(DCompiler): def build_rpath_args(self, build_dir, rpath_paths, install_rpath): return build_unix_rpath_args(build_dir, rpath_paths, install_rpath) + def get_unittest_flag(self): + return ['-funittest'] + class LLVMDCompiler(DCompiler): def __init__(self, exelist, version, is_cross): DCompiler.__init__(self, exelist, version, is_cross) |