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

name                libsharp
version             1.0.0
set branch          3.60
categories          science
license             GPL-2+
maintainers         {aronnax @lpsinger} openmaintainer
description         C/C++ library for fast spherical harmonic transforms
long_description \
    libsharp is a library for spherical harmonic transforms (SHTs), which \
    evolved from the libpsht library, addressing several of its shortcomings, \
    such as adding MPI support for distributed memory systems and SHTs of \
    fields with arbitrary spin, but also supporting new developments in CPU \
    instruction sets like the Advanced Vector Extensions (AVX) or fused \
    multiply-accumulate (FMA) instructions. The library is implemented in \
    portable C99 and provides an interface that can be easily accessed from \
    other programming languages such as C++, Fortran, Python etc. Generally, \
    libsharp's performance is at least on par with that of its predecessor\; \
    however, significant improvements were made to the algorithms for scalar \
    SHTs, which are roughly twice as fast when using the same CPU capabilities.
homepage            https://healpix.sourceforge.io
platforms           darwin
master_sites        sourceforge:project/healpix/Healpix_${branch}/

checksums           rmd160  26353a493a40e47833a292e31d93c67ce56cd72a \
                    sha256  e98293315ee0f8a4c69c627bda36297b45e35e7afc33f510756f212d36c02f92 \
                    size    389247

universal_variant   no

configure.args-append --disable-openmp

default_variants    +openmp

variant openmp description "enable OpenMP parallel acceleration" {
    configure.args-delete --disable-openmp
    compiler.openmp_version 2.5
}

# Enable -ffast-math optimizatioins as per upstream author's instructions
configure.cflags-append -ffast-math

# On x86_64, enable runtime dispatch to optimized code paths for different
# vector instruction sets.
if {${configure.build_arch} eq "x86_64"} {
    configure.cflags-append -DMULTIARCH
}
