forked from BesLyric-for-X/BesLyric-for-X
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBeslyric-for-X.pro
305 lines (239 loc) · 8.12 KB
/
Beslyric-for-X.pro
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
#-------------------------------------------------
#
# Project created by QtCreator 2018-07-05T22:26:31
#
#-------------------------------------------------
QT += core gui network widgets
# For OpenSSL 1.1.1, we need Qt 5.12.4+.
# https://www.qt.io/blog/2019/06/17/qt-5-12-4-released-support-openssl-1-1-1
# https://github.com/BesLyric-for-X/BesLyric-for-X/issues/29
is_qt_version_too_low = false
lessThan(QT_MAJOR_VERSION, 5) {
is_qt_version_too_low = true
}
else:equals(QT_MAJOR_VERSION, 5) {
lessThan(QT_MINOR_VERSION, 12) {
is_qt_version_too_low = true
}
else:equals(QT_MINOR_VERSION, 12):lessThan(QT_PATCH_VERSION, 4) {
is_qt_version_too_low = true
}
}
equals(is_qt_version_too_low, true) {
error("Qt version >= 5.12.4 is required, you are using $$[QT_VERSION].")
}
TARGET = BesLyric-for-X
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# To disable qDebug(), pass "-before DEFINES*=RELEASE_VERSION" to qmake
contains(DEFINES, "RELEASE_VERSION") {
message("DEFINES \"RELEASE_VERSION\" detected.")
DEFINES *= QT_NO_DEBUG_OUTPUT
}
INCLUDEPATH +=$$PWD BesWidgets
include(BesWidgets/BesWidgets.pri)
INCLUDEPATH +=$$PWD StackFrame
include(StackFrame/StackFrame.pri)
INCLUDEPATH +=$$PWD TopWidgets
include(TopWidgets/TopWidgets.pri)
INCLUDEPATH +=$$PWD MiddleWidgets
include(MiddleWidgets/MiddleWidgets.pri)
INCLUDEPATH +=$$PWD BottomWidgets
include(BottomWidgets/BottomWidgets.pri)
INCLUDEPATH +=$$PWD Entities
include(Entities/Entities.pri)
INCLUDEPATH +=$$PWD Utility
include(Utility/Utility.pri)
SOURCES += main.cpp \
StackFrame.cpp
HEADERS += \
Define/Define.h\
Define/Enum.h\
Define/Struct.h\
Define/Static.h\
global.h \
StackFrame.h \
MyApplication.h
OTHER_FILES += \
LICENSE \
README.md \
version.txt
RESOURCES += \
resource.qrc
# Git commit SHA1.
isEmpty(GIT_COMMIT_SHA1) {
warning("No \"GIT_COMMIT_SHA1\" in qmake arguments. Try to find in environment.")
GIT_COMMIT_SHA1 = $$getenv(GIT_COMMIT_SHA1)
}
isEmpty(GIT_COMMIT_SHA1) {
warning("No \"GIT_COMMIT_SHA1\" in environment. Try to get it by executing the command 'git -C \"$${_PRO_FILE_PWD_}\" rev-parse HEAD'.")
GIT_COMMIT_SHA1 = $$system("git -C \"$${_PRO_FILE_PWD_}\" rev-parse HEAD")
}
!contains(GIT_COMMIT_SHA1, "^[0-9a-f]{40}$") {
warning("\"$${GIT_COMMIT_SHA1}\" is NOT a valid GIT_COMMIT_SHA1. Use the default one.")
GIT_COMMIT_SHA1 = "0000000000000000000000000000000000000000"
}
message("GIT_COMMIT_SHA1 = $${GIT_COMMIT_SHA1}")
DEFINES *= "GIT_COMMIT_SHA1=\\\"$${GIT_COMMIT_SHA1}\\\""
# Version number. All in one.
isEmpty(APP_VERSION) {
warning("No \"APP_VERSION\" in qmake arguments. Try to find in environment.")
APP_VERSION = $$getenv(APP_VERSION)
}
isEmpty(APP_VERSION) {
warning("No \"APP_VERSION\" in environment. Try to get it by executing the command 'git -C \"$${_PRO_FILE_PWD_}\" describe --tags --abbrev=0'.")
APP_VERSION_starts_with_v = $$system("git -C \"$${_PRO_FILE_PWD_}\" describe --tags --abbrev=0")
APP_VERSION = $$replace(APP_VERSION_starts_with_v, "v", "")
unset(APP_VERSION_starts_with_v)
}
!contains(APP_VERSION, "^\d+\.\d+\.\d+$") {
warning("\"$${APP_VERSION}\" is NOT a valid APP_VERSION. Use the default one.")
APP_VERSION = "3.1.2"
}
message("APP_VERSION = $${APP_VERSION}")
DEFINES *= "APP_VERSION=\\\"$${APP_VERSION}\\\""
VERSION = "$${APP_VERSION}"
# windows icon and exe file infomation
# https://doc.qt.io/qt-5/qmake-platform-notes.html#adding-windows-resource-files
win32{
QMAKE_TARGET_COMPANY = "BesStudio"
QMAKE_TARGET_DESCRIPTION = "BesLyric-for-X is a lyric (.lrc) maker in the style of NetEase Cloud Music"
QMAKE_TARGET_COPYRIGHT = "copyleft (C) GPL"
QMAKE_TARGET_PRODUCT = "BesLyric"
RC_ICONS = Beslyric.ico
RC_LANG = 0x0804 # zh-CN
}
# set icon under Mac Os
macx{
ICON = BesLyric.icns
}
# ubuntu icon recoginition
# No test on other Linux distros!
# from: https://stackoverflow.com/questions/45329372/ubuntu-recognizes-executable-as-shared-library-and-wont-run-it-by-clicking
!macx:unix{
QMAKE_LFLAGS *= -no-pie
}
#--------------------------------
#屏蔽 msvc 编译器对 rational.h 的 warning: C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
win32-msvc*:QMAKE_CXXFLAGS += /wd"4819"
#--------------------------------
# Third-party libraries
win32 {
isEmpty(B4X_DEP_PATH) {
B4X_DEP_PATH = $$getenv(B4X_DEP_PATH)
}
isEmpty(B4X_DEP_PATH) {
error("\"B4X_DEP_PATH\" is NOT set.")
}
contains(B4X_DEP_PATH, "^\s*$") {
error("\"B4X_DEP_PATH\" is empty.")
}
message("B4X_DEP_PATH = $${B4X_DEP_PATH}")
dep_base_path = $$system_path($$absolute_path($$clean_path($${B4X_DEP_PATH})))
!exists($${dep_base_path}) {
error("\"$${dep_base_path}\" does NOT exist.")
}
message("dep_base_path = $${dep_base_path}")
dep_include_path = $$system_path($${dep_base_path}/include)
!exists($${dep_include_path}) {
error("\"$${dep_include_path}\" does NOT exist.")
}
message("dep_include_path = $${dep_include_path}")
dep_lib_path = $$system_path($${dep_base_path}/lib)
!exists($${dep_lib_path}) {
error("\"$${dep_lib_path}\" does NOT exist.")
}
message("dep_lib_path = $${dep_lib_path}")
INCLUDEPATH *= \
$${dep_include_path} \
$$system_path($${dep_include_path}/SDL2)
LIBS *= \
-L$${dep_lib_path} \
-lavcodec \
-lavdevice \
-lavfilter \
-lavformat \
-lavutil \
-lpostproc \
-lswresample \
-lswscale \
-lSDL2
unset(dep_lib_path)
unset(dep_include_path)
unset(dep_base_path)
unset(B4X_DEP_PATH)
}
unix {
CONFIG *= link_pkgconfig
PKGCONFIG *= \
libavcodec \
libavdevice \
libavfilter \
libavformat \
libavutil \
libpostproc \
libswresample \
libswscale \
sdl2
}
#--------------------------------
# "Install" required files to specific directory via "make install INSTALL_ROOT='somewhere'"
# For create-dmg.
macx {
icon_icns.files = "$${_PRO_FILE_PWD_}/BesLyric.icns"
icon_icns.path = "/"
INSTALLS *= icon_icns
}
# For Inno Setup.
win32 {
icon_ico.files = "$${_PRO_FILE_PWD_}/Beslyric.ico"
icon_ico.path = "/"
INSTALLS *= icon_ico
version_txt.files = "$${_PRO_FILE_PWD_}/version.txt"
version_txt.path = "/"
INSTALLS *= version_txt
}
# For target, both binary and debugging symbol go to target.path .
# See also QTBUG-81354 for MinGW.
unix:!macx {
# For AppImage.
# INSTALL_ROOT=AppDir
target.path = "/usr/bin"
} else {
target.path = "/"
}
INSTALLS *= target
# For AppImage.
# INSTALL_ROOT=AppDir
unix:!macx {
appdir_desktop.path = "/usr/share/applications"
appdir_desktop.files = "$${_PRO_FILE_PWD_}/BesLyric-for-X.AppDir$${appdir_desktop.path}/BesLyric-for-X.desktop"
INSTALLS *= appdir_desktop
icon_sizes = \
"16x16" \
"24x24" \
"32x32" \
"32x32@2" \
"48x48" \
"64x64" \
"64x64@2" \
"72x72" \
"96x96" \
"128x128" \
"256x256" \
"256x256@2" \
for(icon_size, icon_sizes) {
appdir_icon_$${icon_size}.path = "/usr/share/icons/hicolor/$${icon_size}/apps"
appdir_icon_$${icon_size}.files = "$${_PRO_FILE_PWD_}/BesLyric-for-X.AppDir$$eval(appdir_icon_$${icon_size}.path)/BesLyric-for-X.png"
INSTALLS *= appdir_icon_$${icon_size}
}
}
#--------------------------------