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

github.setup        FEniCS basix 0.8.0 v
revision            0
categories          science
license             MIT
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
homepage            https://fenicsproject.org
description         FEniCS finite element basis evaluation library
long_description    {*}${description}

checksums           rmd160  3fb61abfc2a05170dd31acbc642276dc4b2238c2 \
                    sha256  b299af82daf8fa3e4845e17f202491fe71b313bf6ab64c767a5287190b3dd7fe \
                    size    627400
github.tarball_from archive

cmake.source_dir    ${worksrcpath}/cpp

depends_lib-append  path:lib/libopenblas.dylib:OpenBLAS

compiler.cxx_standard 2020

# https://github.com/FEniCS/basix/issues/752
compiler.blacklist-append {clang < 1400}

# -DBLA_VENDOR is broken on Ventura for some reason.
configure.args-append \
                    -DBLAS_LIBRARIES="-lopenblas" \
                    -DLAPACK_LIBRARIES="-lopenblas" \
                    -DBUILD_SHARED_LIBS=ON

platform darwin {
    # TODO: This is a temporary solution, the classic linker will be removed in a future release by Apple.
    if {([vercmp ${xcodeversion} 15] >= 0) || ([vercmp ${xcodecltversion} 15] >= 0)} {
        configure.ldflags-append \
                    -Wl,-ld_classic
    }
}
