From ff1b143e6aee213d62c840b3635758c4620f9d79 Mon Sep 17 00:00:00 2001 From: Ondrej Mosnacek Date: Mon, 26 Jul 2021 11:24:22 +0200 Subject: [PATCH] Allow linking against system quazip library When 'system_quazip' is added to CONFIG, chessx will now (dynamically) link against the quazip library installed on the system, rather than using the bundled version. Default behavior remains unchanged. Signed-off-by: Ondrej Mosnacek --- chessx.pro | 75 ++++++++++++++++++++++++------------------ src/gui/mainwindow.cpp | 10 ++++-- 2 files changed, 51 insertions(+), 34 deletions(-) diff --git a/chessx.pro b/chessx.pro index 68167bdda..563dcf23c 100644 --- a/chessx.pro +++ b/chessx.pro @@ -36,7 +36,6 @@ sound { QT += multimedia } -DEFINES += QUAZIP_STATIC DEFINES += QT_NO_CAST_TO_ASCII DEFINES *= QT_USE_QSTRINGBUILDER @@ -79,6 +78,47 @@ unix|!macx { binfiles.path = $$BINDIR } +system_quazip { + unix|win32: LIBS += -lquazip5 + else: error("Cannot use system_quazip on this platform!") +} +else { + HEADERS += \ + src/quazip/JlCompress.h \ + src/quazip/crypt.h \ + src/quazip/ioapi.h \ + src/quazip/quaadler32.h \ + src/quazip/quachecksum32.h \ + src/quazip/quacrc32.h \ + src/quazip/quagzipfile.h \ + src/quazip/quaziodevice.h \ + src/quazip/quazip.h \ + src/quazip/quazip_global.h \ + src/quazip/quazipdir.h \ + src/quazip/quazipfile.h \ + src/quazip/quazipfileinfo.h \ + src/quazip/quazipnewinfo.h \ + src/quazip/unzip.h \ + src/quazip/zip.h + + SOURCES += \ + src/quazip/JlCompress.cpp \ + src/quazip/qioapi.cpp \ + src/quazip/quaadler32.cpp \ + src/quazip/quacrc32.cpp \ + src/quazip/quagzipfile.cpp \ + src/quazip/quaziodevice.cpp \ + src/quazip/quazip.cpp \ + src/quazip/quazipdir.cpp \ + src/quazip/quazipfile.cpp \ + src/quazip/quazipnewinfo.cpp \ + src/quazip/unzip.cpp \ + src/quazip/zip.cpp + + INCLUDEPATH += src/quazip + DEFINES += QUAZIP_STATIC +} + scid { # Scid sources HEADERS += \ @@ -325,23 +365,7 @@ HEADERS += src/database/board.h \ src/gui/textbrowserex.h \ src/gui/textedit.h \ src/gui/toolmainwindow.h \ - src/gui/translatingslider.h \ - src/quazip/JlCompress.h \ - src/quazip/crypt.h \ - src/quazip/ioapi.h \ - src/quazip/quaadler32.h \ - src/quazip/quachecksum32.h \ - src/quazip/quacrc32.h \ - src/quazip/quagzipfile.h \ - src/quazip/quaziodevice.h \ - src/quazip/quazip.h \ - src/quazip/quazip_global.h \ - src/quazip/quazipdir.h \ - src/quazip/quazipfile.h \ - src/quazip/quazipfileinfo.h \ - src/quazip/quazipnewinfo.h \ - src/quazip/unzip.h \ - src/quazip/zip.h + src/gui/translatingslider.h SOURCES += \ src/database/analysis.cpp \ @@ -490,26 +514,13 @@ SOURCES += \ src/gui/testadapter.cpp \ src/gui/textedit.cpp \ src/gui/toolmainwindow.cpp \ - src/gui/translatingslider.cpp \ - src/quazip/JlCompress.cpp \ - src/quazip/qioapi.cpp \ - src/quazip/quaadler32.cpp \ - src/quazip/quacrc32.cpp \ - src/quazip/quagzipfile.cpp \ - src/quazip/quaziodevice.cpp \ - src/quazip/quazip.cpp \ - src/quazip/quazipdir.cpp \ - src/quazip/quazipfile.cpp \ - src/quazip/quazipnewinfo.cpp \ - src/quazip/unzip.cpp \ - src/quazip/zip.cpp + src/gui/translatingslider.cpp TEMPLATE = app INCLUDEPATH += src/database INCLUDEPATH += src/guess INCLUDEPATH += src/gui INCLUDEPATH += src/dialogs -INCLUDEPATH += src/quazip INCLUDEPATH += $$[QT_INSTALL_PREFIX]/src/3rdparty/zlib win32 { diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 6ee478de3..8e6a1b57a 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -48,8 +48,6 @@ #include "output.h" #include "pgndatabase.h" #include "playerlistwidget.h" -#include "quazip.h" -#include "quazipfile.h" #include "savedialog.h" #include "settings.h" #include "style.h" @@ -60,6 +58,14 @@ #include "translatingslider.h" #include "version.h" +#ifdef QUAZIP_STATIC +#include "quazip.h" +#include "quazipfile.h" +#else +#include +#include +#endif + #include #include