-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.zig
47 lines (40 loc) · 1.22 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "roam",
.target = target,
.optimize = optimize,
});
exe.linkLibC();
exe.linkSystemLibrary("glew");
exe.linkSystemLibrary("sdl2");
if (target.result.os.tag == .macos) {
exe.linkFramework("OpenGL");
} else {
exe.linkSystemLibrary("gl");
}
exe.addIncludePath(.{ .cwd_relative = "stb/" });
exe.addIncludePath(.{ .cwd_relative = "src/" });
const sources: []const []const u8 = if (target.result.os.tag == .windows)
&[_][]const u8{"roam_windows.c"}
else
&[_][]const u8{"roam_linux.c"};
exe.addCSourceFiles(.{
.root = b.path("src"),
.files = sources,
.flags = &.{
"-fno-sanitize=undefined",
"-DNDEBUG",
},
});
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the game");
run_step.dependOn(&run_cmd.step);
}