summaryrefslogtreecommitdiffstats
path: root/test cases/swift/6 modulemap
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/swift/6 modulemap
parentInitial commit. (diff)
downloadmeson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.tar.xz
meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/swift/6 modulemap')
-rw-r--r--test cases/swift/6 modulemap/main.swift5
-rw-r--r--test cases/swift/6 modulemap/meson.build8
-rw-r--r--test cases/swift/6 modulemap/module.modulemap5
-rw-r--r--test cases/swift/6 modulemap/mylib.c5
-rw-r--r--test cases/swift/6 modulemap/mylib.h3
5 files changed, 26 insertions, 0 deletions
diff --git a/test cases/swift/6 modulemap/main.swift b/test cases/swift/6 modulemap/main.swift
new file mode 100644
index 0000000..1a38c25
--- /dev/null
+++ b/test cases/swift/6 modulemap/main.swift
@@ -0,0 +1,5 @@
+import mylib
+
+let num = getNumber()
+
+print("The number returned from C code is: \(num).")
diff --git a/test cases/swift/6 modulemap/meson.build b/test cases/swift/6 modulemap/meson.build
new file mode 100644
index 0000000..f1c90db
--- /dev/null
+++ b/test cases/swift/6 modulemap/meson.build
@@ -0,0 +1,8 @@
+project('mixed', 'c', 'swift')
+
+i = include_directories('.')
+lib = static_library('mylib', 'mylib.c')
+exe = executable('prog', 'main.swift',
+ include_directories : [i],
+ link_with : lib)
+test('c module', exe)
diff --git a/test cases/swift/6 modulemap/module.modulemap b/test cases/swift/6 modulemap/module.modulemap
new file mode 100644
index 0000000..5aab62e
--- /dev/null
+++ b/test cases/swift/6 modulemap/module.modulemap
@@ -0,0 +1,5 @@
+module mylib [extern_c] {
+ header "mylib.h"
+ link "mylib"
+ export *
+}
diff --git a/test cases/swift/6 modulemap/mylib.c b/test cases/swift/6 modulemap/mylib.c
new file mode 100644
index 0000000..e091836
--- /dev/null
+++ b/test cases/swift/6 modulemap/mylib.c
@@ -0,0 +1,5 @@
+#include"mylib.h"
+
+int getNumber() {
+ return 42;
+}
diff --git a/test cases/swift/6 modulemap/mylib.h b/test cases/swift/6 modulemap/mylib.h
new file mode 100644
index 0000000..21bd9eb
--- /dev/null
+++ b/test cases/swift/6 modulemap/mylib.h
@@ -0,0 +1,3 @@
+#pragma once
+
+int getNumber();