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

github.setup        Viskores viskores 1.1.1 v
revision            0

categories          graphics science devel
license             BSD
maintainers         {reneeotten @reneeotten} openmaintainer

description         Visualization library for many-threaded devices
long_description    Viskores is a toolkit of scientific visualization algorithms \
                    for emerging processor architectures. Viskores supports \
                    the fine-grained concurrency for data analysis and visualization \
                    algorithms required to drive extreme scale computing by providing \
                    abstract models for data and execution that can be applied to \
                    a variety of algorithms across many different processor architectures.

homepage            https://viskores.readthedocs.io

checksums           rmd160  a79753dd1068570bc30bdee012e6233957ed21cb \
                    sha256  2a6c7a9e036d1756f4f8a6a835a4cee91452197a22ddce755672370ccc296605 \
                    size    17158357
github.tarball_from archive

compiler.cxx_standard   2014
compiler.thread_local_storage yes

# ___atomic_fetch_add_8
if {[string match macports-gcc* ${configure.compiler}] && ${configure.build_arch} in [list arm i386 ppc]} {
    configure.ldflags-append \
                    -latomic
}

# TODO: if hdf5 is built with MPI, then -DViskores_HDF5_IS_PARALLEL should be used.
# Also, add MPI support here.
variant hdf5 description "Enable HDF5 support" {
    configure.args-append   -DViskores_ENABLE_HDF5_IO=ON
    depends_lib-append      port:hdf5
}

variant kokkos description "Enable Kokkos support" {
    configure.args-append   -DViskores_ENABLE_KOKKOS=ON
    depends_lib-append      path:lib/libkokkoscore.dylib:kokkos
}

variant native description "Enable CPU-specific optimizations" {
    configure.args-append   -DViskores_Vectorization=native
}

variant openmp description "Enable OpenMP support" {
    configure.args-append   -DViskores_ENABLE_OPENMP=ON

    compiler.openmp_version 4.0

    if {[string match macports-clang* ${configure.compiler}]} {
        configure.cppflags-append \
                            -fopenmp-version=40
        configure.ldflags-append \
                            -L${prefix}/lib/libomp -lomp
    }
}

variant tbb description "Enable Intel Threading Building Blocks support" {
    configure.args-append   -DViskores_ENABLE_TBB=ON
    configure.env-append    TBB_ROOT=${prefix}/libexec/onetbb
    depends_lib-append      port:onetbb
}
