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

set git_commit          2e4ae2ea94595995c1fc56860051410b0c0be605
set git_date            20221201
github.setup            openscenegraph OpenSceneGraph ${git_commit}
github.tarball_from     archive
name                    OpenSceneGraph-devel
version                 3.7.0-${git_date}
revision                0
conflicts               OpenSceneGraph
categories              graphics
maintainers             nomaintainer
license                 wxWidgets-3
description             high-performance 3D graphics toolkit

long_description        ${name} is a high-performance 3D graphics toolkit useful in fields such as \
                        visual simulation, games, virtual reality, scientific visualization and \
                        modelling.

homepage                http://www.openscenegraph.org/

checksums               rmd160  64d4082e21e8a17af0e39c9301835aaf283818be \
                        sha256  2b992033e3a94671d18065513ac3d315e9ea65567d014eb966292a5cd87c896b \
                        size    5833568

# respect MacPorts compiler flags
# see https://trac.macports.org/ticket/45287
patchfiles-append       patch-CMakeLists.txt.diff

# see https://github.com/openscenegraph/OpenSceneGraph/issues/1075
patchfiles-append       patch-openexr3.diff

ffmpeg.version          4

depends_build-append    port:pkgconfig

depends_lib             port:curl \
                        port:dcmtk \
                        port:fontconfig \
                        port:freetype \
                        port:gdal \
                        port:gettext-runtime \
                        path:lib/pkgconfig/cairo.pc:cairo \
                        path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                        path:lib/pkgconfig/glib-2.0.pc:glib2 \
                        port:gstreamer1 \
                        port:gstreamer1-gst-plugins-base \
                        port:imath \
                        path:include/turbojpeg.h:libjpeg-turbo \
                        port:jasper \
                        path:lib/pkgconfig/librsvg-2.0.pc:librsvg \
                        port:openexr \
                        path:lib/pkgconfig/poppler.pc:poppler \
                        port:tiff \
                        port:zlib

compiler.cxx_standard   2011
cmake.set_cxx_standard  yes

# Use OpenGL framework instead of mesa
configure.pre_args-delete   -DCMAKE_FIND_FRAMEWORK=LAST

configure.args-append   -DOSG_CONFIG_HAS_BEEN_RUN_BEFORE=YES \
                        -DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX=imageio \
                        -DOSG_WINDOWING_SYSTEM=Cocoa \
                        -DBUILD_OSG_EXAMPLES=NO

# disable unwanted optional dependencies to avoid opportunistic configuration
# TODO: add some of these back either directly or as variants after testing

configure.args-append   -DCMAKE_DISABLE_FIND_PACKAGE_Asio=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_COLLADA=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_DirectInput=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_FBX=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_GTA=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_GtkGl=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_Inventor=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_LIBLAS=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_LibVNCServer=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_NVTT=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_OpenCascade=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_SDL2=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_SDL=1 \
                        -DCMAKE_DISABLE_FIND_PACKAGE_ZeroConf=1
