# -*- 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
PortGroup           legacysupport 1.1

github.setup        OpenImageDenoise oidn 1.4.3 v
github.tarball_from releases
revision            2
extract.suffix      .src${extract.suffix}
categories          graphics
platforms           darwin
license             Apache-2
maintainers         @jasonliu-- openmaintainer
homepage            http://www.openimagedenoise.org/
description         denoising filters for images rendered with ray \
                    tracing
long_description    Open Image Denoise is a library of ${description}, \
                    developed at Intel. Its purpose is to provide an \
                    efficient denoising library that allows \
                    ray-tracing-based rendering applications to \
                    significantly reduce rendering times.

checksums           rmd160  d63d25340e813ed468568a9763036be81d5efe14 \
                    sha256  3276e252297ebad67a999298d8f0c30cfb221e166b166ae5c955d88b94ad062a \
                    size    54222682

depends_build-append \
                    port:ispc
depends_lib-append  port:tbb \
                    port:openimageio

compiler.cxx_standard 2011
# OIDN requires a compiler that has OpenMP support (specifically,
# support for '-fopenmp-simd'). None of the compilers provided by Xcode
# have any support for OpenMP, so we need to blacklist all Xcode clangs.
# Note: Even though OIDN requires a compiler that has OpenMP support,
# it doesn't mean that we need to add port:libomp as a depends_lib. In
# fact, the '-fopenmp-simd' flag was created specifically to allow
# processing of 'simd' and 'declare simd' pragmas without needing to
# link to libomp/libgomp/etc. (References:
#     * https://gcc.gnu.org/legacy-ml/gcc-patches/2013-10/msg02275.html
#     * https://reviews.llvm.org/D31417)
compiler.blacklist-append clang

configure.args-append \
                    -DOIDN_APPS_OPENIMAGEIO=ON \
                    -DTBB_ROOT=${prefix}/libexec/tbb
