forked from quniu/Trojan-Qt5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trojan-qt5.pro
438 lines (400 loc) · 13.7 KB
/
trojan-qt5.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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
#
# Copyright (C) 2015-2016 Symeon Huang <[email protected]>
# Copyright (C) 2019-2020 TheWanderingCoel <[email protected]>
#
# Trojan-Qt5 is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Trojan-Qt5 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Trojan-Qt5; see the file LICENSE. If not, see
# <http://www.gnu.org/licenses/>.
#
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT_CONFIG -= no-pkg-config
RC_ICONS = $$PWD/resources/icons/trojan-qt5_new_white.ico
ICON = $$PWD/resources/icons/trojan-qt5_new.icns
TARGET = trojan-qt5
# Use OpenSource Version of Qt5
QT_EDITION = OpenSource
CONFIG += c++17
CONFIG += sdk_no_version_check
CONFIG += link_pkgconfig
# Sanitizer
#CONFIG += sanitizer sanitize_address
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked 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
# Remove Annoying Warning
DEFINES += QT_NO_WARNING_OUTPUT
# Define App Version
DEFINES += "APP_VERSION=\"\\\"1.4.1\\\"\""
# Set Build Info String
_TROJAN_QT5_BUILD_INFO_STR_=$$getenv(_TROJAN_QT5_BUILD_INFO_)
isEmpty(_TROJAN_QT5_BUILD_INFO_STR_) {
_TROJAN_QT5_BUILD_INFO_STR_ = "Trojan-Qt5 build from local machine"
}
DEFINES += _TROJAN_QT5_BUILD_INFO_STR_=\"\\\"$${_TROJAN_QT5_BUILD_INFO_STR_}\\\"\"
# QHttpServer
DEFINES += QHTTPSERVER_EXPORT
# QtColorPicker
DEFINES += QT_QTCOLORPICKER_EXPORT
# You can also make your code fail to compile if it uses 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
# 3rdParty Headers
INCLUDEPATH += $$PWD/src/plog/include
# QNtp
include($$PWD/src/qntp/qntp.pri)
# ShadowsocksR-uvw
include($$PWD/src/shadowsocksr-uvw/Shadowsocksr-uvw.pri)
# QHttpServer
include($$PWD/3rd/qhttpserver/qhttpserver.pri)
win32:CONFIG(debug, debug|release) {
LIBS += -LC:\TQLibraries\Grpc\debug\lib -lgrpc -lgrpc++ -llibprotobufd -lgpr -lzlibd -lupb -lcares -labsl_strings -labsl_base -labsl_throw_delegate -laddress_sorting
LIBS += $$PWD\3rd\yaml-cpp\Debug\yaml-cppd.lib
}
else:win32:CONFIG(release, debug|release) {
LIBS += -LC:\TQLibraries\Grpc\lib -lgrpc -lgrpc++ -llibprotobuf -lgpr -lzlib -lupb -lcares -labsl_strings -labsl_base -labsl_throw_delegate -laddress_sorting
LIBS += $$PWD\3rd\yaml-cpp\Release\yaml-cpp.lib
}
win32 {
DEFINES += _WIN32_WINNT=0x600
SOURCES += \
src/statusnotifier.cpp \
src/urlscheme/urlschemeregister.cpp \
src/theme/themehelper.cpp \
src/systemproxy/win.c
HEADERS += \
src/urlscheme/urlschemeregister.h \
src/systemproxy/win.h
RESOURCES += \
resources/windowsbin.qrc
INCLUDEPATH += C:\TQLibraries\ZBar\include
INCLUDEPATH += C:\TQLibraries\OpenSSL-Win32\include
INCLUDEPATH += C:\TQLibraries\QREncode\include
INCLUDEPATH += C:\TQLibraries\WinSparkle\include
INCLUDEPATH += C:\TQLibraries\Libsodium\include
INCLUDEPATH += C:\TQLibraries\Libuv\include
INCLUDEPATH += C:\TQLibraries\Grpc\include
INCLUDEPATH += C:\TQLibraries\Trojan-Qt5-Route\include
INCLUDEPATH += $$PWD\3rd\yaml-cpp\include
INCLUDEPATH += $$PWD\3rd\servicelib
INCLUDEPATH += $$PWD\3rd\nfsdk2
LIBS += -LC:\TQLibraries\ZBar\lib -llibzbar-0
LIBS += -LC:\TQLibraries\OpenSSL-Win32\lib -llibcrypto -llibssl
LIBS += -LC:\TQLibraries\QREncode\lib -lqrcodelib
LIBS += -LC:\TQLibraries\WinSparkle\lib -lWinSparkle
LIBS += -LC:\TQLibraries\Libsodium\lib -llibsodium
LIBS += -LC:\TQLibraries\Libuv\lib -llibuv
LIBS += -LC:\TQLibraries\Trojan-Qt5-Route\lib -lTrojan-Qt5-Route
LIBS += $$PWD\3rd\trojan-qt5-core\Trojan-Qt5-Core.lib
LIBS += $$PWD\3rd\nfsdk2\nfapi.lib
LIBS += -lwsock32 -lws2_32 -luserenv -liphlpapi
LIBS += -lCrypt32 -lkernel32 -lpsapi -luser32
LIBS += -lVersion
DEFINES += WIN32_LEAN_AND_MEAN
QMAKE_CXXFLAGS_WARN_ON -= -w34100
QMAKE_CXXFLAGS += -wd4251 -wd4996
}
mac {
HEADERS += \
src/letsmove/PFMoveApplication.h
SOURCES += \
src/statusnotifier.mm \
src/letsmove/PFMoveApplication.m \
src/theme/themehelper.mm \
src/systemproxy/mac.mm
PKG_CONFIG = /usr/local/bin/pkg-config
INCLUDEPATH += /usr/local/opt/zlib/include
INCLUDEPATH += /usr/local/opt/[email protected]/include
LIBS += -L/usr/local/opt/zlib/lib -lz
LIBS += -L/usr/local/opt/[email protected]/lib -lssl -lcrypto
LIBS += -L/usr/local/opt/grpc/lib -lupb -laddress_sorting
LIBS += -framework Security -framework Cocoa
# For Sparkle Usage
SOURCES += \
src/sparkle/AutoUpdater.cpp \
src/sparkle/CocoaInitializer.mm \
src/sparkle/SparkleAutoUpdater.mm
HEADERS += \
src/sparkle/AutoUpdater.h \
src/sparkle/CocoaInitializer.h \
src/sparkle/SparkleAutoUpdater.h
RESOURCES += \
resources/macosbin.qrc
QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../Frameworks
QMAKE_CXXFLAGS += -DOBJC_OLD_DISPATCH_PROTOTYPES=1 # Enable strict checking of objc_msgsend calls = NO
QMAKE_CXXFLAGS += -fno-objc-arc
LIBS += -framework AppKit
LIBS += -framework Carbon
LIBS += -framework Foundation
LIBS += -framework ApplicationServices
LIBS += -framework SystemConfiguration
LIBS += -framework Sparkle
LIBS += -framework LetsMove
QMAKE_INFO_PLIST = resources/Info.plist
# Otherwise lupdate will not work
TR_EXCLUDE += /usr/local/opt/boost/*
}
unix:!mac {
QT += dbus
PKGCONFIG += openssl
SOURCES += \
src/statusnotifier.cpp \
src/theme/themehelper.cpp
RESOURCES += \
resources/linuxbin.qrc
LIBS += -lz
# Otherwise lupdate will not work
TR_EXCLUDE += /usr/local/boost/*
isEmpty(PREFIX) {
PREFIX = /usr/local
}
target.path = $$PREFIX/bin
shortcutfiles.files = src/trojan-qt5.desktop
shortcutfiles.path = $$PREFIX/share/applications/
data.files += resources/icons/trojan-qt5.png
data.path = $$PREFIX/share/icons/hicolor/512x512/apps/
INSTALLS += shortcutfiles
INSTALLS += data
}
unix {
PKGCONFIG += zbar libqrencode libuv libsodium grpc grpc++ protobuf gpr yaml-cpp
LIBS += $$PWD/3rd/trojan-qt5-core/Trojan-Qt5-Core.a
}
!isEmpty(target.path): INSTALLS += target
SOURCES += \
src/dialog/aboutdialog.cpp \
src/dialog/advancemodesettingsdialog.cpp \
src/dialog/userrulesdialog.cpp \
src/dialog/settingsdialog.cpp \
src/dialog/sharedialog.cpp \
src/dialog/uriinputdialog.cpp \
src/controller/nattypetestercontroller.cpp \
src/controller/nfsdk2controller.cpp \
src/proxydialog/naiveproxyeditdialog.cpp \
src/struct/configstruct.cpp \
src/struct/trojangostruct.cpp \
src/struct/v2raystruct.cpp \
src/utils/modehelper.cpp \
src/utils/nattypehelper.cpp \
src/utils/nfsdk2helper.cpp \
src/utils/ntphelper.cpp \
src/utils/tuntaphelper.cpp \
src/utils/typehelper.cpp \
src/validator/generalvalidator.cpp \
src/validator/ip4validator.cpp \
src/validator/portvalidator.cpp \
src/speedplot/speedplotview.cpp \
src/speedplot/speedwidget.cpp \
src/speedplot/speedplot.cpp \
src/widget/routewidget.cpp \
src/widget/streamwidget.cpp \
src/proxy/snellthread.cpp \
src/proxyapi/snellgoapi.cpp \
src/urlscheme/eventfilter.cpp \
src/systemproxy/systemproxyhelper.cpp \
src/proxy/ssthread.cpp \
src/proxy/v2raythread.cpp \
src/proxy/trojanthread.cpp \
src/proxyapi/ssgoapi.cpp \
src/proxyapi/v2rayapi.cpp \
src/proxyapi/trojangoapi.cpp \
src/proxydialog/socks5editdialog.cpp \
src/proxydialog/httpeditdialog.cpp \
src/proxydialog/sseditdialog.cpp \
src/proxydialog/ssreditdialog.cpp \
src/proxydialog/vmesseditdialog.cpp \
src/proxydialog/trojaneditdialog.cpp \
src/proxydialog/snelleditdialog.cpp \
src/utils/urihelper.cpp \
src/utils/privilegeshelper.cpp \
src/utils/resourcehelper.cpp \
src/utils/routetablehelper.cpp \
src/utils/utils.cpp \
src/connectionsortfilterproxymodel.cpp \
src/logger.cpp \
src/utils/midman.cpp \
src/pac/pacserver.cpp \
src/pac/pachelper.cpp \
src/utils/addresstester.cpp \
src/confighelper.cpp \
src/connection.cpp \
src/connectionitem.cpp \
src/connectiontablemodel.cpp \
src/extension/statusbar.cpp \
src/main.cpp \
src/mainwindow.cpp \
src/qrcode/qrcodecapturer.cpp \
src/qrcode/qrwidget.cpp \
src/subscribemanager.cpp \
src/tqprofile.cpp \
src/tqsubscribe.cpp \
src/proxy/tun2socksthread.cpp \
src/subscribedialog.cpp \
src/httpproxy.cpp \
src/socketstream.cpp \
src/extension/clickablelabel.cpp \
src/extension/qtcolorpicker.cpp \
src/widget/trojangowidget.cpp \
src/dialog/modeeditdialog.cpp
HEADERS += \
src/dialog/aboutdialog.h \
src/dialog/advancemodesettingsdialog.h \
src/dialog/userrulesdialog.h \
src/dialog/settingsdialog.h \
src/dialog/sharedialog.h \
src/dialog/uriinputdialog.h \
src/controller/nattypetestercontroller.h \
src/controller/fsdk2controller.h \
src/proxydialog/naiveproxyeditdialog.h \
src/systemproxy/mac.h \
src/struct/configstruct.h \
src/struct/trojangostruct.h \
src/struct/v2raystruct.h \
src/utils/modehelper.h \
src/utils/nattypehelper.h \
src/utils/nfsdk2helper.h \
src/utils/ntphelper.h \
src/utils/tuntaphelper.h \
src/utils/typehelper.h \
src/validator/ip4validator.h \
src/validator/portvalidator.h \
src/validator/generalvalidator.h \
src/utils/resourcehelper.h \
src/utils/privilegeshelper.h \
src/utils/routetablehelper.h \
src/utils/urihelper.h \
src/utils/utils.h \
src/speedplot/speedplotview.hpp \
src/speedplot/speedwidget.hpp \
src/speedplot/speedplot.h \
src/widget/routewidget.h \
src/widget/streamwidget.h \
src/theme/themehelper.h \
src/proxy/snellthread.h \
src/proxyapi/snellgoapi.h \
src/urlscheme/eventfilter.h \
src/systemproxy/systemproxyhelper.h \
src/proxy/ssthread.h \
src/proxy/v2raythread.h \
src/proxy/trojanthread.h \
src/proxyapi/ssgoapi.h \
src/proxyapi/v2rayapi.h \
src/proxyapi/trojangoapi.h \
src/proxydialog/socks5editdialog.h \
src/proxydialog/httpeditdialog.h \
src/proxydialog/sseditdialog.h \
src/proxydialog/ssreditdialog.h \
src/proxydialog/vmesseditdialog.h \
src/proxydialog/trojaneditdialog.h \
src/proxydialog/snelleditdialog.h \
src/connectionsortfilterproxymodel.h \
src/logger.h \
src/utils/midman.h \
src/pac/pacserver.h \
src/pac/pachelper.h \
src/utils/addresstester.h \
src/confighelper.h \
src/connection.h \
src/connectionitem.h \
src/connectiontablemodel.h \
src/extension/statusbar.h \
src/mainwindow.h \
src/qrcode/qrcodecapturer.h \
src/qrcode/qrwidget.h \
src/subscribemanager.h \
src/tqprofile.h \
src/statusnotifier.h \
src/tqsubscribe.h \
src/proxy/tun2socksthread.h \
src/subscribedialog.h \
src/httpproxy.h \
src/socketstream.h \
src/extension/clickablelabel.h \
src/extension/qtcolorpicker.h \
src/widget/trojangowidget.h \
src/dialog/modeeditdialog.h
FORMS += \
ui/advancemodesettingsdialog.ui \
ui/modeeditdialog.ui \
ui/naiveproxyeditdialog.ui \
ui/httpeditdialog.ui \
ui/socks5editdialog.ui \
ui/aboutdialog.ui \
ui/routewidget.ui \
ui/settingsdialog.ui \
ui/mainwindow.ui \
ui/sharedialog.ui \
ui/speedplot.ui \
ui/sseditdialog.ui \
ui/ssreditdialog.ui \
ui/streamwidget.ui \
ui/subscribedialog.ui \
ui/trojaneditdialog.ui \
ui/trojangowidget.ui \
ui/uriinputdialog.ui \
ui/snelleditdialog.ui \
ui/userrulesdialog.ui \
ui/vmesseditdialog.ui
TRANSLATIONS += \
resources/i18n/trojan-qt5_en_US.ts \
resources/i18n/trojan-qt5_zh_CN.ts \
resources/i18n/trojan-qt5_zh_TW.ts \
resources/i18n/trojan-qt5_ja_JP.ts
PROTOS += \
$$PWD/src/proxyapi/ssgoapi.proto \
$$PWD/src/proxyapi/v2rayapi.proto \
$$PWD/src/proxyapi/trojangoapi.proto \
$$PWD/src/proxyapi/snellgoapi.proto
include($$PWD/src/protobuf.pri)
include($$PWD/src/grpc.pri)
headers.path = /usr/include
headers.CONFIG = no_check_exist
headers.files = $${PROTOBUF_HEADERS}
INCLUDEPATH += \
$$PWD/src \
$$PWD/src/controller \
$$PWD/src/dialog \
$$PWD/src/proxy \
$$PWD/src/proxyapi \
$$PWD/src/proxydialog \
$$PWD/src/systemproxy \
$$PWD/src/urlscheme \
$$PWD/src/theme \
$$PWD/src/pac \
$$PWD/src/speedplot \
$$PWD/src/widget \
$$PWD/src/utils \
$$PWD/src/validator \
$$PWD/src/extension \
$$PWD/src/qrcode \
$$PWD/src/struct \
$$PWD/3rd/trojan-qt5-core
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
RESOURCES += \
resources/conf.qrc \
resources/credits.qrc \
resources/dat.qrc \
resources/icons.qrc \
resources/linuxbin.qrc \
resources/macosbin.qrc \
resources/mode.qrc \
resources/pac.qrc \
resources/pem.qrc \
resources/qss.qrc \
resources/scripts.qrc \
resources/translations.qrc \
resources/windowsbin.qrc