# -*- 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           github 1.0

boost.version       1.81

github.setup        PointCloudLibrary pcl 1.15.1 pcl-
revision            0
name                libpcl
categories          gis graphics science
license             BSD
maintainers         {vince @Veence}
description         Point Cloud Library
long_description    The Point Cloud Library (PCL) is a standalone, large scale, open project \
                    for 2D/3D image and point cloud processing.

homepage            http://pointclouds.org

checksums           rmd160  53827bdd0a6379d75dcb279e1e0cd2f3c46a5f66 \
                    sha256  e1d862c7b6bd27a45884a825a2e509bfcbd4561307d5bfe17ce5c8a3d94a6c29 \
                    size    68700306
github.tarball_from archive

cmake.generator     Ninja
cmake.build_type    Release

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:cjson \
                    path:share/pkgconfig/eigen3.pc:eigen3 \
                    port:flann \
                    port:libpcap \
                    port:libpng \
                    port:libusb \
                    port:libxml2 \
                    port:nanoflann \
                    port:qhull \
                    port:tiff \
                    port:zlib

depends_test        port:gtest

compiler.cxx_standard   2017

configure.args-append   -DBUILD_apps=OFF \
                        -DBUILD_examples=OFF \
                        -DWITH_DOCS=OFF \
                        -DWITH_GLEW=OFF \
                        -DWITH_LIBUSB=ON \
                        -DWITH_OPENNI=OFF \
                        -DWITH_PCAP=ON \
                        -DWITH_QT=OFF \
                        -DWITH_SYSTEM_CJSON=ON \
                        -DWITH_VTK=OFF

variant openmp description "Enable OpenMP for speed" {
    # TODO: verify OpenMP version required
    compiler.openmp_version 3.1
}

variant viz description "Add the visualisation module" {
    depends_lib-append      port:vtk \
                            port:glew
    configure.args-replace  -DWITH_GLEW=OFF -DWITH_GLEW=ON \
                            -DWITH_VTK=OFF -DWITH_VTK=ON
    configure.args-append   -DWITH_OPENGL=ON
}

variant test description "Configure to run unit tests" {
    configure.args-append   -DBUILD_global_tests=ON \
                            -DGTEST_SRC_DIR=${prefix}/src/googletest/
}

default_variants    +openmp +viz

# Test phase completes to the test summary (93 of 104 passed) but then aborts with
# "Failed to test libpcl: command execution failed"
# Needs further work
test.run            yes
test.target         tests
