aboutsummaryrefslogtreecommitdiff
path: root/test cases/swift
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-12-11 23:14:16 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2015-12-11 23:14:16 +0200
commit961b000090e01a1eb3647c6b16d951ca419b13cb (patch)
treeb36c48f137d5fa9a0af89cec8e2b0dc69a76c3bb /test cases/swift
parentd531f915b12ad648c1ae08749548233882087f12 (diff)
downloadmeson-961b000090e01a1eb3647c6b16d951ca419b13cb.zip
meson-961b000090e01a1eb3647c6b16d951ca419b13cb.tar.gz
meson-961b000090e01a1eb3647c6b16d951ca419b13cb.tar.bz2
Can generate swift sources with custom target.
Diffstat (limited to 'test cases/swift')
-rw-r--r--test cases/swift/4 generate/gen/main.swift10
-rw-r--r--test cases/swift/4 generate/gen/meson.build6
-rw-r--r--test cases/swift/4 generate/meson.build4
-rw-r--r--test cases/swift/4 generate/user/main.swift3
-rw-r--r--test cases/swift/4 generate/user/meson.build2
5 files changed, 25 insertions, 0 deletions
diff --git a/test cases/swift/4 generate/gen/main.swift b/test cases/swift/4 generate/gen/main.swift
new file mode 100644
index 0000000..2f2bd36
--- /dev/null
+++ b/test cases/swift/4 generate/gen/main.swift
@@ -0,0 +1,10 @@
+import Glibc
+
+let fname = Process.arguments[1]
+let code = "public func getGenerated() -> Int {\n return 42\n}\n"
+
+let f = fopen(fname, "w")
+
+fwrite(code, 1, Int(strlen(code)), f)
+print("Name: \(fname)")
+fclose(f)
diff --git a/test cases/swift/4 generate/gen/meson.build b/test cases/swift/4 generate/gen/meson.build
new file mode 100644
index 0000000..8cd7e04
--- /dev/null
+++ b/test cases/swift/4 generate/gen/meson.build
@@ -0,0 +1,6 @@
+gen = executable('gen', 'main.swift')
+
+srcs = custom_target('gensrc',
+ output : 'gen.swift',
+ command : [gen, '@OUTPUT@']
+)
diff --git a/test cases/swift/4 generate/meson.build b/test cases/swift/4 generate/meson.build
new file mode 100644
index 0000000..ccc7d5c
--- /dev/null
+++ b/test cases/swift/4 generate/meson.build
@@ -0,0 +1,4 @@
+project('swift generator', 'swift')
+
+subdir('gen')
+subdir('user')
diff --git a/test cases/swift/4 generate/user/main.swift b/test cases/swift/4 generate/user/main.swift
new file mode 100644
index 0000000..e6b46cd
--- /dev/null
+++ b/test cases/swift/4 generate/user/main.swift
@@ -0,0 +1,3 @@
+let generated = getGenerated()
+
+print("Generated number is: \(generated).")
diff --git a/test cases/swift/4 generate/user/meson.build b/test cases/swift/4 generate/user/meson.build
new file mode 100644
index 0000000..fc4722d
--- /dev/null
+++ b/test cases/swift/4 generate/user/meson.build
@@ -0,0 +1,2 @@
+user = executable('user', 'main.swift', srcs)
+test('User test', user)