Repository navigation
Expand file tree
/
Copy pathtb_common.js
More file actions
130 lines (103 loc) · 4.46 KB
/
Copy pathtb_common.js
File metadata and controls
130 lines (103 loc) · 4.46 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// @ts-check
/// <reference path="../super/tb/install/builtins.js"/>
var mingw = "C:\\msys64\\ucrt64";
var qt_version = 6;
function setCommonFlags() {
project.setVariable("MODULES", ["qt", "msi"]);
project.setVariable("COMPANY", "Npackd");
var static_ = project.getConfig().indexOf("static") >= 0;
var qt;
if (static_)
qt = mingw + "\\qt" + qt_version + "-static";
else
qt = mingw;
project.setVariable("GCC_BIN_DIR", mingw + "\\bin");
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");
project.findBinaries(qt + "\\share\\qt" + qt_version + "\\bin");
project.findBinaries(qt + "\\bin");
project.findBinaries(mingw + "\\bin");
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<String> */
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("NDEBUG");
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);
/** @type Array<String> */
var ldflags;
/** @ts-ignore */
ldflags = project.getVariable("LDFLAGS") || [];
// "-Wl,-Map," + project.getName() +".map",
ldflags.push("-Wl,--subsystem," + project.getVariable("SUBSYSTEM") + ":6.1");
if (static_) {
ldflags = ldflags.concat(["-static", "-static-libstdc++", "-static-libgcc",
"-L" + qt + "\\lib"]);
}
project.setVariable("LDFLAGS", ldflags);
if (static_)
project.setVariable("PKG_CONFIG_PATH", [
qt + "\\lib\\pkgconfig",
mingw + "/lib/pkgconfig",
mingw + "/share/pkgconfig"]);
/** @type Array<String> */
var libs_cflags;
/** @ts-ignore */
libs_cflags = project.getVariable("LIBS_CFLAGS") || [];
if (static_) {
libs_cflags.push("-I" + project.getDirectory() + "\\..\\quazip\\quazip\\quazip");
}
project.setVariable("LIBS_CFLAGS", libs_cflags);
/** @type Array<String> */
var cflags;
/** @ts-ignore */
cflags = project.getVariable("CFLAGS") || [];
cflags.push("-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++17");
if (project.getConfig().indexOf("debug") >= 0) {
// -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);
project.addLibraryInclude("Qt" + qt_version + "Core", qt + "\\include\\qt" + qt_version);
project.addLibraryInclude("Qt" + qt_version + "Core", qt + "\\include\\qt" + qt_version + "\\QtCore");
project.addLibraryInclude("Qt" + qt_version + "Xml", qt + "\\include\\qt" + qt_version + "\\QtXml");
project.addLibraryInclude("Qt" + qt_version + "Sql", qt + "\\include\\qt" + qt_version + "\\QtSql");
project.addLibraryInclude("Qt" + qt_version + "Gui", qt + "\\include\\qt" + qt_version + "\\QtGui");
project.addLibraryInclude("Qt" + qt_version + "Widgets", qt + "\\include\\qt" + qt_version + "\\QtWidgets");
project.addLibraryInclude("Qt6Core5Compat", qt + "\\include\\qt" + qt_version + "\\QtCore5Compat");
if (!static_) {
project.findPkgConfigLibrary("quazip1-qt" + qt_version + "", { static: static_ });
var qt_plugins = qt + "\\share\\qt" + qt_version + "\\plugins\\";
project.setLibraryPath("qsqlite", qt_plugins + "sqldrivers\\libqsqlite.a");
}
if (static_)
project.findLibraries(qt);
else
project.findLibraries(qt + "\\lib");
}