diff options
| author | 2018-05-31 16:00:44 +0200 | |
|---|---|---|
| committer | 2018-05-31 16:00:44 +0200 | |
| commit | f4e53cd6149ed4dcbfd8b81a6427b1b652d0a472 (patch) | |
| tree | 7ca591977efac33ebc9aa51aab7356a4faa97d46 /build.zig | |
| parent | Reworked the core. (diff) | |
| download | zig-clap-f4e53cd6149ed4dcbfd8b81a6427b1b652d0a472.tar.gz zig-clap-f4e53cd6149ed4dcbfd8b81a6427b1b652d0a472.tar.xz zig-clap-f4e53cd6149ed4dcbfd8b81a6427b1b652d0a472.zip | |
Started work on the proper structure for the lib
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..847a3a2 --- /dev/null +++ b/build.zig | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | const Builder = @import("std").build.Builder; | ||
| 2 | |||
| 3 | pub fn build(b: &Builder) void { | ||
| 4 | const mode = b.standardReleaseOptions(); | ||
| 5 | |||
| 6 | { | ||
| 7 | const example_step = b.step("examples", "Build all examples"); | ||
| 8 | const examples = [][]const u8 { | ||
| 9 | "core", | ||
| 10 | "extended", | ||
| 11 | }; | ||
| 12 | |||
| 13 | b.default_step.dependOn(example_step); | ||
| 14 | inline for (examples) |example| { | ||
| 15 | comptime const path = "examples/" ++ example ++ ".zig"; | ||
| 16 | const exe = b.addExecutable(example, path); | ||
| 17 | exe.setBuildMode(mode); | ||
| 18 | exe.addPackagePath("clap", "index.zig"); | ||
| 19 | |||
| 20 | const step = b.step("build-" ++ example, "Build '" ++ path ++ "'"); | ||
| 21 | step.dependOn(&exe.step); | ||
| 22 | example_step.dependOn(step); | ||
| 23 | } | ||
| 24 | } | ||
| 25 | |||
| 26 | { | ||
| 27 | const test_step = b.step("tests", "Run all tests"); | ||
| 28 | const tests = [][]const u8 { | ||
| 29 | "core", | ||
| 30 | "extended", | ||
| 31 | }; | ||
| 32 | |||
| 33 | b.default_step.dependOn(test_step); | ||
| 34 | inline for (tests) |test_name| { | ||
| 35 | comptime const path = "tests/" ++ test_name ++ ".zig"; | ||
| 36 | const t = b.addTest(path); | ||
| 37 | t.setBuildMode(mode); | ||
| 38 | //t.addPackagePath("clap", "index.zig"); | ||
| 39 | |||
| 40 | const step = b.step("test-" ++ test_name, "Run test '" ++ test_name ++ "'"); | ||
| 41 | step.dependOn(&t.step); | ||
| 42 | test_step.dependOn(step); | ||
| 43 | } | ||
| 44 | |||
| 45 | } | ||
| 46 | } | ||