diff options
| author | realtradam <[email protected]> | 2022-04-14 08:37:05 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-04-14 08:37:05 -0400 |
| commit | 20a0d29ccc3a330691519b285121f564374b8eb5 (patch) | |
| tree | 46445dac6f1edb94ce4a3dd9a3f4e7ef290daccb /build.zig | |
| download | zig-chip-8-20a0d29ccc3a330691519b285121f564374b8eb5.tar.gz zig-chip-8-20a0d29ccc3a330691519b285121f564374b8eb5.zip | |
init
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..f8394ee --- /dev/null +++ b/build.zig @@ -0,0 +1,44 @@ +const std = @import("std"); + +pub fn build(b: *std.build.Builder) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard release options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. + const mode = b.standardReleaseOptions(); + + const exe = b.addExecutable("testraylib", "src/main.zig"); + exe.linkSystemLibrary("c"); + exe.linkSystemLibrary("raylib"); + //exe.linkSystemLibrary("extras/raygui"); + //exe.addStaticLibrary("raygui", getSrcDir() ++ "/include/raygui.h"); + exe.setTarget(target); + exe.setBuildMode(mode); + exe.install(); + + const run_cmd = exe.run(); + run_cmd.step.dependOn(b.getInstallStep()); + if (b.args) |args| { + run_cmd.addArgs(args); + } + + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); + + const exe_tests = b.addTest("src/main.zig"); + exe_tests.setTarget(target); + exe_tests.setBuildMode(mode); + + const test_step = b.step("test", "Run unit tests"); + test_step.dependOn(&exe_tests.step); +} + +const srcdir = getSrcDir(); + +fn getSrcDir() []const u8 { + return std.fs.path.dirname(@src().file) orelse "."; +} |
