ref: a5d2874ffb9c29eeec3a6fd430e21bbc93ae0948 snake-zig/build.zig -rw-r--r-- 681 bytes View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const Builder = @import("std").build.Builder;

pub fn build(b: *Builder) void {
    const mode = b.standardReleaseOptions();
    const target = b.standardTargetOptions(null);
    const exe = b.addExecutable("snake", "src/main.zig");
    exe.setBuildMode(mode);
    exe.setTheTarget(target);

    exe.addIncludeDir("stb_image");
    exe.addCSourceFile("stb_image/stb_image_impl.c", [_][]const u8{"-std=c99"});
    exe.linkSystemLibrary("c");
    exe.linkSystemLibrary("glfw");
    exe.linkSystemLibrary("epoxy");
    exe.install();

    const play = b.step("play", "Play snake");
    const run = exe.run();
    run.step.dependOn(b.getInstallStep());
    play.dependOn(&run.step);
}