-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ts
94 lines (85 loc) · 1.82 KB
/
build.ts
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
import { Builder } from "../index";
const packages = [
"glfw",
"glm",
"stb",
"fmt",
"entt",
"vulkan-memory-allocator",
"vk-bootstrap",
"imgui docking",
"fastgltf",
"yaml-cpp",
"nativefiledialog-extended",
"taskflow",
"concurrentqueue",
"stduuid",
"dylib",
"libuv",
];
const defines = [
"GLFW_INCLUDE_VULKAN",
"GLM_ENABLE_EXPERIMENTAL",
"GLM_FORCE_DEPTH_ZERO_TO_ONE",
"GLM_FORCE_RADIANS",
"IMGUI_DEFINE_MATH_OPERATORS",
"DAWN_USE_DRAW_INDIRECT",
"DAWN_USE_EXCEPTIONS",
"GLFW_INCLUDE_NONE",
];
const cxxFlags = [
"-m64",
"-std=c++20",
"-msse2",
"-fPIC",
"-fexceptions",
"-g",
"-DDEBUG",
"-Werror=return-type",
"-mfpmath=sse",
];
export default async function (builder: Builder) {
const physics = "jolt";
const editor = true;
const useDrawIndirect = true;
if (editor) {
defines.push("DAWN_EDITOR");
}
if (useDrawIndirect) {
defines.push("DAWN_USE_DRAW_INDIRECT");
}
if (physics === "jolt") {
packages.push("joltphysics");
defines.push(
"DAWN_USE_JOLT",
"JPH_OBJECT_LAYER_BITS=16",
"JPH_PROFILE_ENABLED",
"JPH_DEBUG_RENDERER",
"JPH_NO_DEBUG",
"JPH_OBJECT_STREAM"
);
}
const dawn = builder
.addLibrary("dawn")
.include("dawn/src")
.addPackages(...packages)
.define(...defines)
.setCXXFlags(...cxxFlags)
.setCXXStandard("20")
.setLinkOptions("-m64")
.link("stdc++", "m", "vulkan", "dbus-1")
.setPCXXHeader("dawn/src/dawn/pch.h")
.addDirectory("extra");
await dawn.build();
const exe = builder
.addExecutable("project_template")
.dependOn(dawn)
.include("dawn/src", "src")
.addPackages(...packages)
.define(...defines)
.setCXXFlags(...cxxFlags)
.setCXXStandard("20")
.setLinkOptions("-m64")
.addDirectory("extra");
await exe.build();
}