goldendict-ng/goldendict.pro

646 lines
16 KiB
Prolog
Raw Normal View History

TEMPLATE = app
TARGET = goldendict
2023-05-31 12:44:48 +00:00
VERSION = 23.06.01-ChildrenDay
# 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).
2022-02-07 14:18:51 +00:00
system(git describe --tags --always --dirty): hasGit=1
2022-02-07 14:18:51 +00:00
!isEmpty(hasGit){
GIT_HASH=$$system(git rev-parse --short=8 HEAD )
}
2022-05-31 12:11:04 +00:00
!exists( version.txt ) {
message( "generate version.txt...." )
system(echo $${VERSION}.$${GIT_HASH} on $${_DATE_} > version.txt)
}
!CONFIG( verbose_build_output ) {
!win32|*-msvc* {
# Reduce build log verbosity except for MinGW builds (mingw-make cannot
# execute "@echo ..." commands inserted by qmake).
CONFIG += silent
}
}
CONFIG( release, debug|release ) {
DEFINES += NDEBUG
}
2022-06-01 15:23:41 +00:00
# DEPENDPATH += . generators
INCLUDEPATH += ./src/
INCLUDEPATH += ./src/ui # for compiled .ui files to find headers
INCLUDEPATH += ./src/common
2023-04-29 06:59:19 +00:00
INCLUDEPATH += ./thirdparty/tomlplusplus
2023-05-19 23:55:56 +00:00
INCLUDEPATH += ./thirdparty/fmt/include
QT += core \
gui \
xml \
network \
2022-02-27 05:17:37 +00:00
svg \
widgets \
webenginewidgets\
webchannel\
printsupport \
concurrent \
texttospeech
2022-02-27 14:42:40 +00:00
greaterThan(QT_MAJOR_VERSION, 5): QT += webenginecore core5compat
2022-02-27 05:17:37 +00:00
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00
2021-12-26 11:01:05 +00:00
!CONFIG( no_qtmultimedia_player ) {
QT += multimedia
DEFINES += MAKE_QTMULTIMEDIA_PLAYER
}
!CONFIG( no_ffmpeg_player ) {
2022-11-12 09:03:20 +00:00
# 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/xapian/dbg/ -lxapian
Release: LIBS+= -L$$PWD/winlibs/lib/xapian/rel/ -lxapian
}else{
LIBS += -lxapian
}
2023-05-01 08:01:48 +00:00
CONFIG( use_breakpad ) {
DEFINES += USE_BREAKPAD
win32: LIBS += -L$$PWD/thirdparty/breakpad/lib/ -llibbreakpad -llibbreakpad_client
else:unix: LIBS += -L$$PWD/thirdparty/breakpad/lib/ -llibbreakpa
2023-04-02 15:54:09 +00:00
2023-05-01 08:01:48 +00:00
INCLUDEPATH += $$PWD/thirdparty/breakpad/include
DEPENDPATH += $$PWD/thirdparty/breakpad/include
2023-04-02 15:54:09 +00:00
2023-05-01 08:01:48 +00:00
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
2023-02-01 16:04:04 +00:00
unix:!mac{
#ignore
}
else {
LIBS+= -liconv
}
}
CONFIG += exceptions \
rtti \
2022-03-12 16:55:35 +00:00
stl \
2022-05-22 08:25:03 +00:00
c++17 \
lrelease \
utf8_source
mac {
2022-09-21 15:40:06 +00:00
CONFIG += app_bundle
}
2022-09-21 15:40:06 +00:00
OBJECTS_DIR = build
UI_DIR = build
MOC_DIR = build
2022-09-21 15:40:06 +00:00
RCC_DIR = build
LIBS += -lbz2 \
-llzo2
win32{
Debug: LIBS+= -lzlibd
Release: LIBS+= -lzlib
}else{
LIBS += -lz
}
win32 {
QM_FILES_INSTALL_PATH = /locale/
TARGET = GoldenDict
win32-msvc* {
2022-08-22 12:38:14 +00:00
# VS does not recognize 22.number.alpha,cause errors during compilation under MSVC++
2023-05-31 12:44:48 +00:00
VERSION = 23.06.01
DEFINES += __WIN32 _CRT_SECURE_NO_WARNINGS
2013-08-11 07:30:43 +00:00
contains(QMAKE_TARGET.arch, x86_64) {
DEFINES += NOMINMAX __WIN64
}
LIBS += -L$${PWD}/winlibs/lib/msvc
2023-05-10 23:13:10 +00:00
# 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-
2022-04-23 11:41:45 +00:00
# QMAKE_LFLAGS_RELEASE += /OPT:REF /OPT:ICF
2022-05-29 23:57:00 +00:00
2013-08-11 07:30:43 +00:00
# QMAKE_CXXFLAGS_RELEASE += /GL # slows down the linking significantly
LIBS += -lshell32 -luser32 -lsapi -lole32
Debug: LIBS+= -lhunspelld
Release: LIBS+= -lhunspell
2013-08-11 07:30:43 +00:00
HUNSPELL_LIB = hunspell
}
2022-02-26 00:56:46 +00:00
LIBS += -lwsock32 \
-lpsapi \
-lole32 \
-loleaut32 \
-ladvapi32 \
-lcomdlg32
LIBS += -lvorbisfile \
-lvorbis \
-logg
!CONFIG( no_ffmpeg_player ) {
LIBS += -lswresample \
2022-02-02 06:32:03 +00:00
-lavutil \
-lavformat \
-lavcodec
}
RC_ICONS += icons/programicon.ico icons/programicon_old.ico
INCLUDEPATH += winlibs/include
# 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 {
2022-09-09 06:46:48 +00:00
DEFINES += INCLUDE_LIBRARY_PATH
}
unix:!mac {
2022-03-13 03:58:45 +00:00
DEFINES += HAVE_X11
2022-03-13 03:58:45 +00:00
lessThan(QT_MAJOR_VERSION, 6): QT += x11extras
CONFIG += link_pkgconfig
2022-03-13 03:58:45 +00:00
PKGCONFIG += vorbisfile \
2015-10-11 14:58:31 +00:00
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
2009-11-10 18:52:50 +00:00
icons.path = $$PREFIX/share/pixmaps
icons.files = redist/icons/*.*
INSTALLS += icons
2009-11-10 18:52:50 +00:00
desktops.path = $$PREFIX/share/applications
desktops.files = redist/*.desktop
INSTALLS += desktops
metainfo.path = $$PREFIX/share/metainfo
metainfo.files = redist/*.metainfo.xml
INSTALLS += metainfo
}
2019-04-01 21:48:46 +00:00
freebsd {
2022-02-26 00:56:46 +00:00
LIBS += -lexecinfo
2019-04-01 21:48:46 +00:00
}
mac {
2022-11-21 05:50:15 +00:00
QM_FILES_INSTALL_PATH = /locale/
TARGET = GoldenDict
2011-09-24 00:12:34 +00:00
# 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
2022-03-12 12:16:01 +00:00
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
2023-04-18 00:00:36 +00:00
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/
2016-04-21 14:50:56 +00:00
!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/
2016-04-21 14:50:56 +00:00
}
}
DEFINES += PROGRAM_VERSION=\\\"$$VERSION\\\"
# Input
HEADERS += \
src/ankiconnector.hh \
src/article_maker.hh \
src/article_netmgr.hh \
src/common/atomic_rename.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/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/common/folding.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/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/webmultimediadownload.hh \
src/weburlrequestinterceptor.hh \
src/wordfinder.hh \
src/wordlist.hh \
src/zipfile.hh \
thirdparty/tomlplusplus/toml++/toml.h
FORMS += $$files(src/ui/*.ui)
2015-01-22 15:17:05 +00:00
SOURCES += \
src/ankiconnector.cc \
src/article_maker.cc \
src/article_netmgr.cc \
src/common/atomic_rename.cc \
src/audiolink.cc \
src/audioplayerfactory.cc \
src/btreeidx.cc \
src/chunkedstorage.cc \
src/common/file.cc \
src/common/filetype.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/common/folding.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/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/webmultimediadownload.cc \
src/weburlrequestinterceptor.cc \
src/wordfinder.cc \
src/wordlist.cc \
2023-05-19 23:55:56 +00:00
src/zipfile.cc \
thirdparty/fmt/format.cc
#speech to text
SOURCES += src/speechclient.cc \
src/texttospeechsource.cc
HEADERS += src/texttospeechsource.hh \
src/speechclient.hh
mac {
2023-04-18 00:00:36 +00:00
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
CONFIG( zim_support ) {
DEFINES += MAKE_ZIM_SUPPORT
feat!: add libzim dependency (#725) * feat!: add libzim dependency * 🎨 apply clang-format changes * action: add libzim dependency to action * feat!: change dependency folder * action: add zim support * feat!: add libzim support * action: fix sonarcloud check * doc: add libzim readme * action: cmake build * action: cmake check * fix: code smell * action: cmake check * action: cmake on Macos * action: cmake on Macos * feat: use libzim to read title and description * 🎨 apply clang-format changes * feat: split zim file support * feat: loadArticle refactor * 🎨 apply clang-format changes * 🎨 apply clang-format changes * feat: update library and goldendict.pro * 🎨 apply clang-format changes * fix:word count * 🎨 apply clang-format changes * fix: video src url subsititue * 🎨 apply clang-format changes * zim: headword is not usually a valid it is from title and url. * fix: remove nested try catch * zim: fix resource loading issue. * 🎨 apply clang-format changes * action: remove libao * zim: process url some old zim dictionary url does not contain namespace such as /C/url make the old and new zim dictionary's url consistent without the leading ../C/ etc. * 🎨 apply clang-format changes * zim: process url remove leading dot and slash such as ../-/assets ,remove ../ * 🎨 apply clang-format changes * zim: remove resourceIndex creation use libzim to read the resource directly. * zim: only iterate all the articles * 🎨 apply clang-format changes * fix: code smell * 🎨 apply clang-format changes * zim: refactor method to convert url to wstring * 🎨 apply clang-format changes * fix:code smell * 🎨 apply clang-format changes * zim: update windows dependencies * zim: add mutex lock * 🎨 apply clang-format changes * fix: code smell * 🎨 apply clang-format changes --------- Co-authored-by: xiaoyifang <xiaoyifang@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-27 04:12:16 +00:00
LIBS += -llzma -lzstd -lzim
win32{
Debug: LIBS+= -L$$PWD/winlibs/lib/dbg/
Release: LIBS+= -L$$PWD/winlibs/lib/
}
}
2014-05-20 13:59:56 +00:00
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
2023-05-11 02:48:25 +00:00
if(win32){
INCLUDEPATH += thirdparty
HEADERS += $$files(thirdparty/eb/*.h)
SOURCES += $$files(thirdparty/eb/*.c)
}
else{
LIBS += -leb
}
2014-05-20 13:59:56 +00:00
}
CONFIG( chinese_conversion_support ) {
DEFINES += MAKE_CHINESE_CONVERSION_SUPPORT
2023-04-17 22:18:28 +00:00
FORMS += src/ui/chineseconversion.ui
HEADERS += src/dict/chinese.hh \
src/ui/chineseconversion.hh
2023-04-17 22:18:28 +00:00
SOURCES += src/dict/chinese.cc \
src/ui/chineseconversion.cc
LIBS += -lopencc
}
RESOURCES += resources.qrc \
src/scripts/scripts.qrc \
2023-04-18 00:44:50 +00:00
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 ) {
2012-12-03 19:11:33 +00:00
PRE_TARGETDEPS += $$PWD/version.txt
}
2022-09-21 15:40:06 +00:00
# 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_})
}
2022-09-21 15:40:06 +00:00
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
2022-10-22 06:45:50 +00:00
2022-02-18 12:50:15 +00:00
include( thirdparty/qtsingleapplication/src/qtsingleapplication.pri )