forked from xiaoyifang/goldendict-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
goldendict.pro
648 lines (568 loc) · 16.3 KB
/
goldendict.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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
TEMPLATE = app
TARGET = goldendict
VERSION = 24.05.13
# Generate version file. We do this here and in a build rule described later.
# The build rule is required since qmake isn't run each time the project is
# rebuilt; and doing it here is required too since any other way the RCC
# compiler would complain if version.txt wouldn't exist (fresh checkouts).
system(git describe --tags --always --dirty): hasGit=1
!isEmpty(hasGit){
GIT_HASH=$$system(git rev-parse --short=8 HEAD )
}
!exists( version.txt ) {
message( "generate version.txt...." )
system(echo $${VERSION}.$${GIT_HASH} on $${_DATE_} > version.txt)
}
# users can suppress verbose console compile output by add `CONFIG += silent` to qmake.
CONFIG( release, debug|release ) {
DEFINES += NDEBUG
}
# DEPENDPATH += . generators
INCLUDEPATH += ./src/
INCLUDEPATH += ./src/ui # for compiled .ui files to find headers
INCLUDEPATH += ./src/common
INCLUDEPATH += ./thirdparty/tomlplusplus
INCLUDEPATH += ./thirdparty/fmt/include
QT += core \
gui \
xml \
network \
svg \
widgets \
webenginewidgets\
webchannel\
printsupport \
concurrent \
texttospeech
greaterThan(QT_MAJOR_VERSION, 5): QT += webenginecore core5compat
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00
!CONFIG( no_qtmultimedia_player ) {
QT += multimedia
DEFINES += MAKE_QTMULTIMEDIA_PLAYER
}
!CONFIG( no_ffmpeg_player ) {
# ffmpeg depended on multimedia now.
QT += multimedia
DEFINES += MAKE_FFMPEG_PLAYER
}
contains(DEFINES, MAKE_QTMULTIMEDIA_PLAYER|MAKE_FFMPEG_PLAYER) {
HEADERS += \
src/audiooutput.hh
SOURCES += \
src/audiooutput.cc
}
#xapian is the must option now.
win32{
Debug: LIBS+= -L$$PWD/winlibs/lib/dbg/ -lxapian
Release: LIBS+= -L$$PWD/winlibs/lib -lxapian
}else{
LIBS += -lxapian
}
CONFIG( use_breakpad ) {
DEFINES += USE_BREAKPAD
#the lib ,include files are copied from vcpkg install package.
LIBS += -L$$PWD/thirdparty/breakpad/lib/ -llibbreakpad -llibbreakpad_client
INCLUDEPATH += $$PWD/thirdparty/breakpad/include
DEPENDPATH += $$PWD/thirdparty/breakpad/include
CONFIG( release, debug|release ) {
# create debug symbols for release builds
CONFIG*=force_debug_info
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -O2
}
}
CONFIG( use_iconv ) {
DEFINES += USE_ICONV
unix:!mac{
#ignore
}
else {
LIBS+= -liconv
}
}
CONFIG += exceptions \
rtti \
stl \
c++17 \
lrelease \
utf8_source
mac {
CONFIG += app_bundle
}
OBJECTS_DIR = build
UI_DIR = build
MOC_DIR = build
RCC_DIR = build
LIBS += -lbz2 \
-llzo2
win32{
Debug: LIBS+= -L$$PWD/winlibs/lib/dbg/ -lzlibd
Release: LIBS+= -L$$PWD/winlibs/lib/ -lzlib
}else{
LIBS += -lz
}
win32 {
QM_FILES_INSTALL_PATH = /locale/
TARGET = GoldenDict
win32-msvc* {
# VS does not recognize 22.number.alpha,cause errors during compilation under MSVC++
VERSION = 24.05.13
DEFINES += __WIN32 _CRT_SECURE_NO_WARNINGS
contains(QMAKE_TARGET.arch, x86_64) {
DEFINES += NOMINMAX __WIN64
}
LIBS += -L$${PWD}/winlibs/lib/msvc
# silence the warning C4290: C++ exception specification ignored,C4267 size_t to const T , lost data.
QMAKE_CXXFLAGS += /wd4290 /wd4267 /Zc:__cplusplus /std:c++17 /permissive-
# QMAKE_LFLAGS_RELEASE += /OPT:REF /OPT:ICF
# QMAKE_CXXFLAGS_RELEASE += /GL # slows down the linking significantly
LIBS += -lshell32 -luser32 -lsapi -lole32
Debug: LIBS+= -L$$PWD/winlibs/lib/dbg/ -lhunspell-1.7
Release: LIBS+= -L$$PWD/winlibs/lib/ -lhunspell-1.7
}
LIBS += -lwsock32 \
-lpsapi \
-lole32 \
-loleaut32 \
-ladvapi32 \
-lcomdlg32
LIBS += -lvorbisfile \
-lvorbis \
-logg
!CONFIG( no_ffmpeg_player ) {
LIBS += -lswresample \
-lavutil \
-lavformat \
-lavcodec
}
RC_ICONS += icons/programicon.ico icons/programicon_old.ico
INCLUDEPATH += winlibs/include src/windows
# Enable console in Debug mode on Windows, with useful logging messages
Debug:CONFIG += console
Release:DEFINES += NO_CONSOLE
gcc48:QMAKE_CXXFLAGS += -Wno-unused-local-typedefs
!CONFIG( no_chinese_conversion_support ) {
CONFIG += chinese_conversion_support
}
}
!mac {
DEFINES += INCLUDE_LIBRARY_PATH
}
unix:!mac {
DEFINES += HAVE_X11
lessThan(QT_MAJOR_VERSION, 6): QT += x11extras
CONFIG += link_pkgconfig
PKGCONFIG += vorbisfile \
vorbis \
ogg \
hunspell
!CONFIG( no_ffmpeg_player ) {
PKGCONFIG += libavutil \
libavformat \
libavcodec \
libswresample \
}
!arm {
LIBS += -lX11 -lXtst
}
# Install prefix: first try to use qmake's PREFIX variable,
# then $PREFIX from system environment, and if both fails,
# use the hardcoded /usr/local.
PREFIX = $${PREFIX}
isEmpty( PREFIX ):PREFIX = $$(PREFIX)
isEmpty( PREFIX ):PREFIX = /usr/local
message(Install Prefix is: $$PREFIX)
DEFINES += PROGRAM_DATA_DIR=\\\"$$PREFIX/share/goldendict/\\\"
target.path = $$PREFIX/bin/
locale.path = $$PREFIX/share/goldendict/locale/
locale.files = locale/*.qm
INSTALLS += target \
locale
icons.path = $$PREFIX/share/pixmaps
icons.files = redist/icons/*.*
INSTALLS += icons
desktops.path = $$PREFIX/share/applications
desktops.files = redist/*.desktop
INSTALLS += desktops
metainfo.path = $$PREFIX/share/metainfo
metainfo.files = redist/*.metainfo.xml
INSTALLS += metainfo
}
freebsd {
LIBS += -lexecinfo
}
mac {
QM_FILES_INSTALL_PATH = /locale/
TARGET = GoldenDict
# Uncomment this line to make a universal binary.
# You will need to use Xcode 3 and Qt Carbon SDK
# if you want the support for PowerPC and/or Mac OS X 10.4
# CONFIG += x86 x86_64 ppc
LIBS += -lz \
-lbz2 \
-lvorbisfile \
-lvorbis \
-logg \
-llzo2
!CONFIG( no_ffmpeg_player ) {
LIBS += -lswresample \
-lavutil \
-lavformat \
-lavcodec
}
QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig
PKGCONFIG += hunspell
INCLUDEPATH += /opt/homebrew/include /usr/local/include
LIBS += -L/opt/homebrew/lib -L/usr/local/lib -framework AppKit -framework Carbon
OBJECTIVE_SOURCES += src/macos/machotkeywrapper.mm \
src/macos/macmouseover.mm
ICON = icons/macicon.icns
QMAKE_INFO_PLIST = redist/myInfo.plist
QMAKE_POST_LINK = mkdir -p GoldenDict.app/Contents/Frameworks && \
mkdir -p GoldenDict.app/Contents/MacOS/locale && \
cp -R locale/*.qm GoldenDict.app/Contents/MacOS/locale/
!CONFIG( no_chinese_conversion_support ) {
CONFIG += chinese_conversion_support
QMAKE_POST_LINK += && mkdir -p GoldenDict.app/Contents/MacOS/opencc && \
cp -R $${PWD}/opencc/*.* GoldenDict.app/Contents/MacOS/opencc/
}
}
DEFINES += PROGRAM_VERSION=\\\"$$VERSION\\\"
# Input
HEADERS += \
src/ankiconnector.hh \
src/article_maker.hh \
src/article_netmgr.hh \
src/audiolink.hh \
src/audioplayerfactory.hh \
src/audioplayerinterface.hh \
src/btreeidx.hh \
src/chunkedstorage.hh \
src/common/base_type.hh \
src/common/ex.hh \
src/common/file.hh \
src/common/filetype.hh \
src/common/folding.hh \
src/common/gddebug.hh \
src/common/globalbroadcaster.hh \
src/common/globalregex.hh \
src/common/help.hh \
src/common/htmlescape.hh \
src/common/iconv.hh \
src/common/inc_case_folding.hh \
src/common/sptr.hh \
src/common/ufile.hh \
src/common/utf8.hh \
src/common/utils.hh \
src/common/wstring.hh \
src/common/wstring_qt.hh \
src/config.hh \
src/decompress.hh \
src/delegate.hh \
src/dict/aard.hh \
src/dict/belarusiantranslit.hh \
src/dict/bgl.hh \
src/dict/bgl_babylon.hh \
src/dict/customtransliteration.hh \
src/dict/dictdfiles.hh \
src/dict/dictionary.hh \
src/dict/dictserver.hh \
src/dict/dsl.hh \
src/dict/dsl_details.hh \
src/dict/forvo.hh \
src/dict/german.hh \
src/dict/gls.hh \
src/dict/greektranslit.hh \
src/dict/hunspell.hh \
src/dict/lingualibre.hh \
src/dict/loaddictionaries.hh \
src/dict/lsa.hh \
src/dict/mdictparser.hh \
src/dict/mdx.hh \
src/dict/mediawiki.hh \
src/dict/programs.hh \
src/dict/ripemd.hh \
src/dict/romaji.hh \
src/dict/russiantranslit.hh \
src/dict/sdict.hh \
src/dict/slob.hh \
src/dict/sounddir.hh \
src/dict/sources.hh \
src/dict/stardict.hh \
src/dict/transliteration.hh \
src/dict/voiceengines.hh \
src/dict/website.hh \
src/dict/xdxf.hh \
src/dict/xdxf2html.hh \
src/dict/zim.hh \
src/dict/zipsounds.hh \
src/dictzip.hh \
src/externalaudioplayer.hh \
src/externalviewer.hh \
src/ffmpegaudio.hh \
src/ffmpegaudioplayer.hh \
src/ftshelpers.hh \
src/fulltextsearch.hh \
src/gestures.hh \
src/headwordsmodel.hh \
src/history.hh \
src/hotkeywrapper.hh \
src/iframeschemehandler.hh \
src/indexedzip.hh \
src/initializing.hh \
src/instances.hh \
src/keyboardstate.hh \
src/langcoder.hh \
src/language.hh \
src/metadata.hh \
src/multimediaaudioplayer.hh \
src/parsecmdline.hh \
src/pronounceengine.hh \
src/resourceschemehandler.hh \
src/splitfile.hh \
src/termination.hh \
src/tiff.hh \
src/ui/about.hh \
src/ui/article_inspect.hh \
src/ui/articleview.hh \
src/ui/articlewebpage.hh \
src/ui/articlewebview.hh \
src/ui/dictheadwords.hh \
src/ui/dictinfo.hh \
src/ui/dictionarybar.hh \
src/ui/dictspanewidget.hh \
src/ui/editdictionaries.hh \
src/ui/favoritespanewidget.hh \
src/ui/ftssearchpanel.hh \
src/ui/groupcombobox.hh \
src/ui/groups.hh \
src/ui/groups_widgets.hh \
src/ui/historypanewidget.hh \
src/ui/mainstatusbar.hh \
src/ui/maintabwidget.hh \
src/ui/mainwindow.hh \
src/ui/mruqmenu.hh \
src/ui/orderandprops.hh \
src/ui/preferences.hh \
src/ui/scanpopup.hh \
src/ui/searchpanel.hh \
src/ui/searchpanewidget.hh \
src/ui/stylescombobox.hh \
src/ui/translatebox.hh \
src/version.hh \
src/webmultimediadownload.hh \
src/weburlrequestinterceptor.hh \
src/wordfinder.hh \
src/zipfile.hh \
thirdparty/tomlplusplus/toml++/toml.h
FORMS += $$files(src/ui/*.ui)
SOURCES += \
src/ankiconnector.cc \
src/article_maker.cc \
src/article_netmgr.cc \
src/audiolink.cc \
src/audioplayerfactory.cc \
src/btreeidx.cc \
src/chunkedstorage.cc \
src/common/file.cc \
src/common/filetype.cc \
src/common/folding.cc \
src/common/gddebug.cc \
src/common/globalbroadcaster.cc \
src/common/globalregex.cc \
src/common/help.cc \
src/common/htmlescape.cc \
src/common/iconv.cc \
src/common/ufile.cc \
src/common/utf8.cc \
src/common/utils.cc \
src/common/wstring_qt.cc \
src/config.cc \
src/decompress.cc \
src/delegate.cc \
src/dict/aard.cc \
src/dict/belarusiantranslit.cc \
src/dict/bgl.cc \
src/dict/bgl_babylon.cc \
src/dict/customtransliteration.cc \
src/dict/dictdfiles.cc \
src/dict/dictionary.cc \
src/dict/dictserver.cc \
src/dict/dsl.cc \
src/dict/dsl_details.cc \
src/dict/forvo.cc \
src/dict/german.cc \
src/dict/gls.cc \
src/dict/greektranslit.cc \
src/dict/hunspell.cc \
src/dict/lingualibre.cc \
src/dict/loaddictionaries.cc \
src/dict/lsa.cc \
src/dict/mdictparser.cc \
src/dict/mdx.cc \
src/dict/mediawiki.cc \
src/dict/programs.cc \
src/dict/ripemd.cc \
src/dict/romaji.cc \
src/dict/russiantranslit.cc \
src/dict/sdict.cc \
src/dict/slob.cc \
src/dict/sounddir.cc \
src/dict/sources.cc \
src/dict/stardict.cc \
src/dict/transliteration.cc \
src/dict/voiceengines.cc \
src/dict/website.cc \
src/dict/xdxf.cc \
src/dict/xdxf2html.cc \
src/dict/zim.cc \
src/dict/zipsounds.cc \
src/dictzip.c \
src/externalaudioplayer.cc \
src/externalviewer.cc \
src/ffmpegaudio.cc \
src/ftshelpers.cc \
src/fulltextsearch.cc \
src/gestures.cc \
src/headwordsmodel.cc \
src/history.cc \
src/hotkeywrapper.cc \
src/iframeschemehandler.cc \
src/indexedzip.cc \
src/initializing.cc \
src/instances.cc \
src/keyboardstate.cc \
src/langcoder.cc \
src/language.cc \
src/main.cc \
src/metadata.cc \
src/multimediaaudioplayer.cc \
src/parsecmdline.cc \
src/pronounceengine.cc \
src/resourceschemehandler.cc \
src/splitfile.cc \
src/termination.cc \
src/tiff.cc \
src/ui/about.cc \
src/ui/article_inspect.cc \
src/ui/articleview.cc \
src/ui/articlewebpage.cc \
src/ui/articlewebview.cc \
src/ui/dictheadwords.cc \
src/ui/dictinfo.cc \
src/ui/dictionarybar.cc \
src/ui/editdictionaries.cc \
src/ui/favoritespanewidget.cc \
src/ui/ftssearchpanel.cc \
src/ui/groupcombobox.cc \
src/ui/groups.cc \
src/ui/groups_widgets.cc \
src/ui/historypanewidget.cc \
src/ui/mainstatusbar.cc \
src/ui/maintabwidget.cc \
src/ui/mainwindow.cc \
src/ui/mruqmenu.cc \
src/ui/orderandprops.cc \
src/ui/preferences.cc \
src/ui/scanpopup.cc \
src/ui/searchpanel.cc \
src/ui/stylescombobox.cc \
src/ui/translatebox.cc \
src/version.cc \
src/webmultimediadownload.cc \
src/weburlrequestinterceptor.cc \
src/wordfinder.cc \
src/zipfile.cc \
thirdparty/fmt/format.cc
#speech to text
SOURCES += src/speechclient.cc \
src/texttospeechsource.cc
HEADERS += src/texttospeechsource.hh \
src/speechclient.hh
CONFIG( no_tts_support ) {
DEFINES += NO_TTS_SUPPORT
}
mac {
HEADERS += src/macos/macmouseover.hh \
src/macos/gd_clipboard.hh
SOURCES += src/macos/gd_clipboard.cc
}
unix:!mac {
HEADERS += src/ui/scanflag.hh
SOURCES += src/ui/scanflag.cc
}
HEADERS += src/common/wildcard.hh
SOURCES += src/common/wildcard.cc
LIBS += -llzma
CONFIG( zim_support ) {
DEFINES += MAKE_ZIM_SUPPORT
LIBS += -lzim
}
CONFIG( no_epwing_support ) {
DEFINES += NO_EPWING_SUPPORT
}
!CONFIG( no_epwing_support ) {
HEADERS += src/dict/epwing.hh \
src/dict/epwing_book.hh \
src/dict/epwing_charmap.hh
SOURCES += src/dict/epwing.cc \
src/dict/epwing_book.cc \
src/dict/epwing_charmap.cc
if(win32){
INCLUDEPATH += thirdparty
HEADERS += $$files(thirdparty/eb/*.h)
SOURCES += $$files(thirdparty/eb/*.c)
}
else{
LIBS += -leb
}
}
CONFIG( chinese_conversion_support ) {
DEFINES += MAKE_CHINESE_CONVERSION_SUPPORT
FORMS += src/ui/chineseconversion.ui
HEADERS += src/dict/chinese.hh \
src/ui/chineseconversion.hh
SOURCES += src/dict/chinese.cc \
src/ui/chineseconversion.cc
win32{
Debug: LIBS+= -L$$PWD/winlibs/lib/dbg/ -lopencc
Release: LIBS+= -L$$PWD/winlibs/lib -lopencc
}else{
LIBS += -lopencc
}
}
RESOURCES += resources.qrc \
src/scripts/scripts.qrc \
icons/flags.qrc \
src/stylesheets/css.qrc
#EXTRA_TRANSLATIONS += thirdparty/qwebengine_ts/qtwebengine_zh_CN.ts
TRANSLATIONS += $$files(locale/*.ts)
# Build version file
!isEmpty( hasGit ) {
PRE_TARGETDEPS += $$PWD/version.txt
}
# This makes qmake generate translations
isEmpty(QMAKE_LRELEASE):QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
# The *.qm files might not exist when qmake is run for the first time,
# causing the standard install rule to be ignored, and no translations
# will be installed. With this, we create the qm files during qmake run.
!win32 {
system($${QMAKE_LRELEASE} -silent $${_PRO_FILE_} 2> /dev/null)
}
else{
system($${QMAKE_LRELEASE} -silent $${_PRO_FILE_})
}
updateqm.input = TRANSLATIONS
updateqm.output = locale/${QMAKE_FILE_BASE}.qm
updateqm.commands = $$QMAKE_LRELEASE \
${QMAKE_FILE_IN} \
-qm \
${QMAKE_FILE_OUT}
updateqm.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += updateqm
TS_OUT = $$TRANSLATIONS
TS_OUT ~= s/.ts/.qm/g
PRE_TARGETDEPS += $$TS_OUT
#QTBUG-105984
# avoid qt6.4.0-6.4.2 . the qtmultimedia module is buggy in all these versions
include( thirdparty/qtsingleapplication/src/qtsingleapplication.pri )