-
Notifications
You must be signed in to change notification settings - Fork 2
/
kfile.js
76 lines (64 loc) · 2.28 KB
/
kfile.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
const process = require("process");
const path = require("path");
let project = new Project("KincHL");
await project.addProject(process.env["KINC_PATH"] ?? "Kinc");
project.addDefine('KORE_DEBUGDIR=""');
project.addFile("src/kinchl.c");
project.addFile("tests/**"); // shaders
project.addIncludeDir("src/");
project.addExclude("src/g5/**");
if (process.env["KINCHL_VALIDATE_VULKAN"]) {
project.addDefine("VALIDATE");
}
if (process.env["INCLUDE_KRAFIX"]) {
await project.addProject(process.env["KRAFIX_PATH"] ?? "krafix");
project.addDefine("INCLUDE_KRAFIX");
}
switch (platform) {
case Platform.Linux:
project.addLib("hl");
break;
case Platform.OSX:
if (require("fs").existsSync("/usr/local/lib/libhl.dylib")) {
project.addIncludeDir("/usr/local/include");
project.addLib("/usr/local/lib/libhl.dylib");
} else {
project.addLib("libhl.dylib");
}
break;
case Platform.iOS:
if (process.env["HASHLINK_BIN"]) project.addIncludeDir(process.env["HASHLINK_BIN"]);
project.addLib(path.join(process.env["HASHLINK_BIN"], "libhl.dylib"));
break;
case Platform.Windows: {
let hl_inc = null;
if (process.env["HASHLINK_SRC"]) {
hl_inc = process.env["HASHLINK_SRC"]
} else if (process.env["HASHLINK"] ?? process.env["HASHLINK_PATH"]) {
hl_inc = (process.env["HASHLINK"] ?? process.env["HASHLINK_PATH"]) + "/include";
}
if (hl_inc == null) throw "could not find hashlink include path";
let hl_bin = process.env["HASHLINK_BIN"] ?? process.env["HASHLINK"] ?? process.env["HASHLINK_PATH"] ?? null;
if (hl_bin == null) throw "could not find hashlink binaries";
project.addLib(hl_bin + "/libhl");
project.addIncludeDir(hl_inc);
break;
}
case Platform.Android:
{
let hl_inc = null;
if (process.env["HASHLINK_SRC"]) {
hl_inc = process.env["HASHLINK_SRC"]
} else if (process.env["HASHLINK"] ?? process.env["HASHLINK_PATH"]) {
hl_inc = (process.env["HASHLINK"] ?? process.env["HASHLINK_PATH"]) + "/include";
}
if (hl_inc == null) throw "could not find hashlink include path";
let hl_bin = process.env["HASHLINK_BIN"] ?? process.env["HASHLINK"] ?? process.env["HASHLINK_PATH"] ?? null;
if (hl_bin == null) throw "could not find hashlink binaries";
project.addLib("hl");
project.addIncludeDir(hl_inc);
break;
}
}
project.flatten();
resolve(project);