# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           cmake 1.1
PortGroup           github 1.0
PortGroup           qt4 1.0

github.setup        barracuda156 qt4-imageformats 4d564dd036d6f4481204f4ab437b33f78b2a61a6
version             0.1.0
revision            0
categories          graphics
license             LGPL-2+
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         Modern image format plugins (WebP, OpenEXR, JPEG XL, \
                    AVIF, HEIF, JPEG 2000, camera RAW) for Qt 4.8
long_description    {*}${description}. Installs QImageIOPlugin dylibs into \
                    qt4-mac's imageformats plugin directory\; every Qt4 \
                    application (this was written for Grabber's \
                    thumbnails/viewer, but it's app-agnostic) picks them \
                    up at runtime via QImageReader with no rebuild.
checksums           rmd160  aed12a4829395dec8ce736251be067435f25c380 \
                    sha256  701bb1c1b218347418fdba17ff7b16899281bbc4e45898272d15f384b36cdfe6 \
                    size    40403
github.tarball_from archive

# Basic variant:
depends_lib-append  port:webp

compiler.cxx_standard   1998

configure.args-append \
    -DQT_QMAKE_EXECUTABLE=${qt_qmake_cmd} \
    -DQT4_IMAGEFORMATS_BUILD_TESTS=OFF \
    -DQT4_IMAGEFORMATS_ENABLE_AVIF=OFF \
    -DQT4_IMAGEFORMATS_ENABLE_EXR=OFF \
    -DQT4_IMAGEFORMATS_ENABLE_HEIF=OFF \
    -DQT4_IMAGEFORMATS_ENABLE_JP2=OFF \
    -DQT4_IMAGEFORMATS_ENABLE_JXL=OFF \
    -DQT4_IMAGEFORMATS_ENABLE_RAW=OFF \
    -DQT4_IMAGEFORMATS_ENABLE_WEBP=ON \
    -DQT4_IMAGEFORMATS_INSTALL_DIR=${qt_plugins_dir}/imageformats

variant avif description "AVIF support (read+write)" {
    depends_lib-append      port:libavif
    configure.args-replace  -DQT4_IMAGEFORMATS_ENABLE_AVIF=OFF -DQT4_IMAGEFORMATS_ENABLE_AVIF=ON
}

variant exr description "OpenEXR (HDR) support" {
    depends_lib-append      port:openexr
    configure.args-replace  -DQT4_IMAGEFORMATS_ENABLE_EXR=OFF -DQT4_IMAGEFORMATS_ENABLE_EXR=ON
    compiler.cxx_standard   2014
}

variant heif description "HEIF/HEIC support" {
    depends_lib-append      port:libheif
    configure.args-replace  -DQT4_IMAGEFORMATS_ENABLE_HEIF=OFF -DQT4_IMAGEFORMATS_ENABLE_HEIF=ON
}

variant jp2 description "JPEG 2000 (jp2/j2k) support" {
    depends_lib-append      port:openjpeg
    configure.args-replace  -DQT4_IMAGEFORMATS_ENABLE_JP2=OFF -DQT4_IMAGEFORMATS_ENABLE_JP2=ON
}
variant jxl description "JPEG XL support" {
    depends_lib-append      port:libjxl
    configure.args-replace  -DQT4_IMAGEFORMATS_ENABLE_JXL=OFF -DQT4_IMAGEFORMATS_ENABLE_JXL=ON
}

variant raw description "Camera RAW support" {
    depends_lib-append      port:libraw
    configure.args-replace  -DQT4_IMAGEFORMATS_ENABLE_RAW=OFF -DQT4_IMAGEFORMATS_ENABLE_RAW=ON
}

default_variants +avif +exr +heif +jp2 +jxl +raw
