aboutsummaryrefslogtreecommitdiff
path: root/test cases/d
diff options
context:
space:
mode:
authorMatthias Klumpp <matthias@tenstral.net>2016-08-18 10:42:12 +0200
committerMatthias Klumpp <matthias@tenstral.net>2016-08-19 03:02:51 +0200
commit56823272ab96892e4f6c8dd86842d8c930281209 (patch)
tree84587d66fd89acfbb167d372dfdc206eabcdf3d7 /test cases/d
parent58359c8fac09ecd06af1d389bfad8cd65e831e2a (diff)
downloadmeson-56823272ab96892e4f6c8dd86842d8c930281209.zip
meson-56823272ab96892e4f6c8dd86842d8c930281209.tar.gz
meson-56823272ab96892e4f6c8dd86842d8c930281209.tar.bz2
Implement D support
This patch adds support for the D programming language[1] to Meson. The following compilers are supported: * LDC * GDC * DMD [1]: http://dlang.org/
Diffstat (limited to 'test cases/d')
-rw-r--r--test cases/d/1 simple/app.d8
-rw-r--r--test cases/d/1 simple/installed_files.txt1
-rw-r--r--test cases/d/1 simple/meson.build4
-rw-r--r--test cases/d/1 simple/utils.d8
-rw-r--r--test cases/d/2 library/app.d8
-rw-r--r--test cases/d/2 library/installed_files.txt4
-rw-r--r--test cases/d/2 library/libstuff.d9
-rw-r--r--test cases/d/2 library/meson.build14
8 files changed, 56 insertions, 0 deletions
diff --git a/test cases/d/1 simple/app.d b/test cases/d/1 simple/app.d
new file mode 100644
index 0000000..0be1d2c
--- /dev/null
+++ b/test cases/d/1 simple/app.d
@@ -0,0 +1,8 @@
+
+import std.stdio;
+import utils;
+
+void main ()
+{
+ printGreeting ("a Meson D test");
+}
diff --git a/test cases/d/1 simple/installed_files.txt b/test cases/d/1 simple/installed_files.txt
new file mode 100644
index 0000000..9374c54
--- /dev/null
+++ b/test cases/d/1 simple/installed_files.txt
@@ -0,0 +1 @@
+usr/bin/dsimpleapp?exe
diff --git a/test cases/d/1 simple/meson.build b/test cases/d/1 simple/meson.build
new file mode 100644
index 0000000..a10b67b
--- /dev/null
+++ b/test cases/d/1 simple/meson.build
@@ -0,0 +1,4 @@
+project('D Simple Test', 'd')
+
+e = executable('dsimpleapp', ['app.d', 'utils.d'], install : true)
+test('apptest', e)
diff --git a/test cases/d/1 simple/utils.d b/test cases/d/1 simple/utils.d
new file mode 100644
index 0000000..8645548
--- /dev/null
+++ b/test cases/d/1 simple/utils.d
@@ -0,0 +1,8 @@
+
+import std.stdio;
+import std.string : format;
+
+void printGreeting (string name)
+{
+ writeln ("Hello, I am %s.".format (name));
+}
diff --git a/test cases/d/2 library/app.d b/test cases/d/2 library/app.d
new file mode 100644
index 0000000..5d84a69
--- /dev/null
+++ b/test cases/d/2 library/app.d
@@ -0,0 +1,8 @@
+
+import libstuff;
+
+void main ()
+{
+ immutable ret = printLibraryString ("foo");
+ assert (ret == 4);
+}
diff --git a/test cases/d/2 library/installed_files.txt b/test cases/d/2 library/installed_files.txt
new file mode 100644
index 0000000..f062075
--- /dev/null
+++ b/test cases/d/2 library/installed_files.txt
@@ -0,0 +1,4 @@
+usr/bin/app_d?exe
+?usr/lib/libstuff.so
+usr/bin/app_s?exe
+usr/lib/libstuff.a
diff --git a/test cases/d/2 library/libstuff.d b/test cases/d/2 library/libstuff.d
new file mode 100644
index 0000000..676a643
--- /dev/null
+++ b/test cases/d/2 library/libstuff.d
@@ -0,0 +1,9 @@
+
+import std.stdio;
+import std.string : format;
+
+int printLibraryString (string str)
+{
+ writeln ("Library says: %s".format (str));
+ return 4;
+}
diff --git a/test cases/d/2 library/meson.build b/test cases/d/2 library/meson.build
new file mode 100644
index 0000000..811131c
--- /dev/null
+++ b/test cases/d/2 library/meson.build
@@ -0,0 +1,14 @@
+project('D Library', 'd')
+
+if meson.get_compiler('d').get_id() != 'gcc'
+ ldyn = shared_library('stuff', 'libstuff.d', install : true)
+ ed = executable('app_d', 'app.d', link_with : ldyn, install : true)
+ test('linktest_dyn', ed)
+
+else
+ message('GDC can not build shared libraries. Build skipped.')
+endif
+
+lstatic = static_library('stuff', 'libstuff.d', install : true)
+es = executable('app_s', 'app.d', link_with : lstatic, install : true)
+test('linktest_static', es)