-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
31 lines (27 loc) · 953 Bytes
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "sdl-zig-demo",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
if (target.isNativeOs() and target.getOsTag() == .linux) {
// The SDL package doesn't work for Linux yet, so we rely on system
// packages for now.
exe.linkSystemLibrary("SDL2");
exe.linkLibC();
} else {
const sdl_dep = b.dependency("sdl", .{
.optimize = .ReleaseFast,
.target = target,
});
exe.linkLibrary(sdl_dep.artifact("SDL2"));
}
b.installArtifact(exe);
const run = b.step("run", "Run the demo");
const run_cmd = b.addRunArtifact(exe);
run.dependOn(&run_cmd.step);
}