SUMMARY="A library for particle IO and manipulation"
DESCRIPTION="The goal of Partio is to provide a unified interface akin to \
unified image libraries that makes it easier to load, save, and manipulate \
particle files.

Major Features:

* Supports Houdini's GEO and BGEO, Maya's PDB and PDA, RenderMan's PTC
* Arbitrary back end in-memory/cached formats can be supported from a single \
interface
* A Python API for easy scripting of particle manipulation
* A C++ API for high performance particle manipulation
* Nearest Neighbor Lookups for density estimation, Voronoi computation, etc."
HOMEPAGE="https://www.disneyanimation.com/technology/partio.html"
COPYRIGHT="2010-2012 Disney Enterprises"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/wdas/partio/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="f98874b781e92ab9b5d0575cabc437d27274cd91cb581f80960918efa491f902"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir

if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	partio$secondaryArchSuffix = $portVersion compat >= 1
	cmd:partattr$commandSuffix = $portVersion
	cmd:partconvert$commandSuffix = $portVersion
	cmd:partedit = $portVersion
	cmd:partinfo$commandSuffix = $portVersion
	cmd:partinspect = $portVersion
	cmd:partjson = $portVersion
	cmd:partview$commandSuffix = $portVersion
	lib:libpartio$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libGLU$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	partio${secondaryArchSuffix}_devel = $portVersion
	devel:libpartio$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	partio$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
#	cmd:doxygen
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:python3.7
	cmd:swig
	"

defineDebugInfoPackage partio$secondaryArchSuffix \
	$commandBinDir/partattr \
	$commandBinDir/partconvert \
	$commandBinDir/partinfo \
	$commandBinDir/partview

BUILD()
{
	cmake -B build -S . \
		$cmakeDirArgs \
		-DCMAKE_INSTALL_BINDIR=$commandBinDir \
		-DBUILD_TESTING=OFF \
		-DPARTIO_USE_GLVND=OFF \
		-Wno-dev

	make -C build $jobArgs
}

INSTALL()
{
	make -C build install

	prepareInstalledDevelLib libpartio

	packageEntries devel \
		$developDir
}

TEST()
{
	make -C build test
}
