diff --git a/config.tests/jasper/jasper.cpp b/config.tests/jasper/jasper.cpp deleted file mode 100644 index f038139c62a2f457630e6b442ed709f1e04f0826..0000000000000000000000000000000000000000 --- a/config.tests/jasper/jasper.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Petroules Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests in the Qt ImageFormats module. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <string.h> -#include <jasper/jasper.h> - -int main(int, char **) -{ - // This version of Jasper is broken, according to the old Qt Solutions docs - if (strcmp(JAS_VERSION, "1.900.0") == 0) - return 1; - - return 0; -} diff --git a/config.tests/jasper/jasper.pro b/config.tests/jasper/jasper.pro deleted file mode 100644 index 77d368953655e7e96564141b2b2131db4efcf7db..0000000000000000000000000000000000000000 --- a/config.tests/jasper/jasper.pro +++ /dev/null @@ -1,6 +0,0 @@ -SOURCES = jasper.cpp -CONFIG -= qt dylib -mac:CONFIG -= app_bundle -win32:CONFIG += console -msvc: LIBS += libjasper.lib -else: LIBS += -ljasper diff --git a/config.tests/libmng/libmng.cpp b/config.tests/libmng/libmng.cpp deleted file mode 100644 index 65dd7a1dd8d12d203d1b2ad98b50ad05ac3b29ca..0000000000000000000000000000000000000000 --- a/config.tests/libmng/libmng.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests in the Qt ImageFormats module. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <stdio.h> -#include <libmng.h> - -int main(int, char **) -{ - mng_handle hMNG; - mng_cleanup(&hMNG); - -#if defined(MNG_VERSION_MAJOR) -#if MNG_VERSION_MAJOR < 1 || (MNG_VERSION_MAJOR == 1 && MNG_VERSION_MINOR == 0 && MNG_VERSION_RELEASE < 9) -#error System libmng version is less than 1.0.9. -#endif -#endif - - return 0; -} diff --git a/config.tests/libmng/libmng.pro b/config.tests/libmng/libmng.pro deleted file mode 100644 index adc096e1a923d9954d9ea33e50c19ad2cc205eec..0000000000000000000000000000000000000000 --- a/config.tests/libmng/libmng.pro +++ /dev/null @@ -1,6 +0,0 @@ -SOURCES = libmng.cpp -CONFIG -= qt dylib -mac:CONFIG -= app_bundle -win32:CONFIG += console -unix|mingw: LIBS += -lmng -else:win32: LIBS += libmng.lib diff --git a/config.tests/libtiff/libtiff.cpp b/config.tests/libtiff/libtiff.cpp deleted file mode 100644 index beace2142823f2d0d501dc8a2c935aeac7f36ff1..0000000000000000000000000000000000000000 --- a/config.tests/libtiff/libtiff.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <tiffio.h> - -#if !defined(TIFF_VERSION) && defined(TIFF_VERSION_CLASSIC) -// libtiff 4.0 splits it into TIFF_VERSION_CLASSIC and TIFF_VERSION_BIG -# define TIFF_VERSION TIFF_VERSION_CLASSIC -#endif - -#if !defined(TIFF_VERSION) -# error "Required libtiff not found" -#elif TIFF_VERSION < 42 -# error "unsupported tiff version" -#endif - -int main(int, char **) -{ - tdata_t buffer = _TIFFmalloc(128); - _TIFFfree(buffer); - - // some libtiff implementations where TIFF_VERSION >= 42 do not - // have TIFFReadRGBAImageOriented(), so let's check for it - TIFFReadRGBAImageOriented(0, 0, 0, 0, 0, 0); - - return 0; -} diff --git a/config.tests/libtiff/libtiff.pro b/config.tests/libtiff/libtiff.pro deleted file mode 100644 index f7ac4c132d2a5176c9d97a02cd50377b31ec8ba9..0000000000000000000000000000000000000000 --- a/config.tests/libtiff/libtiff.pro +++ /dev/null @@ -1,6 +0,0 @@ -SOURCES = libtiff.cpp -CONFIG -= qt dylib -mac:CONFIG -= app_bundle -win32:CONFIG += console -unix|mingw: LIBS += -ltiff -else:win32: LIBS += libtiff.lib diff --git a/config.tests/libwebp/libwebp.cpp b/config.tests/libwebp/libwebp.cpp deleted file mode 100644 index 720b72b22aa331afe5e69ec976170a88c9a403b7..0000000000000000000000000000000000000000 --- a/config.tests/libwebp/libwebp.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests in the Qt ImageFormats module. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <webp/decode.h> -#include <webp/encode.h> -#include <webp/demux.h> - -#if WEBP_ABI_IS_INCOMPATIBLE(WEBP_DECODER_ABI_VERSION, 0x0203) || WEBP_ABI_IS_INCOMPATIBLE(WEBP_ENCODER_ABI_VERSION, 0x0202) -#error "Incompatible libwebp version" -#endif - -int main(int, char **) -{ - WebPDecoderConfig config; - WebPDecBuffer *output_buffer = &config.output; - WebPBitstreamFeatures *bitstream = &config.input; - WebPPicture picture; - picture.use_argb = 0; - WebPConfig config2; - config2.lossless = 0; - WebPData data = {}; - WebPDemuxer *demuxer = WebPDemux(&data); - WebPIterator iter; - iter.frame_num = 0; - - return 0; -} diff --git a/config.tests/libwebp/libwebp.pro b/config.tests/libwebp/libwebp.pro deleted file mode 100644 index bcbedf8eda431545b25e7d2aa0162731c089ab15..0000000000000000000000000000000000000000 --- a/config.tests/libwebp/libwebp.pro +++ /dev/null @@ -1,6 +0,0 @@ -SOURCES = libwebp.cpp -CONFIG -= qt dylib -mac:CONFIG -= app_bundle -win32:CONFIG += console -unix|mingw: LIBS += -lwebp -lwebpdemux -else:win32: LIBS += libwebp.lib libwebpdemux.lib diff --git a/config_help.txt b/config_help.txt new file mode 100644 index 0000000000000000000000000000000000000000..e08fa57b83d06e27dab3705f94d51b6dd702ee95 --- /dev/null +++ b/config_help.txt @@ -0,0 +1,6 @@ +Further image format options: + + -jasper .............. Enable JPEG-2000 support using the JasPer library [no] + -mng ................. Enable MNG support [no] + -tiff ................ Enable TIFF support [system/qt/no] + -webp ................ Enable WEBP support [system/qt/no] diff --git a/configure.json b/configure.json new file mode 100644 index 0000000000000000000000000000000000000000..550aebd95072254786e013f45345610cfa37ff8e --- /dev/null +++ b/configure.json @@ -0,0 +1,5 @@ +{ + "subconfigs": [ + "src/imageformats" + ] +} diff --git a/qtimageformats.pro b/qtimageformats.pro index 8382e5ceeb64f1862b72e18c4a788384db88afe4..fe127be605b065bb271c29d7956e241975e49684 100644 --- a/qtimageformats.pro +++ b/qtimageformats.pro @@ -1,9 +1,3 @@ requires(qtHaveModule(gui)) -load(configure) -qtCompileTest(jasper) -qtCompileTest(libmng) -qtCompileTest(libtiff) -qtCompileTest(libwebp) - load(qt_parts) diff --git a/src/imageformats/configure.json b/src/imageformats/configure.json new file mode 100644 index 0000000000000000000000000000000000000000..7c60f8684c872a481e83369132a0a219f1da9f00 --- /dev/null +++ b/src/imageformats/configure.json @@ -0,0 +1,212 @@ +{ + "module": "imageformats", + "depends": [ + "gui" + ], + + "commandline": { + "options": { + "jasper": { "type": "boolean" }, + "mng": { "type": "boolean" }, + "tiff": { "type": "enum", "values": [ "no", "qt", "system" ] }, + "webp": { "type": "enum", "values": [ "no", "qt", "system" ] } + } + }, + + "libraries": { + "jasper": { + "label": "jasper", + "test": { + "label": "Jasper(header in /usr/include)", + "type": "compile", + "test": { + "include": [ + "string.h", + "jasper/jasper.h" + ], + "qmake": [ + "msvc: LIBS += libjasper.lib", + "else: LIBS += -ljasper" + ], + "main": [ + "// This version of Jasper is broken, according to the old Qt Solutions docs", + "if (strcmp(JAS_VERSION, \"1.900.0\") == 0)", + " return 1;", + "return 0;" + ] + } + }, + "sources": [ + "-ljasper" + ] + }, + "mng": { + "label": "mng", + "test": { + "label": "MNG(header in /usr/include)", + "type": "compile", + "test": { + "include": [ + "stdio.h", + "libmng.h" + ], + "qmake": [ + "LIBS += -lmng" + ], + "main": [ + "mng_handle hMNG;", + "mng_cleanup(&hMNG);", + "#if defined(MNG_VERSION_MAJOR)", + "#if MNG_VERSION_MAJOR < 1 || (MNG_VERSION_MAJOR == 1 && MNG_VERSION_MINOR == 0 && MNG_VERSION_RELEASE < 9)", + "#error System libmng version is less than 1.0.9", + "#endif", + "#endif", + "return 0;" + ] + } + }, + "sources": [ + "-lmng" + ] + }, + "tiff": { + "label": "tiff", + "test": { + "label": "TIFF(header in /usr/include)", + "type": "compile", + "test": { + "include": "tiffio.h", + "qmake": [ + "unix|mingw: LIBS += -ltiff", + "else:win32: LIBS += libtiff.lib" + ], + "main": [ + "#if !defined(TIFF_VERSION) && defined(TIFF_VERSION_CLASSIC)", + "// libtiff 4.0 splits it into TIFF_VERSION_CLASSIC and TIFF_VERSION_BIG", + "# define TIFF_VERSION TIFF_VERSION_CLASSIC", + "#endif", + + "#if !defined(TIFF_VERSION)", + "# error \"Required libtiff not found\"", + "#elif TIFF_VERSION < 42", + "# error \"unsupported tiff version\"", + "#endif", + + "tdata_t buffer = _TIFFmalloc(128);", + "_TIFFfree(buffer);", + + "// some libtiff implementations where TIFF_VERSION >= 42 do not", + "// have TIFFReadRGBAImageOriented(), so let's check for it", + "TIFFReadRGBAImageOriented(0, 0, 0, 0, 0, 0);", + + "return 0;" + ] + } + }, + "sources": [ + "-ltiff" + ] + }, + "webp": { + "label": "webp", + "test": { + "label": "WebP(header in /usr/include)", + "type": "compile", + "test": { + "include": [ + "webp/decode.h", + "webp/encode.h", + "webp/demux.h" + ], + "qmake": [ + "LIBS += -lwebp -lwebpdemux" + ], + "main": [ + "#if WEBP_ABI_IS_INCOMPATIBLE(WEBP_DECODER_ABI_VERSION, 0x0203) || WEBP_ABI_IS_INCOMPATIBLE(WEBP_ENCODER_ABI_VERSION, 0x0202)", + "#error \"Incompatible libwebp version\"", + "#endif", + + "WebPDecoderConfig config;", + "WebPDecBuffer *output_buffer = &config.output;", + "WebPBitstreamFeatures *bitstream = &config.input;", + "WebPPicture picture;", + "picture.use_argb = 0;", + "WebPConfig config2;", + "config2.lossless = 0;", + "WebPData data = {};", + "WebPDemuxer *demuxer = WebPDemux(&data);", + "WebPIterator iter;", + "iter.frame_num = 0;", + + "return 0;" + ] + } + }, + "sources": [ + "-lwebp -lwebpdemux" + ] + } + }, + + "features": { + "jasper": { + "label": "JasPer", + "disable": "input.jasper == 'no'", + "condition": "features.imageformatplugin && libs.jasper", + "output": [ + "privateFeature", + { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_JASPER" } + ] + }, + "mng": { + "label": "MNG", + "disable": "input.mng == 'no'", + "condition": "libs.mng", + "output": [ "privateFeature" ] + }, + "tiff": { + "label": "TIFF", + "disable": "input.tiff == 'no'", + "condition": "features.imageformatplugin", + "output": [ + "privateFeature", + { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_TIFF" } + ] + }, + "system-tiff": { + "label": " Using system libtiff", + "disable": "input.tiff == 'qt'", + "enable": "input.tiff == 'system'", + "condition": "features.tiff && libs.tiff", + "output": [ "privateFeature" ] + }, + "webp": { + "label": "WEBP", + "disable": "input.webp == 'no'", + "condition": "features.imageformatplugin", + "output": [ + "privateFeature", + { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_WEBP" } + ] + }, + "system-webp": { + "label": " Using system libwebp", + "disable": "input.webp == 'qt'", + "enable": "input.webp == 'system'", + "condition": "features.webp && libs.webp", + "output": [ "privateFeature" ] + } + }, + + "summary": [ + { + "section": "Further Image Formats", + "entries": [ + "jasper", + "mng", + "tiff", "system-tiff", + "webp", "system-webp" + ] + } + ] +} diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro index d6c59eeb6cbcfb7f41bbd48b9dc09f41d725b01b..be1e20a9b72dbed06abc32cd1457eadba78fda40 100644 --- a/src/plugins/imageformats/imageformats.pro +++ b/src/plugins/imageformats/imageformats.pro @@ -2,17 +2,21 @@ TEMPLATE = subdirs SUBDIRS = \ # dds \ tga \ - tiff \ - wbmp \ - webp + wbmp + +include($$OUT_PWD/../../imageformats/qtimageformats-config.pri) +QT_FOR_CONFIG += imageformats-private + +qtConfig(tiff): SUBDIRS += tiff +qtConfig(webp): SUBDIRS += webp darwin: SUBDIRS += macheif qtConfig(regularexpression): \ SUBDIRS += icns -config_libmng: SUBDIRS += mng -config_jasper { +qtConfig(mng): SUBDIRS += mng +qtConfig(jasper) { SUBDIRS += jp2 } else:darwin: { SUBDIRS += macjp2 diff --git a/src/plugins/imageformats/jp2/jp2.pro b/src/plugins/imageformats/jp2/jp2.pro index 4caeff3d28fe3205fb65d444f63c9961fff4e1d0..d9fb4fa08ee0caf4ffd5fa52c7fb40886b16a251 100644 --- a/src/plugins/imageformats/jp2/jp2.pro +++ b/src/plugins/imageformats/jp2/jp2.pro @@ -5,8 +5,10 @@ SOURCES += main.cpp \ qjp2handler.cpp OTHER_FILES += jp2.json -msvc: LIBS += libjasper.lib -else: LIBS += -ljasper +include($$OUT_PWD/../../../imageformats/qtimageformats-config.pri) +QT_FOR_CONFIG += imageformats-private + +QMAKE_USE_PRIVATE += jasper PLUGIN_TYPE = imageformats PLUGIN_CLASS_NAME = QJp2Plugin diff --git a/src/plugins/imageformats/webp/webp.pro b/src/plugins/imageformats/webp/webp.pro index 405c3b7655a1d5abd74b80b2de7511ffd84865b2..cea7c78013b5665a845a2c19fe7ea31c20eb0da9 100644 --- a/src/plugins/imageformats/webp/webp.pro +++ b/src/plugins/imageformats/webp/webp.pro @@ -4,9 +4,11 @@ HEADERS += qwebphandler_p.h SOURCES += main.cpp qwebphandler.cpp OTHER_FILES += webp.json -config_libwebp { - unix|win32-g++*: LIBS += -lwebp -lwebpdemux - else:win32: LIBS += libwebp.lib libwebpdemux.lib +include($$OUT_PWD/../../../imageformats/qtimageformats-config.pri) +QT_FOR_CONFIG += imageformats-private + +qtConfig(system-webp) { + QMAKE_USE += webp } else { include($$PWD/../../../3rdparty/libwebp.pri) } diff --git a/src/src.pro b/src/src.pro index fcc07855011cf9192fb7d82bc954707273e4399e..4f9cee1e9cd51c9f40fa037d08f309bf87098bfc 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,2 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = plugins imageformats +SUBDIRS = imageformats plugins + +plugins.depends = imageformats