summaryrefslogtreecommitdiff
path: root/src/imageformats/configure.json
blob: 7c60f8684c872a481e83369132a0a219f1da9f00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
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"
            ]
        }
    ]
}