-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.zig
90 lines (73 loc) · 2.42 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const std = @import("std");
const is_windows_host = (std.builtin.os.tag == .windows);
const pkgs = struct {
const painterz = std.build.Pkg{
.name = "painterz",
.path = "extern/painterz/painterz.zig",
};
const interface = std.build.Pkg{
.name = "interface",
.path = "extern/interface/interface.zig",
};
const args = std.build.Pkg{
.name = "args",
.path = "extern/args/args.zig",
};
const lola = std.build.Pkg{
.name = "lola",
.path = "extern/lola/src/library/main.zig",
.dependencies = &[_]std.build.Pkg{
interface,
},
};
const sdl2 = std.build.Pkg{
.name = "sdl2",
.path = "extern/sdl2/src/lib.zig",
};
const zgs = std.build.Pkg{
.name = "zgs",
.path = "src/core/zgs.zig",
.dependencies = &[_]std.build.Pkg{
lola, painterz,
},
};
};
pub fn build(b: *std.build.Builder) !void {
try std.fs.cwd().makePath("zig-cache/bin");
const pc_exe = b.addExecutable("zgs.pc", "src/pc/main.zig");
pc_exe.linkLibC();
pc_exe.linkSystemLibrary("sdl2");
pc_exe.addPackage(pkgs.sdl2);
pc_exe.addPackage(pkgs.zgs);
pc_exe.addPackage(pkgs.lola);
pc_exe.addPackage(pkgs.args);
pc_exe.install();
const run_step = pc_exe.run();
run_step.addArg("--directory");
run_step.addArg("examples/bouncy");
b.step("run", "Starts the game system").dependOn(&run_step.step);
const resources_step = b.step("resources", "Regenerates the resource files");
{
const compile_mkbitmap = b.addSystemCommand(&[_][]const u8{
if (is_windows_host) "C:\\Windows\\Microsoft.NET\\Framework\\v.4.0.30319\\csc" else "mcs",
"src/tools/mkbitmap.cs",
"/r:System.Drawing.dll",
"/out:zig-cache/bin/mkbitmap.exe",
});
const build_font = b.addSystemCommand(if (is_windows_host)
&[_][]const u8{
"zig-cache\\bin\\mkbitmap.exe",
"res/dos_8x8_font_white.png",
"src/core/res/font.dat",
}
else
&[_][]const u8{
"mono",
"zig-cache\\bin\\mkbitmap.exe",
"res/dos_8x8_font_white.png",
"src/core/res/font.dat",
});
build_font.step.dependOn(&compile_mkbitmap.step);
resources_step.dependOn(&build_font.step);
}
}