diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2015-12-11 23:14:16 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2015-12-11 23:14:16 +0200 |
commit | 961b000090e01a1eb3647c6b16d951ca419b13cb (patch) | |
tree | b36c48f137d5fa9a0af89cec8e2b0dc69a76c3bb /test cases/swift | |
parent | d531f915b12ad648c1ae08749548233882087f12 (diff) | |
download | meson-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.swift | 10 | ||||
-rw-r--r-- | test cases/swift/4 generate/gen/meson.build | 6 | ||||
-rw-r--r-- | test cases/swift/4 generate/meson.build | 4 | ||||
-rw-r--r-- | test cases/swift/4 generate/user/main.swift | 3 | ||||
-rw-r--r-- | test cases/swift/4 generate/user/meson.build | 2 |
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) |