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

github.setup            libkml libkml 1.3.0
revision                4
checksums               rmd160  b13c1c8d072098f365ac315cc1588ef3eba4ad1d \
                        sha256  5ac678ec9b3f737749712206fc199acb27bbdb74ca8656607fc809cbc951a482 \
                        size    6640063

license                 BSD
platforms               darwin
categories              gis
maintainers             {ryandesign @ryandesign} openmaintainer

description             library to parse, generate and operate on KML

long_description        ${name} is a library for parsing, generating and \
                        operating on KML. \
                        It is an implementation of the OGC KML 2.2 standard.

boost.depends_type      build

depends_lib-append      port:expat \
                        port:minizip \
                        port:uriparser \
                        port:zlib

patchfiles              DYLD_LIBRARY_PATH.patch libkml_pc-boost.patch

configure.args-append   -DBUILD_EXAMPLES=OFF \
                        -DBUILD_TESTING=OFF \
                        -DEXPAT_LIBRARY=${prefix}/lib/libexpat.dylib \
                        -DMINIZIP_LIBRARY=${prefix}/lib/libminizip.dylib \
                        -DURIPARSER_LIBRARY=${prefix}/lib/liburiparser.dylib \
                        -DWITH_JAVA=OFF \
                        -DWITH_PYTHON=OFF \
                        -DWITH_SWIG=OFF \
                        -DZLIB_LIBRARY_RELEASE=${prefix}/lib/libz.dylib

variant tests description {Enable tests} {
    configure.args-replace  -DBUILD_TESTING=OFF \
                            -DBUILD_TESTING=ON

    depends_build-append    port:gtest

    # duplicate settings from gtest CMakeLists.txt file
    compiler.cxx_standard   2011
    configure.args-append   -DCMAKE_CXX_STANDARD=11 \
                            -DCMAKE_CXX_STANDARD_REQUIRED=ON

    test.run                yes
    test.target             test
}

post-destroot {
    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -W ${worksrcpath} -m 0644 \
        AUTHORS \
        ChangeLog \
        LICENSE \
        README.md \
        ${destroot}${docdir}
}
