# -*- 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           boost 1.0
PortGroup           cmake 1.1
PortGroup           github 1.0

github.setup        thliebig openEMS 1ccf0942477e9178b27f5e00dddd4d62bff78d29
version             20240312-[string range ${github.version} 0 7]
revision            1

checksums           rmd160  c29d96ef9a7c08f6d6295aa6fe5eb0feddcb2362 \
                    sha256  984f5263562bb32d104bffd4f66c148abe2ee57df48c3ac6dd9751a15b83a312 \
                    size    1738400
github.tarball_from archive

platforms           darwin macosx
categories          science
license             GPL-3
maintainers         {ra1nb0w @ra1nb0w} openmaintainer
description         ${name} is a free and open-source electromagnetic field solver using the EC-FDTD method
long_description    {*}${description}

compiler.cxx_standard 2011

patchfiles-append \
    clocale_fix.patch \
    dont-link_directories.patch

# https://github.com/thliebig/openEMS/pull/144
patchfiles-append \
    0001-operator_ext_lumpedRLC.h-fix-includes.patch \
    0002-CMakeLists-define-version-once.patch \
    0003-CMakeLists-fix-powerpc.patch

depends_build-append \
    port:bison \
    port:flex \
    path:bin/pkg-config:pkgconfig

depends_lib-append \
    port:cgal4 \
    port:CSXCAD \
    port:fparser \
    port:hdf5 \
    port:tinyxml \
    port:vtk

depends_run-append \
    port:octave

# maybe in the future we can support mpi

notes "
To use openEMS in Octave run the following commands in the Octave console

    addpath('${prefix}/share/openEMS/matlab');
    addpath('${prefix}/share/CSXCAD/matlab');
    savepath()
"