SUMMARY="Helper for multithreaded programming"
DESCRIPTION="ThreadWeaver is a helper for multithreaded programming. It uses \
a job-based interface to queue tasks and execute them in an efficient way.

You simply divide the workload into jobs, state the dependencies between the \
jobs and ThreadWeaver will work out the most efficient way of dividing the \
work between threads within a set of resource limits.

See the information on [use cases](@ref usecases) and [why multithreading can \
help](@ref multithreading), as well as the usage section below, for more \
detailed information."
HOMEPAGE="https://github.com/KDE/threadweaver/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/threadweaver/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="bb8c1341ece9fea7d4f1101a04479d7a18c9d682fb8454b92d7a39e8a768fe0e"
PATCHES="threadweaver-$portVersion.patchset"

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

PROVIDES="
	threadweaver$secondaryArchSuffix = $portVersion
	lib:libKF5ThreadWeaver$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	"

PROVIDES_devel="
	threadweaver${secondaryArchSuffix}_devel = $portVersion
	devel:libKF5ThreadWeaver$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES_devel="
	threadweaver$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	devel:libQt5Core$secondaryArchSuffix >= 5.7
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DECM_MKSPECS_INSTALL_DIR=$dataDir/Qt5/mkspecs \
		-DECM_DIR=/system/data/cmake/Modules/ECM/cmake
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libKF5ThreadWeaver

	packageEntries devel \
		$libDir/cmake \
		$dataDir/Qt5/mkspecs \
		$developDir
}

TEST()
{
	cd build
	make test
}
