-
Notifications
You must be signed in to change notification settings - Fork 31
/
tb_common.js
75 lines (62 loc) · 2.61 KB
/
tb_common.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
// @ts-check
/// <reference path="../super/tb/install/builtins.js"/>
function setCommonFlags() {
var static = project.getConfig().indexOf("static") >= 0;
project.findBinaries("C:\\msys64\\mingw64\\bin");
project.setVariable("COMPANY", "Npackd");
project.setVariable("WIX_LIGHT", "C:\\Program Files (x86)\\WiX Toolset v3.11\\bin\\light.exe");
project.setVariable("WIX_CANDLE", "C:\\Program Files (x86)\\WiX Toolset v3.11\\bin\\candle.exe");
var version = system.readTextFile(project.getDirectory() + "\\..\\appveyor.yml");
version = version.split('\n')[0];
version = version.split(':')[1];
version = version.split('{')[0];
version = version + "0";
version = version.trim();
console.log(version);
project.setVariable("VERSION", version);
/** @type Array */
var defines;
/** @ts-ignore */
defines = project.getVariable("DEFINES");
if (defines === null)
defines = [];
defines.push("UNICODE");
defines.push("_UNICODE");
defines.push("_WIN32_WINNT=0x0601");
defines.push("NOMINMAX");
defines.push("DNDEBUG");
defines.push("NPACKD_ADMIN=1");
defines.push("NPACKD_VERSION=\"" + version + "\"");
if (static) {
defines.push("QUAZIP_STATIC=1");
defines.push("NPACKD_STATIC");
}
project.setVariable("DEFINES", defines);
// "-Wl,-Map," + project.getName() +".map",
var ldflags = ["-Wl,--subsystem," + project.getVariable("SUBSYSTEM") + ":6.1"];
if (static) {
project.setVariable("PKG_CONFIG_PATH", [
"C:\\msys64/mingw64/lib/pkgconfig",
"C:\\msys64/mingw64/share/pkgconfig",
"C:\\msys64\\mingw64\\qt5-static\\lib\\pkgconfig"]);
ldflags = ldflags.concat(["-static", "-static-libstdc++", "-static-libgcc",
"-LC:\\msys64\\mingw64\\qt5-static\\lib"]);
}
project.setVariable("LDFLAGS", ldflags);
var cflags = ["-g", "-Os", "-Wall", "-Wwrite-strings",
"-Wextra", "-Wno-unused-parameter", "-Wno-cast-function-type",
"-Wduplicated-cond", "-Wduplicated-branches", "-Wlogical-op", "-Wno-error=cast-qual",
"-Wno-unused-local-typedefs", "-Wno-unused-variable", "-std=gnu++11"];
if (static)
cflags.push("-I" + project.getDirectory() + "\\..\\quazip\\quazip\\quazip");
if (project.getConfig() === "debug") {
// -O0 outputs no warnings about uninitialized variables
// GDB stops at wrong lines sometimes with -O2
cflags.push("-O1");
cflags.push("-fno-omit-frame-pointer");
} else {
cflags.push("-Os");
}
project.setVariable("CFLAGS", cflags);
}
setCommonFlags();