# -*- 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.335.0 vulkan-sdk-
github.tarball_from archive
name                vulkan-loader
revision            1

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           sha256  e1d7f598d42fa87b38fd7e984968c660e406168db64df8e8e23c5be3a66e9bd8 \
                    rmd160  2ecca6ba5ae751027d0aaf48b0943659cfb37975 \
                    size    1793888
# 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
}
