-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
106 lines (77 loc) · 3.02 KB
/
Copy pathbuild.zig
File metadata and controls
106 lines (77 loc) · 3.02 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const std = @import("std");
const x86 = @import("std").Target.x86;
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
if (target.result.os.tag == .macos) {
std.debug.print("Target operating system is not supported by EE3D.\n", .{});
}
const lib_mod = b.createModule(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
const exe_mod = b.createModule(.{
.root_source_file = b.path("editor/main.zig"),
.target = target,
.optimize = optimize,
});
exe_mod.addImport("EE3D", lib_mod);
const lib = b.addLibrary(.{
.linkage = .static,
.name = "EE3D",
.root_module = lib_mod,
});
// Dependencies
const zglfw = b.dependency("zglfw", .{});
lib.root_module.addImport("zglfw", zglfw.module("root"));
if (target.result.os.tag != .emscripten) {
lib.linkLibrary(zglfw.artifact("glfw"));
}
const zopengl = b.dependency("zopengl", .{});
lib.root_module.addImport("zopengl", zopengl.module("root"));
const zigstbi = b.dependency("ZigSTBI", .{});
lib.root_module.addImport("zigstbi", zigstbi.module("zigstbi"));
const nfd = b.dependency("NFD", .{});
lib.root_module.addImport("nfd", nfd.module("nfd"));
const zgui = b.dependency("zgui", .{
.shared = false,
.with_implot = false,
.backend = .glfw_opengl3,
.target = target,
});
lib.root_module.addImport("zgui", zgui.module("root"));
const assimp = b.dependency("ZigAssimp", .{ .formats = "FBX,Obj,B3D,Blend,glTF,glTF2" });
const cglm = b.dependency("CGLM", .{});
lib.addIncludePath(cglm.path("include"));
lib.linkLibrary(cglm.artifact("cglm"));
lib.linkLibrary(assimp.artifact("assimp"));
lib.linkLibrary(zgui.artifact("imgui"));
lib_mod.addIncludePath(assimp.path("include"));
const exe = b.addExecutable(.{
.name = "EE3D_Editor",
.root_module = exe_mod,
});
b.installArtifact(exe);
b.installDirectory(.{ .install_dir = .bin, .source_dir = b.path("editor/Editor_Assets/"), .install_subdir = "Editor_Assets" });
b.installDirectory(.{ .install_dir = .bin, .source_dir = b.path("Fonts/"), .install_subdir = "Fonts" });
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 app");
run_step.dependOn(&run_cmd.step);
const lib_unit_tests = b.addTest(.{
.root_module = lib_mod,
});
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const exe_unit_tests = b.addTest(.{
.root_module = exe_mod,
});
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_lib_unit_tests.step);
test_step.dependOn(&run_exe_unit_tests.step);
}