Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
fix shared/static linkage detection and text codec auto-import for Qt4
Browse files Browse the repository at this point in the history
The earlier approach was very convoluted and did not work for a static
Qt5 build.
  • Loading branch information
ashkulz committed Jan 3, 2015
1 parent a364164 commit 10d50bf
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 23 deletions.
22 changes: 3 additions & 19 deletions common.pri
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with wkhtmltopdf. If not, see <http:#www.gnu.org/licenses/>.

QT4_PRL = libQtGui.prl QtGui.prl QtGui.framework/QtGui.prl
QT5_PRL = libQt5Gui.prl Qt5Gui.prl

for(prl, QT4_PRL):exists($$[QT_INSTALL_LIBS]/$${prl}) {
include($$[QT_INSTALL_LIBS]/$${prl})
CONFIG += qt_gui_prl_found
}
for(prl, QT5_PRL):exists($$[QT_INSTALL_LIBS]/$${prl}) {
include($$[QT_INSTALL_LIBS]/$${prl})
CONFIG += qt_gui_prl_found
CONFIG(static, shared|static):lessThan(QT_MAJOR_VERSION, 5) {
DEFINES += QT4_STATICPLUGIN_TEXTCODECS
QTPLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
}

qt_gui_prl_found {
contains(QMAKE_PRL_CONFIG, static): DEFINES += QT_STATIC
else: DEFINES += QT_SHARED
}
contains(QMAKE_PRL_CONFIG, static): QTPLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs

# if we can't determine, assume that it is shared
!qt_gui_prl_found: DEFINES += QT_SHARED

INCLUDEPATH += ../../include
RESOURCES = $$PWD/wkhtmltopdf.qrc

Expand Down
2 changes: 1 addition & 1 deletion src/image/image.pro
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ target.path=$$INSTALLBASE/bin

include(../shared/shared.pri)

contains(DEFINES, QT_SHARED) {
CONFIG(shared, shared|static) {
LIBS += -L../../bin -lwkhtmltox
} else {
include(../lib/lib.pri)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <QWebFrame>
#include <qapplication.h>

#ifdef QT_STATIC
#ifdef QT4_STATICPLUGIN_TEXTCODECS
#include <QtPlugin>
Q_IMPORT_PLUGIN(qcncodecs)
Q_IMPORT_PLUGIN(qjpcodecs)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/lib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ include(../../common.pri)
include(lib.pri)

DEF_FILE = lib.def
contains(QMAKE_PRL_CONFIG, static): DEFINES += QT_NODLL
CONFIG(static, shared|static): DEFINES += QT_NODLL

unix {
headers.target=headers
Expand Down
2 changes: 1 addition & 1 deletion src/pdf/pdf.pro
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ target.path=$$INSTALLBASE/bin

include(../shared/shared.pri)

contains(DEFINES, QT_SHARED) {
CONFIG(shared, shared|static) {
LIBS += -L../../bin -lwkhtmltox
} else {
include(../lib/lib.pri)
Expand Down

0 comments on commit 10d50bf

Please sign in to comment.