-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo_build.zig
92 lines (83 loc) · 2.28 KB
/
demo_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
91
92
const std = @import("std");
///
///
///
pub fn create_demo_binary_and_test_step(
b: *std.Build,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
box2c_lib: *std.Build.Step.Compile,
comptime binary_name: []const u8,
comptime source_filename: []const u8,
) void {
const exe = b.addExecutable(.{
.name = binary_name,
.root_source_file = .{ .path = source_filename },
.target = target,
.optimize = optimize,
});
exe.addIncludePath(.{ .path = "box2c/include" });
exe.linkLibrary(box2c_lib);
exe.linkSystemLibrary("m");
exe.addIncludePath(.{ .path = "raylib/zig-out/include" });
exe.addObjectFile(.{ .path = "raylib/zig-out/lib/libraylib.a" });
exe.linkLibC();
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
// run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run-" ++ binary_name, "Run the " ++ binary_name ++ " demo");
run_step.dependOn(&run_cmd.step);
}
///
/// Compile all demo binaries
///
pub fn build(
b: *std.Build,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
box2c_lib: *std.Build.Step.Compile,
) void {
create_demo_binary_and_test_step(
b,
target,
optimize,
box2c_lib,
"dynamic-box",
"src/dynamic-box-demo.zig",
);
create_demo_binary_and_test_step(
b,
target,
optimize,
box2c_lib,
"temp-test",
"src/temp_test.zig",
);
// --------------------------------------------------------------
// Camera test examples
// --------------------------------------------------------------
create_demo_binary_and_test_step(
b,
target,
optimize,
box2c_lib,
"centre-with-player-position",
"src/camera_examples/2d/centre-with-player-position.zig",
);
create_demo_binary_and_test_step(
b,
target,
optimize,
box2c_lib,
"move-and-zoom-by-mouse",
"src/camera_examples/2d/move-and-zoom-by-mouse.zig",
);
create_demo_binary_and_test_step(
b,
target,
optimize,
box2c_lib,
"first-person-view",
"src/camera_examples/3d/first-person-view.zig",
);
}