Automatically link printsupport plugins to static applications.

Add the required printsupport plugins to the QTPLUGIN variable
as is done for the QPA plugin.

[ChangeLog][QtPrintSupport] Made the Qt buildsystem automatically include the
necessary plugins so that static applications can print.

Task-number: QTBUG-29663
Change-Id: I0e2e3b0f25dd5714bd187711c85893926b0c4e85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Friedemann Kleint 2014-02-04 13:56:45 +01:00 committed by The Qt Project
parent 9e6bb60131
commit 99eecab83d
5 changed files with 28 additions and 3 deletions

13
configure vendored
View File

@ -780,6 +780,8 @@ QT_LIBS_GLIB=
# default qpa platform
QT_QPA_DEFAULT_PLATFORM=
# default print support plugin
QT_PRINTSUPPORT_DEFAULT_PLUGIN=
# Android vars
CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
@ -5427,6 +5429,15 @@ if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
fi
fi
# Determine print support plugin belonging to the default QPA platform
if [ "$QT_QPA_DEFAULT_PLATFORM" = "cocoa" ]; then
QT_PRINTSUPPORT_DEFAULT_PLUGIN=cocoaprintersupport
elif [ "$QT_QPA_DEFAULT_PLATFORM" = "windows" ]; then
QT_PRINTSUPPORT_DEFAULT_PLUGIN=windowsprintersupport
elif [ "$QT_QPA_DEFAULT_PLATFORM" = "xcb" ]; then
QT_PRINTSUPPORT_DEFAULT_PLUGIN=cupsprintersupport
fi
if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
@ -6412,6 +6423,7 @@ EOF
fi
echo "#define QT_QPA_DEFAULT_PLATFORM_NAME \"$QT_QPA_DEFAULT_PLATFORM\"" >>"$outpath/src/corelib/global/qconfig.h.new"
echo "#define QT_QPA_DEFAULT_PRINTSUPPORTPLUGIN_NAME \"QT_PRINTSUPPORT_DEFAULT_PLUGIN\"" >>"$outpath/src/corelib/global/qconfig.h.new"
# avoid unecessary rebuilds by copying only if qconfig.h has changed
if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
@ -6499,6 +6511,7 @@ EOF
if [ "$CFG_SHARED" = "no" ]; then
echo "QT_DEFAULT_QPA_PLUGIN = q$QT_QPA_DEFAULT_PLATFORM" >> "$QTCONFIG.tmp"
echo "QT_DEFAULT_PRINTSUPPORTPLUGIN = $QT_PRINTSUPPORT_DEFAULT_PLUGIN" >> "$QTCONFIG.tmp"
echo >> "$QTCONFIG.tmp"
fi

View File

@ -172,6 +172,8 @@ contains(QT_CONFIG, static) {
else: \
QTPLUGIN += $$QT_DEFAULT_QPA_PLUGIN
}
needs_printsupport_plugin: \
QTPLUGIN += $$QT_DEFAULT_PRINTSUPPORTPLUGIN
import_plugins:!isEmpty(QTPLUGIN) {
IMPORT_FILE_CONT = \
"// This file is autogenerated by qmake. It imports static plugin classes for" \

View File

@ -1,6 +1,7 @@
TARGET = QtPrintSupport
QT = core-private gui-private widgets-private
MODULE_CONFIG = needs_printsupport_plugin
DEFINES += QT_NO_USING_NAMESPACE
QMAKE_DOCS = $$PWD/doc/qtprintsupport.qdocconf

View File

@ -3291,8 +3291,10 @@ void Configure::generateQConfigPri()
if (!dictionary["QT_NAMESPACE"].isEmpty())
configStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl;
if (dictionary[ "SHARED" ] == "no")
configStream << "QT_DEFAULT_QPA_PLUGIN = q" << qpaPlatformName() << endl;
if (dictionary[ "SHARED" ] == "no") {
configStream << "QT_DEFAULT_QPA_PLUGIN = q" << qpaPlatformName() << endl
<< "QT_DEFAULT_PRINTSUPPORTPLUGIN = " << qpaPrintSupportPluginName() << endl;
}
if (!configStream.flush())
dictionary[ "DONE" ] = "error";
@ -3474,7 +3476,8 @@ void Configure::generateConfigfiles()
for (int i = 0; i < qconfigList.count(); ++i)
tmpStream << addDefine(qconfigList.at(i));
tmpStream<<"#define QT_QPA_DEFAULT_PLATFORM_NAME \"" << qpaPlatformName() << "\""<<endl;
tmpStream << "#define QT_QPA_DEFAULT_PLATFORM_NAME \"" << qpaPlatformName() << "\"" << endl
<< "#define QT_QPA_DEFAULT_PRINTSUPPORTPLUGIN_NAME \"" << qpaPrintSupportPluginName() << "\"" << endl;
if (!tmpStream.flush())
dictionary[ "DONE" ] = "error";
@ -4405,6 +4408,11 @@ QString Configure::qpaPlatformName() const
}
}
QString Configure::qpaPrintSupportPluginName() const
{
return platform() == WINDOWS ? QStringLiteral("windowsprintersupport") : QString();
}
int Configure::platform() const
{
const QString qMakeSpec = dictionary.value("QMAKESPEC");

View File

@ -100,6 +100,7 @@ public:
int platform() const;
QString platformName() const;
QString qpaPlatformName() const;
QString qpaPrintSupportPluginName() const;
private:
bool checkAngleAvailability(QString *errorMessage = 0) const;