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

description         Computational Geometry Algorithm Library

long_description    The goal of the ${description} is to provide easy access to\
                    efficient and reliable geometric algorithms in the\
                    form of a C++ library. CGAL is used in various areas\
                    needing geometric computation, such as: computer\
                    graphics, scientific visualization, computer aided\
                    design and modeling, geographic information systems,\
                    molecular biology, medical imaging, robotics and\
                    motion planning, mesh generation, numerical methods...

github.setup        CGAL cgal 4.14.3 releases/CGAL-
revision            3
checksums           rmd160  c297a51c63a8161000d91128628d8c20ffdbf487 \
                    sha256  5bafe7abe8435beca17a1082062d363368ec1e3f0d6581bb0da8b010fb389fe4 \
                    size    15618196

conflicts           cgal5 cgal6
github.tarball_from releases
name                cgal4
license             LGPL-3+ GPL-3+
categories          gis science
maintainers         {vince @Veence}
use_xz              yes
distname            CGAL-${version}

homepage            https://www.cgal.org

# Backport a compile fix from CGAL 5.5.5 to CGAL 4.14
# https://trac.macports.org/ticket/73166
# https://github.com/CGAL/cgal/issues/8313
patchfiles-append   patch-CGAL_4_14_3_boost_graph_iterator_h.diff
patch.pre_args      -p1

boost.version       1.76

depends_lib-append  port:mpfr \
                    port:zlib \
                    port:gmp \
                    path:share/pkgconfig/eigen3.pc:eigen3

configure.args-append   -DCGAL_INSTALL_CMAKE_DIR="share/CGAL/cmake" \
                        -DWITH_CGAL_Qt5:BOOL=OFF \
                        -DWITH_Eigen3:BOOL=ON \
                        -DWITH_ZLIB:BOOL=ON \
                        -DCMAKE_CXX_STANDARD=11

# gcc 4.0 is too old to compile CGAL properly; see <http://www.cgal.org/FAQ.html#mac_optimization_bug>
compiler.blacklist-append gcc-4.0
compiler.cxx_standard     2011

variant debug description {Build with debug symbols} {
    configure.args-delete   -DCMAKE_BUILD_TYPE=Release
    configure.args-append   -DCMAKE_BUILD_TYPE=Debug

    post-destroot {
        exec dsymutil {*}[glob ${destroot}${prefix}/lib/*.dylib]
    }
}

variant qt5 description {Build with Qt5 bindings} {
    PortGroup               qt5 1.0

    configure.args-delete   -DWITH_CGAL_Qt5:BOOL=OFF
}

github.livecheck.regex  {(4\.[0-9.]+)}
