# -*- 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

name                    gdcm
version                 3.0.20
revision                2
categories              science graphics
license                 BSD
maintainers             {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
platforms               darwin
description             a C++ library for DICOM medical files
long_description        Grassroots DiCoM is a C++ library for DICOM medical files.

homepage                https://sourceforge.net/projects/gdcm/
master_sites            sourceforge

checksums               rmd160  a667ead8c91bc2241349c955f3c98bdd88671bac \
                        sha256  a361138dd0e7803b2adfd8f6c17248bd51ec474dc05997687f2aa25c5a66fef7 \
                        size    3967232

compiler.cxx_standard   2014

# fix case mismatch with CharLS 2.1.0 and later
# See: https://trac.macports.org/ticket/60696
# See: https://trac.macports.org/ticket/64765
patchfiles-append       CharLS-2.1.0.patch

# fix error with newer Poppler
patchfiles-append       patch-poppler.diff

depends_build-append    port:pkgconfig

depends_lib-append      port:zlib \
                        path:lib/libssl.dylib:openssl \
                        port:expat \
                        port:jsoncpp port:json-c \
                        port:socketxx \
                        port:openjpeg \
                        port:charls \
                        port:vtk

configure.args-append   -DCMAKE_CXX_STANDARD=14 \
                        -DGDCM_BUILD_DOCBOOK_MANPAGES=OFF \
                        -DGDCM_BUILD_EXAMPLES=OFF \
                        -DGDCM_BUILD_TESTING=OFF \
                        -DGDCM_BUILD_SHARED_LIBS=ON \
                        -DGDCM_DOCUMENTATION=OFF \
                        -DGDCM_USE_SYSTEM_ZLIB=ON \
                        -DGDCM_USE_SYSTEM_OPENSSL=ON \
                        -DGDCM_USE_SYSTEM_UUID=ON \
                        -DGDCM_USE_SYSTEM_EXPAT=ON \
                        -DGDCM_USE_SYSTEM_JSON=ON \
                        -DGDCM_USE_SYSTEM_PAPYRUS3=OFF \
                        -DGDCM_USE_SYSTEM_SOCKETXX=ON \
                        -DGDCM_USE_SYSTEM_LJPEG=OFF \
                        -DGDCM_USE_SYSTEM_OPENJPEG=ON \
                        -DGDCM_USE_SYSTEM_CHARLS=ON \
                        -DGDCM_USE_VTK=ON \
                        -DGDCM_WRAP_CSHARP=OFF \
                        -DGDCM_WRAP_JAVA=OFF \
                        -DGDCM_WRAP_PYTHON=OFF \
                        -DOPJ_USE_DSYMUTIL=OFF

variant applications description {build Application} {
    PortGroup               qt5 1.0
    depends_lib-append      path:lib/pkgconfig/poppler.pc:poppler \
                            port:libxml2
    configure.args-append   -DGDCM_BUILD_APPLICATIONS=ON \
                            -DGDCM_USE_SYSTEM_POPPLER=ON \
                            -DGDCM_USE_SYSTEM_LIBXML2=ON
}

# installation seems to hang
#variant docs description {Build source documentation} {
#    depends_build-append    path:bin/doxygen:doxygen \
#                            port:libxslt
#    configure.args-append   -DGDCM_DOCUMENTATION=ON
#}
