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

name                py-xformers
version             0.0.35
revision            0

categories-append   science
license             BSD
maintainers         {pguyot @pguyot} openmaintainer
supported_archs     arm64 x86_64

description         Hackable and optimized Transformers building blocks

long_description    xFormers is a library of composable Transformer \
                    building blocks from Meta AI Research, providing \
                    optimized attention mechanisms and other components.

homepage            https://facebookresearch.github.io/xformers/

checksums           rmd160  64e52ae1537122b6234e132678191087ca10e488 \
                    sha256  f7fc183a58e4bf0e2ae339a18fb1b1d4a37854c0f2545b4f360fef001646ab76 \
                    size    4258182

python.versions     313 314

# Remove torch from build requirements to avoid transitive
# dependency version checks
patchfiles-append   patch-pyproject_toml.diff \
                    patch-setup_py-no-openmp.diff

if {${name} ne ${subport}} {
    depends_lib-append \
                    port:py${python.version}-numpy \
                    port:py${python.version}-pytorch

    compiler.cxx_standard 2017

    build.env-append \
                    XFORMERS_BUILD_TYPE=Release \
                    CCACHE_DISABLE=1

    destroot.env-append \
                    XFORMERS_BUILD_TYPE=Release \
                    CCACHE_DISABLE=1
}
