Skip to content

Commit

Permalink
Allow linking against system quazip library
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
WOnder93 committed Jul 26, 2021
1 parent 6f9eb04 commit ff1b143
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 34 deletions.
75 changes: 43 additions & 32 deletions chessx.pro
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ sound {
QT += multimedia
}

DEFINES += QUAZIP_STATIC
DEFINES += QT_NO_CAST_TO_ASCII
DEFINES *= QT_USE_QSTRINGBUILDER

Expand Down Expand Up @@ -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 += \
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 8 additions & 2 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -60,6 +58,14 @@
#include "translatingslider.h"
#include "version.h"

#ifdef QUAZIP_STATIC
#include "quazip.h"
#include "quazipfile.h"
#else
#include <quazip5/quazip.h>
#include <quazip5/quazipfile.h>
#endif

#include <time.h>

#include <QApplication>
Expand Down

0 comments on commit ff1b143

Please sign in to comment.