diff options
| author | ruki <[email protected]> | 2020-09-17 22:40:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-09-17 22:40:17 +0800 |
| commit | c2724a1298a1cd2ca1c8e76ced79c4037d2c6cc5 (patch) | |
| tree | 25a1a6d826710a30001560d5ee028a24f6fc5b02 | |
| parent | ef86cee77a2cb6cdb3449b48ce33cb8123933a8c (diff) | |
add zig templates
| -rw-r--r-- | xmake/templates/zig/console/project/src/main.zig | 6 | ||||
| -rw-r--r-- | xmake/templates/zig/console/project/src/test.zig | 6 | ||||
| -rw-r--r-- | xmake/templates/zig/console/project/xmake.lua | 7 | ||||
| -rw-r--r-- | xmake/templates/zig/console/template.lua | 2 | ||||
| -rw-r--r-- | xmake/templates/zig/shared/project/src/main.zig | 8 | ||||
| -rw-r--r-- | xmake/templates/zig/shared/project/src/test.zig | 3 | ||||
| -rw-r--r-- | xmake/templates/zig/shared/project/xmake.lua | 12 | ||||
| -rw-r--r-- | xmake/templates/zig/shared/template.lua | 2 | ||||
| -rw-r--r-- | xmake/templates/zig/static/project/src/main.zig | 8 | ||||
| -rw-r--r-- | xmake/templates/zig/static/project/src/test.zig | 3 | ||||
| -rw-r--r-- | xmake/templates/zig/static/project/xmake.lua | 12 | ||||
| -rw-r--r-- | xmake/templates/zig/static/template.lua | 2 |
12 files changed, 71 insertions, 0 deletions
diff --git a/xmake/templates/zig/console/project/src/main.zig b/xmake/templates/zig/console/project/src/main.zig new file mode 100644 index 000000000..fcfd5e0fa --- /dev/null +++ b/xmake/templates/zig/console/project/src/main.zig @@ -0,0 +1,6 @@ +const std = @import("std"); + +pub fn main() !void { + const stdout = std.io.getStdOut().outStream(); + try stdout.print("Hello, {}!\n", .{"world"}); +} diff --git a/xmake/templates/zig/console/project/src/test.zig b/xmake/templates/zig/console/project/src/test.zig new file mode 100644 index 000000000..84804603e --- /dev/null +++ b/xmake/templates/zig/console/project/src/test.zig @@ -0,0 +1,6 @@ +const std = @import("std"); + +pub fn hello() !void { + const stdout = std.io.getStdOut().outStream(); + try stdout.print("Hello, {}!\n", .{"world"}); +} diff --git a/xmake/templates/zig/console/project/xmake.lua b/xmake/templates/zig/console/project/xmake.lua new file mode 100644 index 000000000..69a4b4477 --- /dev/null +++ b/xmake/templates/zig/console/project/xmake.lua @@ -0,0 +1,7 @@ +add_rules("mode.debug", "mode.release") + +target("${TARGETNAME}") + set_kind("binary") + add_files("src/*.zig") + +${FAQ} diff --git a/xmake/templates/zig/console/template.lua b/xmake/templates/zig/console/template.lua new file mode 100644 index 000000000..ed2e13b57 --- /dev/null +++ b/xmake/templates/zig/console/template.lua @@ -0,0 +1,2 @@ +template("console") + add_configfiles("xmake.lua") diff --git a/xmake/templates/zig/shared/project/src/main.zig b/xmake/templates/zig/shared/project/src/main.zig new file mode 100644 index 000000000..cee64b6b7 --- /dev/null +++ b/xmake/templates/zig/shared/project/src/main.zig @@ -0,0 +1,8 @@ +const std = @import("std"); + +extern fn add(a: i32, b: i32) i32; + +pub fn main() !void { + const stdout = std.io.getStdOut().outStream(); + try stdout.print("Hello, {} - {}!\n", .{"world", add(1, 1)}); +} diff --git a/xmake/templates/zig/shared/project/src/test.zig b/xmake/templates/zig/shared/project/src/test.zig new file mode 100644 index 000000000..a04ec1544 --- /dev/null +++ b/xmake/templates/zig/shared/project/src/test.zig @@ -0,0 +1,3 @@ +export fn add(a: i32, b: i32) i32 { + return a + b; +} diff --git a/xmake/templates/zig/shared/project/xmake.lua b/xmake/templates/zig/shared/project/xmake.lua new file mode 100644 index 000000000..a21b056bc --- /dev/null +++ b/xmake/templates/zig/shared/project/xmake.lua @@ -0,0 +1,12 @@ +add_rules("mode.debug", "mode.release") + +target("${TARGETNAME}") + set_kind("shared") + add_files("src/test.zig") + +target("${TARGETNAME}_demo") + set_kind("binary") + add_deps("${TARGETNAME}") + add_files("src/main.zig") + +${FAQ} diff --git a/xmake/templates/zig/shared/template.lua b/xmake/templates/zig/shared/template.lua new file mode 100644 index 000000000..d7ec5bae4 --- /dev/null +++ b/xmake/templates/zig/shared/template.lua @@ -0,0 +1,2 @@ +template("shared") + add_configfiles("xmake.lua") diff --git a/xmake/templates/zig/static/project/src/main.zig b/xmake/templates/zig/static/project/src/main.zig new file mode 100644 index 000000000..cee64b6b7 --- /dev/null +++ b/xmake/templates/zig/static/project/src/main.zig @@ -0,0 +1,8 @@ +const std = @import("std"); + +extern fn add(a: i32, b: i32) i32; + +pub fn main() !void { + const stdout = std.io.getStdOut().outStream(); + try stdout.print("Hello, {} - {}!\n", .{"world", add(1, 1)}); +} diff --git a/xmake/templates/zig/static/project/src/test.zig b/xmake/templates/zig/static/project/src/test.zig new file mode 100644 index 000000000..a04ec1544 --- /dev/null +++ b/xmake/templates/zig/static/project/src/test.zig @@ -0,0 +1,3 @@ +export fn add(a: i32, b: i32) i32 { + return a + b; +} diff --git a/xmake/templates/zig/static/project/xmake.lua b/xmake/templates/zig/static/project/xmake.lua new file mode 100644 index 000000000..f1321ee0f --- /dev/null +++ b/xmake/templates/zig/static/project/xmake.lua @@ -0,0 +1,12 @@ +add_rules("mode.debug", "mode.release") + +target("${TARGETNAME}") + set_kind("static") + add_files("src/test.zig") + +target("${TARGETNAME}_demo") + set_kind("binary") + add_deps("${TARGETNAME}") + add_files("src/main.zig") + +${FAQ} diff --git a/xmake/templates/zig/static/template.lua b/xmake/templates/zig/static/template.lua new file mode 100644 index 000000000..abfe91a4b --- /dev/null +++ b/xmake/templates/zig/static/template.lua @@ -0,0 +1,2 @@ +template("static") + add_configfiles("xmake.lua") |
