From f4e53cd6149ed4dcbfd8b81a6427b1b652d0a472 Mon Sep 17 00:00:00 2001 From: Jimmi HC Date: Thu, 31 May 2018 16:00:44 +0200 Subject: Started work on the proper structure for the lib --- build.zig | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 build.zig (limited to 'build.zig') diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..847a3a2 --- /dev/null +++ b/build.zig @@ -0,0 +1,46 @@ +const Builder = @import("std").build.Builder; + +pub fn build(b: &Builder) void { + const mode = b.standardReleaseOptions(); + + { + const example_step = b.step("examples", "Build all examples"); + const examples = [][]const u8 { + "core", + "extended", + }; + + b.default_step.dependOn(example_step); + inline for (examples) |example| { + comptime const path = "examples/" ++ example ++ ".zig"; + const exe = b.addExecutable(example, path); + exe.setBuildMode(mode); + exe.addPackagePath("clap", "index.zig"); + + const step = b.step("build-" ++ example, "Build '" ++ path ++ "'"); + step.dependOn(&exe.step); + example_step.dependOn(step); + } + } + + { + const test_step = b.step("tests", "Run all tests"); + const tests = [][]const u8 { + "core", + "extended", + }; + + b.default_step.dependOn(test_step); + inline for (tests) |test_name| { + comptime const path = "tests/" ++ test_name ++ ".zig"; + const t = b.addTest(path); + t.setBuildMode(mode); + //t.addPackagePath("clap", "index.zig"); + + const step = b.step("test-" ++ test_name, "Run test '" ++ test_name ++ "'"); + step.dependOn(&t.step); + test_step.dependOn(step); + } + + } +} -- cgit v1.2.3