forked from armory3d/armortools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
khafile.js
142 lines (129 loc) · 5.08 KB
/
khafile.js
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
let debug = false;
let android = process.argv.indexOf("android") >= 0;
let ios = process.argv.indexOf("ios") >= 0;
let win_hlsl = process.platform === "win32" && process.argv.indexOf("opengl") < 0;
let d3d12 = process.argv.indexOf("direct3d12") >= 0;
let vulkan = process.argv.indexOf("vulkan") >= 0;
let raytrace = d3d12 || vulkan;
let metal = process.argv.indexOf("metal") >= 0;
let vr = process.argv.indexOf("--vr") >= 0;
let snapshot = process.argv.indexOf("--snapshot") >= 0;
let plugin_embed = ios;
let project = new Project("ArmorPaint");
project.addSources("Sources");
project.addLibrary("iron");
project.addLibrary("zui");
project.addLibrary("armorbase");
project.addShaders("Shaders/*.glsl", { embed: snapshot});
project.addAssets("Assets/*", { destination: "data/{name}", embed: snapshot });
project.addShaders("Libraries/armorbase/Shaders/common/*.glsl", { embed: snapshot});
project.addAssets("Libraries/armorbase/Assets/common/*", { destination: "data/{name}", embed: snapshot });
if (!snapshot) {
project.addDefine("arm_noembed");
project.addAssets("Libraries/armorbase/Assets/common/extra/*", { destination: "data/{name}" });
}
project.addAssets("Assets/export_presets/*", { destination: "data/export_presets/{name}" });
project.addAssets("Assets/keymap_presets/*", { destination: "data/keymap_presets/{name}" });
project.addAssets("Assets/locale/*", { destination: "data/locale/{name}" });
project.addAssets("Assets/licenses/**", { destination: "data/licenses/{name}" });
project.addAssets("Assets/plugins/*", { destination: "data/plugins/{name}" });
if (plugin_embed) {
project.addAssets("Assets/plugins/embed/*", { destination: "data/plugins/{name}" });
}
else {
project.addAssets("Assets/plugins/wasm/*", { destination: "data/plugins/{name}" });
}
project.addAssets("Assets/meshes/*", { destination: "data/meshes/{name}" });
project.addAssets("Libraries/armorbase/Assets/licenses/**", { destination: "data/licenses/{name}" });
project.addAssets("Libraries/armorbase/Assets/themes/*.json", { destination: "data/themes/{name}" });
if (metal) {
project.addShaders("Libraries/armorbase/Shaders/common/metal/*.glsl", { embed: snapshot});
project.addAssets("Libraries/armorbase/Assets/common/metal/*", { destination: "data/{name}" });
}
project.addDefine("js-es=6");
project.addParameter("--macro include('arm.node.brush')");
project.addDefine("kha_no_ogg");
project.addDefine("zui_translate");
project.addDefine("arm_data_dir");
project.addDefine("arm_ltc");
project.addDefine("arm_appwh");
project.addDefine("arm_skip_envmap");
project.addDefine("arm_resizable");
project.addDefine("arm_taa");
project.addDefine("arm_veloc");
project.addDefine("arm_particles");
// project.addDefine("arm_physics");
// project.addDefine("arm_skin");
if (android) {
project.addDefine("krom_android");
project.addDefine("kha_android");
project.addDefine("kha_android_rmb");
}
else if (ios) {
project.addDefine("krom_ios");
project.addDefine("kha_ios");
}
else if (process.platform === "win32") {
project.addDefine("krom_windows");
project.addDefine("kha_windows");
}
else if (process.platform === "linux") {
project.addDefine("krom_linux");
project.addDefine("kha_linux");
}
else if (process.platform === "darwin") {
project.addDefine("krom_darwin");
project.addDefine("kha_darwin");
}
if (android || ios) {
project.addDefine("arm_touchui"); // Use touch friendly UI
project.addDefine("zui_touchui");
}
if (debug) {
project.addDefine("arm_debug");
project.addParameter("--times");
// project.addParameter("--no-inline");
}
else {
project.addParameter("-dce full");
project.addDefine("analyzer-optimize");
}
if (vr) {
project.addDefine("arm_vr");
project.addAssets("Assets/readme/readme_vr.txt", { destination: "{name}" });
}
if (snapshot) {
project.addDefine("arm_snapshot");
project.addDefine("arm_image_embed");
project.addDefine("arm_shader_embed");
project.addParameter("--no-traces");
}
project.addAssets("Assets/readme/readme.txt", { destination: "{name}" });
if (raytrace) {
project.addAssets("Libraries/armorbase/Assets/raytrace/*", { destination: "data/{name}", embed: snapshot });
if (d3d12) {
project.addAssets("Libraries/armorbase/Shaders/raytrace/*.cso", { destination: "data/{name}", embed: snapshot });
project.addAssets("Assets/readme/readme_dxr.txt", { destination: "{name}" });
}
else if (vulkan) {
project.addAssets("Libraries/armorbase/Shaders/raytrace/*.spirv", { destination: "data/{name}", embed: snapshot });
project.addAssets("Assets/readme/readme_vkrt.txt", { destination: "{name}" });
}
}
if (android) {
project.addAssets("Assets/readme/readme_android.txt", { destination: "{name}" });
}
else if (ios) {
project.addAssets("Assets/readme/readme_ios.txt", { destination: "{name}" });
}
if (process.platform !== "darwin" && !raytrace && !android && !ios) {
project.addDefine("rp_voxelao");
project.addDefine("arm_voxelgi_revox");
if (process.platform === "win32" && win_hlsl) {
project.addShaders("Libraries/armorbase/Shaders/voxel_hlsl/*.glsl", { embed: snapshot, noprocessing: true });
}
else {
project.addShaders("Libraries/armorbase/Shaders/voxel_glsl/*.glsl", { embed: snapshot });
}
}
resolve(project);