# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           cmake 1.1

platforms           darwin macosx
categories          science
license             Boost-1
maintainers         {ra1nb0w @ra1nb0w} {michaelld @michaelld} openmaintainer

description         Pothos toolkit for liquid DSP processing cores
long_description    This toolkit wraps Pothos blocks around the Liquid \
    DSP library. Blocks are generated from the liquid DSP include header \
    and a file describing the available functions and parameters. \

github.setup        pothosware PothosLiquidDSP bb0f8f8456426c3a99c448bfbacc52134f6f366c
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             0.0.0-git-20211220
checksums           rmd160  87d6893e2d5b8689bd8783224c03d7ead6c497e9 \
                    sha256  74b90b071cd7a36f951a853b055a942d792a79216fd41a20c2b63ccf361783c7 \
                    size    37837
revision            0

compiler.cxx_standard 2011

# set Python version and variants
set PythonVersionNoDot ""

variant python38 conflicts python39 python310 description {Build using Python 3.8} {}
variant python39 conflicts python38 python310  description {Build using Python 3.9} {}
variant python310 conflicts python38 python39 description {Build using Python 3.10} {}

if {![variant_isset python38] &&
    ![variant_isset python39] &&
    ![variant_isset python310]} {
    default_variants +python39
}

if {![variant_isset python38] &&
    ![variant_isset python39] &&
    ![variant_isset python310]} {
    ui_error "\n\nYou must select one of the variants +python38, +python39, or +python310.\n"
    return -code error "Invalid variant selection"
}

if {[variant_isset python38]} {
    set PythonVersionNoDot "38"
} elseif {[variant_isset python310]} {
    set PythonVersionNoDot "310"
} else {
    set PythonVersionNoDot "39"
}
set PythonVersionWithDot [join [split ${PythonVersionNoDot} ""] "."]

depends_lib-append \
    port:PothosCore \
    port:liquid-dsp

depends_build-append \
    port:py${PythonVersionNoDot}-ply \
    port:py${PythonVersionNoDot}-yaml \
    port:py${PythonVersionNoDot}-mako

configure.args-append \
    -DPYTHON_EXECUTABLE=${frameworks_dir}/Python.framework/Versions/${PythonVersionWithDot}/bin/python${PythonVersionWithDot} \
    -DPYTHON_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/${PythonVersionWithDot}/Headers \
    -DPYTHON_LIBRARY=${frameworks_dir}/Python.framework/Versions/${PythonVersionWithDot}/Python
