summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authoral1-ce <[email protected]>2024-07-04 13:33:23 +0300
committeral1-ce <[email protected]>2024-07-04 13:33:23 +0300
commit6c17a5c75bacaedc84ceecdcb7c4045bea972e37 (patch)
tree419d6e15f503b1570af47d096b1f60e84515f4db /tests
parentf090b97d39bde78ea8cd5e0a85b0490b3dab1af7 (diff)
Add example for using vala with c
Diffstat (limited to 'tests')
-rw-r--r--tests/projects/vala/includec/src/main.vala9
-rw-r--r--tests/projects/vala/includec/src/printer.c6
-rw-r--r--tests/projects/vala/includec/src/printer.vala5
-rw-r--r--tests/projects/vala/includec/xmake.lua10
4 files changed, 30 insertions, 0 deletions
diff --git a/tests/projects/vala/includec/src/main.vala b/tests/projects/vala/includec/src/main.vala
new file mode 100644
index 000000000..acc6c7363
--- /dev/null
+++ b/tests/projects/vala/includec/src/main.vala
@@ -0,0 +1,9 @@
+extern void printer_from_c();
+
+int main (string[] args) {
+ printer_from_c();
+ printer_from_other_file();
+
+ return 0;
+}
+
diff --git a/tests/projects/vala/includec/src/printer.c b/tests/projects/vala/includec/src/printer.c
new file mode 100644
index 000000000..dc7a82c67
--- /dev/null
+++ b/tests/projects/vala/includec/src/printer.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void printer_from_c() {
+ printf("Calling from C");
+}
+
diff --git a/tests/projects/vala/includec/src/printer.vala b/tests/projects/vala/includec/src/printer.vala
new file mode 100644
index 000000000..998bb7a5c
--- /dev/null
+++ b/tests/projects/vala/includec/src/printer.vala
@@ -0,0 +1,5 @@
+using Glib;
+
+void printer_from_other_file() {
+ stdout.printf("Calling from other file");
+}
diff --git a/tests/projects/vala/includec/xmake.lua b/tests/projects/vala/includec/xmake.lua
new file mode 100644
index 000000000..01b3e3eb3
--- /dev/null
+++ b/tests/projects/vala/includec/xmake.lua
@@ -0,0 +1,10 @@
+add_rules("mode.release", "mode.debug")
+
+add_requires("glib")
+
+target("test")
+ set_kind("binary")
+ add_rules("vala")
+ add_files("src/*.vala")
+ add_files("src/*.c")
+ add_packages("glib")