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

# Boost 1.76 has a bug in multiprecision library,
# which leads to including x86 header on powerpc.
boost.version       1.81

name                scip
version             9.1.0
revision            0
categories          math
license             Apache-2

maintainers         nomaintainer

description         Solving Constraint Integer Programs
long_description    SCIP is currently one of the fastest non-commercial solvers for \
                    mixed integer programming (MIP) and mixed integer nonlinear programming (MINLP).

homepage            https://scipopt.org/
master_sites        https://scipopt.org/download/release/
extract.suffix      .tgz

checksums           rmd160  1bfe273fad315a2da55fc46dfa0d65a3c267b7cb \
                    sha256  40459696c513c376bd1dbde10744837d0d4d4b9359df26243e749ba7991481f6 \
                    size    9931426

compilers.setup     require_fortran

compiler.thread_local_storage yes

compiler.cxx_standard 2014

# NOTE: that TBB implementation should be the same that is used at PAPILO
depends_lib-append  port:gmp \
                    port:ipopt \
                    port:libpapilo \
                    port:mpfr \
                    port:onetbb \
                    path:lib/libopenblas.dylib:OpenBLAS \
                    port:readline \
                    port:soplex \
                    port:zlib

# NOTE: that polymake requires that SCIP is built without ZIMPL
configure.args      -DCMAKE_BUILD_TYPE=Release \
                    -DGMP=ON \
                    -DSYM=none \
                    -DZIMPL=OFF \
                    -DCOVERAGE=OFF \
                    -DSHARED=ON \
                    -DAUTOBUILD=OFF

# due to the new linker (which was introduced in Xcode 15: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes),
# this port requires '-ld_classic' to build successfully with the toolchains from Xcode 15 or Command Line Tools 15.
#
# TODO: This is a temporary solution, the classic linker will be removed in a future release by Apple.
if { ( [vercmp ${xcodeversion} 15 ] >= 0 ) || ( [vercmp ${xcodecltversion} 15 ] >= 0 ) } {
    configure.ldflags-append \
                    -Wl,-ld_classic
}

if {[string match *gcc* ${configure.compiler}]} {
    # ___atomic_fetch_add_8
    configure.ldflags-append \
                    -latomic
}

livecheck.type      regex
livecheck.regex     SCIP version (\[0-9.\]+)
