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

# strnlen
legacysupport.newest_darwin_requires_legacy 10

github.setup        assimp assimp 5.4.3 v
revision            0
checksums           rmd160  4ef115dc5d83b29a635188fca5bd0f4b99a6bc68 \
                    sha256  66dfbaee288f2bc43172440a55d0235dfc7bf885dda6435c038e8000e79582cb \
                    size    53964510

conflicts           assimp2
categories          graphics
maintainers         nomaintainer
license             BSD

description         library to import/export 3-D model formats
long_description    Open Asset Import Library (short name: Assimp) is a \
                    portable Open Source library to import various well-known \
                    3-D model formats in a uniform manner. The most recent \
                    version also knows how to export 3_D files and is therefore \
                    suitable as a general-purpose 3-D model converter.

homepage            https://www.assimp.org

github.tarball_from archive

depends_build-append \
                    port:pkgconfig

depends_lib         port:minizip \
                    port:pugixml \
                    port:zlib

post-extract {
    # Ensure we don't use these bundled libraries.
    foreach item [list pugixml unzip zlib] {
        move ${worksrcpath}/contrib/${item} ${worksrcpath}/contrib/${item}-disabled
    }
}

patchfiles-append   patch-code-CMakeLists.txt.diff \
                    patch-include-assimp-Hash.h.diff

compiler.cxx_standard 2017
compiler.thread_local_storage yes
configure.args-append -DASSIMP_BUILD_ASSIMP_TOOLS:BOOL=OFF \
                      -DASSIMP_BUILD_TESTS:BOOL=OFF \
                      -DASSIMP_WARNINGS_AS_ERRORS:BOOL=OFF \
                      -DASSIMP_BUILD_ZLIB:BOOL=OFF \
                      -DASSIMP_BUILD_USE_CCACHE=OFF

subport assimp_tools {
    PortGroup       qt5 1.0

    depends_lib-append   \
        port:${name}

    configure.args-replace                    \
        -DASSIMP_BUILD_ASSIMP_TOOLS:BOOL=OFF  \
        -DASSIMP_BUILD_ASSIMP_TOOLS:BOOL=ON

    post-destroot {
        # remove directories provided by ${name}
        delete ${destroot}${prefix}/lib
        delete ${destroot}${prefix}/include
    }
}

github.livecheck.regex {(\d+(\.\d+)+)}
