Always build JPEG and GIF support as plugins

Our handling of plugins when Qt is build statically is
nowadays good enough, so we don't need to build the
JPEG and GIF support directly into Qt for static builds.
Let's simply always build them as plugins.

Also simplify the logic in configure, and get rid of the
no-gif, no-jpeg and no-png config variables.

[ChangelLog][Build system] JPEG and GIF image support is now
always built as a plugin. Removed -imageformat-[jpeg|gif]
arguments to configure.

Change-Id: Ic01559ff406c966807b3be8761252e8802adcdf7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Lars Knoll 2016-04-06 10:15:14 +02:00
parent 4701af32df
commit 00ca784be6
19 changed files with 48 additions and 221 deletions

82
configure vendored
View File

@ -627,10 +627,10 @@ CFG_MTDEV=auto
CFG_JOURNALD=no
CFG_SYSLOG=no
CFG_SQLITE=qt
CFG_GIF=auto
CFG_GIF=yes
CFG_PNG=yes
CFG_LIBPNG=auto
CFG_JPEG=auto
CFG_JPEG=yes
CFG_LIBJPEG=auto
CFG_XCURSOR=runtime
CFG_XRANDR=runtime
@ -861,16 +861,6 @@ if [ -d "$relpath/src/plugins/sqldrivers" ]; then
done
fi
CFG_IMAGEFORMAT_PLUGIN_AVAILABLE=
if [ -d "$relpath/src/plugins/imageformats" ]; then
for a in "$relpath/src/plugins/imageformats/"*; do
if [ -d "$a" ]; then
base_a=`basename "$a"`
CFG_IMAGEFORMAT_PLUGIN_AVAILABLE="${CFG_IMAGEFORMAT_PLUGIN_AVAILABLE} ${base_a}"
fi
done
fi
#-------------------------------------------------------------------------------
# parse command line arguments
#-------------------------------------------------------------------------------
@ -2082,7 +2072,7 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
sql-*|imageformat-*)
sql-*)
# if Qt style options were used, $VAL can be "no", "qt", or "plugin"
# if autoconf style options were used, $VAL can be "yes" or "no"
[ "$VAL" = "yes" ] && VAL=qt
@ -2095,27 +2085,9 @@ while [ "$#" -gt 0 ]; do
VAL=`echo $VAR | sed 's,^[^-]*-\([^-]*\).*,\1,'`
VAR=`echo $VAR | sed 's,^\([^-]*\).*,\1,'`
# Grab the available values
case "$VAR" in
sql)
avail="$CFG_SQL_AVAILABLE"
;;
imageformat)
avail="$CFG_IMAGEFORMAT_PLUGIN_AVAILABLE"
if [ "$OPT" != "plugin" ]; then
# png is always built in
avail="$avail png"
fi
;;
*)
avail=""
echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
;;
esac
# Check that that user's value is available.
found=no
for d in $avail; do
for d in $CFG_SQL_AVAILABLE; do
if [ "$VAL" = "$d" ]; then
found=yes
break
@ -2127,19 +2099,8 @@ while [ "$#" -gt 0 ]; do
continue
fi
if [ "$VAR" = "sql" ]; then
# set the CFG_SQL_driver
eval "CFG_SQL_$VAL=\$OPT"
continue
elif [ "$VAR" = "imageformat" ]; then
[ "$OPT" = "qt" ] && OPT=yes
VAL="`echo $VAL |tr a-z A-Z`"
eval "CFG_$VAL=$OPT"
continue
else
echo "Internal error resolving command line arguments."
exit 1
fi
# set the CFG_SQL_driver
eval "CFG_SQL_$VAL=\$OPT"
;;
v|verbose)
if [ "$VAL" = "yes" ]; then
@ -4724,14 +4685,6 @@ if [ "$CFG_GUI" = "no" ]; then
QPA_PLATFORM_GUARD=no
fi
# detect how jpeg should be built
if [ "$CFG_JPEG" = "auto" ]; then
if [ "$CFG_SHARED" = "yes" ]; then
CFG_JPEG=plugin
else
CFG_JPEG=yes
fi
fi
# detect jpeg
if [ "$CFG_LIBJPEG" = "auto" ]; then
if compileTest unix/libjpeg "libjpeg"; then
@ -4741,15 +4694,6 @@ if [ "$CFG_LIBJPEG" = "auto" ]; then
fi
fi
# detect how gif should be built
if [ "$CFG_GIF" = "auto" ]; then
if [ "$CFG_SHARED" = "yes" ]; then
CFG_GIF=plugin
else
CFG_GIF=yes
fi
fi
# detect png
if [ "$CFG_LIBPNG" = "auto" ]; then
if compileTest unix/libpng "libpng"; then
@ -6371,9 +6315,7 @@ if [ "$CFG_LIBJPEG" = "no" ]; then
elif [ "$CFG_LIBJPEG" = "system" ]; then
QT_CONFIG="$QT_CONFIG system-jpeg"
fi
if [ "$CFG_JPEG" = "no" ]; then
QT_CONFIG="$QT_CONFIG no-jpeg"
elif [ "$CFG_JPEG" = "yes" ]; then
if [ "$CFG_JPEG" = "yes" ]; then
QT_CONFIG="$QT_CONFIG jpeg"
fi
if [ "$CFG_LIBPNG" = "no" ]; then
@ -6382,14 +6324,10 @@ fi
if [ "$CFG_LIBPNG" = "system" ]; then
QT_CONFIG="$QT_CONFIG system-png"
fi
if [ "$CFG_PNG" = "no" ]; then
QT_CONFIG="$QT_CONFIG no-png"
elif [ "$CFG_PNG" = "yes" ]; then
if [ "$CFG_PNG" = "yes" ]; then
QT_CONFIG="$QT_CONFIG png"
fi
if [ "$CFG_GIF" = "no" ]; then
QT_CONFIG="$QT_CONFIG no-gif"
elif [ "$CFG_GIF" = "yes" ]; then
if [ "$CFG_GIF" = "yes" ]; then
QT_CONFIG="$QT_CONFIG gif"
fi
if [ "$CFG_DOUBLECONVERSION" = "no" ]; then
@ -6714,7 +6652,7 @@ QMakeVar set sql-drivers "$SQL_DRIVERS"
QMakeVar set sql-plugins "$SQL_PLUGINS"
# Add other configuration options to the qconfig.h file
[ "$CFG_GIF" = "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
[ "$CFG_GIF" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_GIF"
[ "$CFG_PNG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
[ "$CFG_JPEG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
[ "$CFG_DBUS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"

View File

@ -71,11 +71,11 @@ SOURCES += \
image/qxbmhandler.cpp \
image/qxpmhandler.cpp
!contains(QT_CONFIG, no-png):include($$PWD/qpnghandler.pri)
else:DEFINES *= QT_NO_IMAGEFORMAT_PNG
contains(QT_CONFIG, jpeg):include($$PWD/qjpeghandler.pri)
contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri)
contains(QT_CONFIG, png) {
HEADERS += image/qpnghandler_p.h
SOURCES += image/qpnghandler.cpp
include($$PWD/../../3rdparty/png_dependency.pri)
}
# SIMD
SSE2_SOURCES += image/qimage_sse2.cpp

View File

@ -1,3 +0,0 @@
# common to plugin and built-in forms
HEADERS += $$PWD/qgifhandler_p.h
SOURCES += $$PWD/qgifhandler.cpp

View File

@ -155,12 +155,6 @@
#ifndef QT_NO_IMAGEFORMAT_PNG
#include <private/qpnghandler_p.h>
#endif
#ifndef QT_NO_IMAGEFORMAT_JPEG
#include <private/qjpeghandler_p.h>
#endif
#ifdef QT_BUILTIN_GIF_READER
#include <private/qgifhandler_p.h>
#endif
#include <algorithm>
@ -175,13 +169,6 @@ enum _qt_BuiltInFormatType {
#ifndef QT_NO_IMAGEFORMAT_PNG
_qt_PngFormat,
#endif
#ifndef QT_NO_IMAGEFORMAT_JPEG
_qt_JpgFormat,
_qt_JpegFormat,
#endif
#ifdef QT_BUILTIN_GIF_READER
_qt_GifFormat,
#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
_qt_BmpFormat,
#endif
@ -210,13 +197,6 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
#ifndef QT_NO_IMAGEFORMAT_PNG
{"png", "image/png"},
#endif
#ifndef QT_NO_IMAGEFORMAT_JPEG
{"jpg", "image/jpeg"},
{"jpeg", "image/jpeg"},
#endif
#ifdef QT_BUILTIN_GIF_READER
{"gif", "image/gif"},
#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
{"bmp", "image/bmp"},
#endif
@ -357,14 +337,6 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
} else if (testFormat == "png") {
handler = new QPngHandler;
#endif
#ifndef QT_NO_IMAGEFORMAT_JPEG
} else if (testFormat == "jpg" || testFormat == "jpeg") {
handler = new QJpegHandler;
#endif
#ifdef QT_BUILTIN_GIF_READER
} else if (testFormat == "gif") {
handler = new QGifHandler;
#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
} else if (testFormat == "bmp") {
handler = new QBmpHandler;
@ -442,19 +414,6 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
handler = new QPngHandler;
break;
#endif
#ifndef QT_NO_IMAGEFORMAT_JPEG
case _qt_JpgFormat:
case _qt_JpegFormat:
if (QJpegHandler::canRead(device))
handler = new QJpegHandler;
break;
#endif
#ifdef QT_BUILTIN_GIF_READER
case _qt_GifFormat:
if (QGifHandler::canRead(device))
handler = new QGifHandler;
break;
#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
case _qt_BmpFormat:
if (QBmpHandler::canRead(device))

View File

@ -115,12 +115,6 @@
#ifndef QT_NO_IMAGEFORMAT_PNG
#include <private/qpnghandler_p.h>
#endif
#ifndef QT_NO_IMAGEFORMAT_JPEG
#include <private/qjpeghandler_p.h>
#endif
#ifdef QT_BUILTIN_GIF_READER
#include <private/qgifhandler_p.h>
#endif
#include <algorithm>
@ -184,14 +178,6 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
} else if (testFormat == "png") {
handler = new QPngHandler;
#endif
#ifndef QT_NO_IMAGEFORMAT_JPEG
} else if (testFormat == "jpg" || testFormat == "jpeg") {
handler = new QJpegHandler;
#endif
#ifdef QT_BUILTIN_GIF_READER
} else if (testFormat == "gif") {
handler = new QGifHandler;
#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
} else if (testFormat == "bmp") {
handler = new QBmpHandler;
@ -910,9 +896,6 @@ QList<QByteArray> QImageWriter::supportedImageFormats()
#ifndef QT_NO_IMAGEFORMAT_PNG
formats << "png";
#endif
#ifndef QT_NO_IMAGEFORMAT_JPEG
formats << "jpg" << "jpeg";
#endif
#ifndef QT_NO_IMAGEFORMATPLUGIN
supportedImageHandlerFormats(loader(), QImageIOPlugin::CanWrite, &formats);
@ -951,9 +934,6 @@ QList<QByteArray> QImageWriter::supportedMimeTypes()
#ifndef QT_NO_IMAGEFORMAT_PNG
mimeTypes << "image/png";
#endif
#ifndef QT_NO_IMAGEFORMAT_JPEG
mimeTypes << "image/jpeg";
#endif
#ifndef QT_NO_IMAGEFORMATPLUGIN
supportedImageHandlerMimeTypes(loader(), QImageIOPlugin::CanWrite, &mimeTypes);

View File

@ -1,11 +0,0 @@
# common to plugin and built-in forms
HEADERS += $$PWD/qjpeghandler_p.h
SOURCES += $$PWD/qjpeghandler.cpp
contains(QT_CONFIG, system-jpeg) {
msvc: \
LIBS += libjpeg.lib
else: \
LIBS += -ljpeg
} else {
include($$PWD/../../3rdparty/libjpeg.pri)
}

View File

@ -1,4 +0,0 @@
HEADERS += $$PWD/qpnghandler_p.h
SOURCES += $$PWD/qpnghandler.cpp
include($$PWD/../../3rdparty/png_dependency.pri)

View File

@ -1,9 +1,8 @@
TARGET = qgif
include(../../../gui/image/qgifhandler.pri)
INCLUDEPATH += ../../../gui/image
SOURCES += $$PWD/main.cpp
HEADERS += $$PWD/main.h
SOURCES += main.cpp qgifhandler.cpp
HEADERS += main.h qgifhandler_p.h
OTHER_FILES += gif.json
PLUGIN_TYPE = imageformats

View File

@ -1,10 +1,7 @@
TARGET = qico
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-ico)"
HEADERS += qicohandler.h main.h
SOURCES += main.cpp \
qicohandler.cpp
HEADERS += main.h qicohandler.h
SOURCES += main.cpp qicohandler.cpp
OTHER_FILES += ico.json
PLUGIN_TYPE = imageformats

View File

@ -1,5 +1,5 @@
TEMPLATE = subdirs
!contains(QT_CONFIG, no-jpeg):!contains(QT_CONFIG, jpeg):SUBDIRS += jpeg
!contains(QT_CONFIG, no-gif):!contains(QT_CONFIG, gif):SUBDIRS += gif
!contains(QT_CONFIG, no-ico):SUBDIRS += ico
contains(QT_CONFIG, jpeg): SUBDIRS += jpeg
contains(QT_CONFIG, gif): SUBDIRS += gif

View File

@ -2,12 +2,18 @@ TARGET = qjpeg
QT += core-private
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-jpeg)"
SOURCES += main.cpp qjpeghandler.cpp
HEADERS += main.h qjpeghandler_p.h
contains(QT_CONFIG, system-jpeg) {
msvc: \
LIBS += libjpeg.lib
else: \
LIBS += -ljpeg
} else {
include($$PWD/../../../3rdparty/libjpeg.pri)
}
include(../../../gui/image/qjpeghandler.pri)
INCLUDEPATH += ../../../gui/image
SOURCES += main.cpp
HEADERS += main.h
OTHER_FILES += jpeg.json
PLUGIN_TYPE = imageformats

View File

@ -5,8 +5,8 @@ qtHaveModule(widgets): QT += widgets
SOURCES += tst_qmovie.cpp
MOC_DIR=tmp
!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
contains(QT_CONFIG, gif):DEFINES += QTEST_HAVE_GIF
contains(QT_CONFIG, jpeg):DEFINES += QTEST_HAVE_JPEG
RESOURCES += resources.qrc
TESTDATA += animations/*

View File

@ -3,6 +3,6 @@ TARGET = tst_bench_imageConversion
QT += testlib
SOURCES += tst_qimageconversion.cpp
!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
contains(QT_CONFIG, gif):DEFINES += QTEST_HAVE_GIF
contains(QT_CONFIG, jpeg):DEFINES += QTEST_HAVE_JPEG
contains(QT_CONFIG, c++11): CONFIG += c++11

View File

@ -5,6 +5,6 @@ TARGET = tst_bench_qimagereader
SOURCES += tst_qimagereader.cpp
!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
contains(QT_CONFIG, gif):DEFINES += QTEST_HAVE_GIF
contains(QT_CONFIG, jpeg):DEFINES += QTEST_HAVE_JPEG
QT += network

View File

@ -248,9 +248,9 @@ Configure::Configure(int& argc, char** argv) : verbose(0)
dictionary[ "ANGLE" ] = "auto";
dictionary[ "DYNAMICGL" ] = "auto";
dictionary[ "GIF" ] = "auto";
dictionary[ "JPEG" ] = "auto";
dictionary[ "PNG" ] = "auto";
dictionary[ "GIF" ] = "yes";
dictionary[ "JPEG" ] = "yes";
dictionary[ "PNG" ] = "yes";
dictionary[ "LIBJPEG" ] = "auto";
dictionary[ "LIBPNG" ] = "auto";
dictionary[ "DOUBLECONVERSION" ] = "auto";
@ -361,7 +361,6 @@ void Configure::parseCmdLine()
int argCount = configCmdLine.size();
int i = 0;
const QStringList imageFormats = QStringList() << "gif" << "png" << "jpeg";
if (argCount < 1) // skip rest if no arguments
;
@ -745,17 +744,6 @@ void Configure::parseCmdLine()
else if (configCmdLine.at(i) == "-no-sql-ibase")
dictionary[ "SQL_IBASE" ] = "no";
// Image formats --------------------------------------------
else if (configCmdLine.at(i).startsWith("-qt-imageformat-") &&
imageFormats.contains(configCmdLine.at(i).section('-', 3)))
dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "yes";
else if (configCmdLine.at(i).startsWith("-plugin-imageformat-") &&
imageFormats.contains(configCmdLine.at(i).section('-', 3)))
dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "plugin";
else if (configCmdLine.at(i).startsWith("-no-imageformat-") &&
imageFormats.contains(configCmdLine.at(i).section('-', 3)))
dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "no";
else if (configCmdLine.at(i) == "-no-incredibuild-xge")
dictionary[ "INCREDIBUILD_XGE" ] = "no";
else if (configCmdLine.at(i) == "-incredibuild-xge")
@ -1586,8 +1574,6 @@ void Configure::applySpecSpecifics()
if (dictionary.value("XQMAKESPEC").startsWith("winphone") || dictionary.value("XQMAKESPEC").startsWith("winrt")) {
dictionary[ "STYLE_WINDOWSXP" ] = "no";
dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
dictionary[ "GIF" ] = "qt";
dictionary[ "JPEG" ] = "qt";
dictionary[ "LIBJPEG" ] = "qt";
dictionary[ "LIBPNG" ] = "qt";
dictionary[ "FREETYPE" ] = "yes";
@ -2001,10 +1987,6 @@ QString Configure::defaultTo(const QString &option)
|| option == "LIBPNG")
return "system";
// PNG is always built-in, never a plugin
if (option == "PNG")
return "yes";
// These database drivers and image formats can be built-in or plugins.
// Prefer plugins when Qt is shared.
if (dictionary[ "SHARED" ] == "yes") {
@ -2017,9 +1999,7 @@ QString Configure::defaultTo(const QString &option)
|| option == "SQL_DB2"
|| option == "SQL_SQLITE"
|| option == "SQL_SQLITE2"
|| option == "SQL_IBASE"
|| option == "JPEG"
|| option == "GIF")
|| option == "SQL_IBASE")
return "plugin";
}
@ -2309,12 +2289,6 @@ void Configure::autoDetection()
dictionary["DYNAMICGL"] = "no";
// Image format detection
if (dictionary["GIF"] == "auto")
dictionary["GIF"] = defaultTo("GIF");
if (dictionary["JPEG"] == "auto")
dictionary["JPEG"] = defaultTo("JPEG");
if (dictionary["PNG"] == "auto")
dictionary["PNG"] = defaultTo("PNG");
if (dictionary["LIBJPEG"] == "auto")
dictionary["LIBJPEG"] = checkAvailability("LIBJPEG") ? defaultTo("LIBJPEG") : "qt";
if (dictionary["LIBPNG"] == "auto")
@ -2666,21 +2640,15 @@ void Configure::generateOutputVars()
}
// Image formates -----------------------------------------------
if (dictionary[ "GIF" ] == "no")
qtConfig += "no-gif";
else if (dictionary[ "GIF" ] == "yes")
if (dictionary[ "GIF" ] == "yes")
qtConfig += "gif";
if (dictionary[ "JPEG" ] == "no")
qtConfig += "no-jpeg";
else if (dictionary[ "JPEG" ] == "yes")
if (dictionary[ "JPEG" ] == "yes")
qtConfig += "jpeg";
if (dictionary[ "LIBJPEG" ] == "system")
qtConfig += "system-jpeg";
if (dictionary[ "PNG" ] == "no")
qtConfig += "no-png";
else if (dictionary[ "PNG" ] == "yes")
if (dictionary[ "PNG" ] == "yes")
qtConfig += "png";
if (dictionary[ "LIBPNG" ] == "system")
qtConfig += "system-png";
@ -3560,9 +3528,7 @@ void Configure::generateConfigfiles()
qconfigList += "QT_NO_STYLE_WINDOWSXP";
if (dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1";
if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG";
if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY";
if (dictionary["WIDGETS"] == "no") qconfigList += "QT_NO_WIDGETS";
@ -3745,8 +3711,8 @@ void Configure::displayConfig()
sout << "Third Party Libraries:" << endl;
sout << " ZLIB support............" << (dictionary[ "SYSTEM_ZLIB" ] == QLatin1String("yes") ? QLatin1String("system") : QLatin1String("qt")) << endl;
sout << " GIF support............." << dictionary[ "GIF" ] << endl;
sout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
sout << " PNG support............." << dictionary[ "PNG" ] << endl;
sout << " JPEG support............" << dictionary[ "JPEG" ] << " (" << dictionary[ "LIBJPEG" ] << ")" << endl;
sout << " PNG support............." << dictionary[ "PNG" ] << " (" << dictionary[ "LIBPNG" ] << ")" << endl;
sout << " DoubleConversion........" << dictionary[ "DOUBLECONVERSION" ] << endl;
sout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl;
sout << " Fontconfig support......" << dictionary[ "FONT_CONFIG" ] << endl;