# Template file for 'waifu2x-converter-cpp'
pkgname=waifu2x-converter-cpp
version=5.3.4
revision=1
build_style=cmake
configure_args="-DINSTALL_MODELS=ON"
hostmakedepends="pkg-config"
makedepends="libopencv-devel OpenCL-Headers ocl-icd-devel"
short_desc="Image upscaling using deep convolutional neural networks"
maintainer="SolitudeSF <solitudesf@protonmail.com>"
license="MIT"
homepage="https://github.com/DeadSix27/waifu2x-converter-cpp"
distfiles="${homepage}/archive/v${version}.tar.gz"
checksum=93e1dca78657c48f9c497a71b9e9d11e88ffadcc20fac27f9c48cdba7f132b51

# silly workaround to prevent vector/bool/etc from being defined
case "$XBPS_TARGET_MACHINE" in
	ppc*) CXXFLAGS+=" -D__APPLE_ALTIVEC__";;
esac
CXXFLAGS+=" -DCL_TARGET_OPENCL_VERSION=220"

pre_configure() {
	# conv is a generator built with add_executable
	# build it before so it is built with the correct
	# toolchain
	mkdir build
	cc -o build/conv conv.c
}

pre_check() {
	cp -r models_rgb build
}

post_install() {
	vlicense LICENSE
}
