# -*- 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           github 1.0
PortGroup           cmake 1.1

github.setup        KhronosGroup Vulkan-Loader 1.4.350.1 vulkan-sdk-
github.tarball_from archive
name                vulkan-loader
revision            0

categories          graphics devel
license             Apache-2
maintainers         {judaew @judaew} openmaintainer

description         Vulkan loader
long_description    Loader for Vulkan Installable Client Drivers (ICDs) and Vulkan Layers. \
                    While MoltenVK on macOS can be linked to directly, it is a Level 0 ICD \
                    and thus requires a loader in order to use Layers.
homepage            https://vulkan.lunarg.com

set py_ver          3.14
set py_ver_nodot    [string map {. {}} ${py_ver}]

depends_build-append \
                    port:python${py_ver_nodot} \
                    port:vulkan-headers \
                    path:bin/pkg-config:pkgconfig

checksums           rmd160  321ce4c477cf783b3920684d44dee9cb4142ca92 \
                    sha256  602984a71000981e25e4feb419e6cdd70b18ffe2b8004f60f591706027bca468 \
                    size    1800017

cmake.build_type    Release
# looked into /opt/local/include instead of the vulkan-headers include paths.
# Corrected use off file(GLOB_RECURSE ...) .
patchfiles          vulkan-headers-find.patch

configure.args-append \
                    -DPython_ADDITIONAL_VERSIONS=${py_ver} \
                    -DFALLBACK_DATA_DIRS=${prefix}/share:/usr/local/share:/usr/share \
                    -DCMAKE_INSTALL_PREFIX=${prefix}

post-destroot {
    copy ${workpath}/build/loader/vulkan.framework ${destroot}${frameworks_dir}/vulkan.framework
    delete ${destroot}${prefix}/loader
}
