-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_ft3d.zig
44 lines (37 loc) · 1.36 KB
/
build_ft3d.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
pub fn build(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) void {
// ft3d - the foundation 3D texture generator
const generator_exe = b.addExecutable(.{
.name = "ft3d",
.root_source_file = b.path("src/ft3d.zig"),
.target = target,
.optimize = optimize,
});
const cflags = &.{"-D_GLFW_WIN32"};
generator_exe.addIncludePath(b.path("libs/stb/include"));
generator_exe.linkLibC();
generator_exe.linkLibCpp();
switch (target.result.os.tag) {
.windows => {
generator_exe.linkSystemLibrary("gdi32");
generator_exe.linkSystemLibrary("user32");
generator_exe.linkSystemLibrary("shell32");
generator_exe.linkSystemLibrary("WS2_32");
generator_exe.addCSourceFiles(.{
.files = &.{
"libs/stb/src/stb_perlin.c",
},
.flags = cflags,
});
},
else => @panic("this project only builds on windows"),
}
b.installArtifact(generator_exe);
const ft3d_cmd = b.addRunArtifact(generator_exe);
ft3d_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
ft3d_cmd.addArgs(args);
}
const ft3d_step = b.step("ft3d", "Build a 3D texture");
ft3d_step.dependOn(&ft3d_cmd.step);
}
const std = @import("std");