# -*- 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        microsoft LightGBM 4.5.0 v
revision            0
categories          math
license             MIT
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
description         Fast, distributed, high performance gradient boosting \
                    (GBT, GBDT, GBRT, GBM or MART) framework
long_description    {*}${description}, based on decision tree algorithms, \
                    used for ranking, classification and many other \
                    machine learning tasks.
homepage            https://lightgbm.readthedocs.io
checksums           rmd160  428d95d23ec69ba5a0b192b0776618ff0b97987b \
                    sha256  cc72ae1f979935e11243c93bacefe34144a4fcf3dc304b2a53d99ea408fe8976 \
                    size    6163768
github.tarball_from archive

patchfiles-append   0001-Fix-CMakeLists.txt.patch

set libfmt_ver      10

cmake.module_path-append \
                    ${prefix}/lib/libfmt${libfmt_ver}/cmake

depends_lib-append  path:share/pkgconfig/eigen3.pc:eigen3 \
                    port:fast_double_parser \
                    port:libfmt${libfmt_ver}

compiler.cxx_standard   2014
compiler.blacklist-append \
                    {clang < 900} {*gcc-[34].*}

configure.args-append \
                    -DBUILD_CLI=ON \
                    -DBUILD_CPP_TEST=OFF \
                    -DBUILD_STATIC_LIB=OFF \
                    -DEIGEN_DIR=${prefix}/include/eigen3 \
                    -DINSTALL_HEADERS=ON \
                    -DLIBFMT_DIR=${prefix}/include/libfmt${libfmt_ver} \
                    -DUSE_CUDA=OFF \
                    -DUSE_GPU=OFF \
                    -DUSE_MPI=OFF \
                    -DUSE_OPENMP=ON \
                    -DUSE_SANITIZER=OFF \
                    -DUSE_SWIG=OFF

platform darwin {
    configure.args-append \
                    -DAPPLE_OUTPUT_DYLIB=ON
}

compiler.openmp_version 3.0

if {[string match *clang* ${configure.compiler}]} {
    configure.ldflags-append \
                    -L${prefix}/lib/libomp -lomp
}
