# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=opencl-clhpp
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=2024.10.24
pkgrel=1
pkgdesc='OpenCL C++ header files (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/KhronosGroup/OpenCL-CLHPP'
msys2_references=(
  'archlinux: opencl-clhpp'
)
license=('spdx:Apache-2.0')
depends=("${MINGW_PACKAGE_PREFIX}-opencl-headers")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-ninja")
source=(https://github.com/KhronosGroup/OpenCL-CLHPP/archive/v${pkgver}/OpenCL-CLHPP-${pkgver}.tar.gz)
sha256sums=('51aebe848514b3bc74101036e111f8ee98703649eec7035944831dc6e05cec14')

build() {
  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    ${MINGW_PREFIX}/bin/cmake \
      -G'Ninja' \
      -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
      -DBUILD_DOCS=OFF \
      -DBUILD_EXAMPLES=OFF \
      -DBUILD_TESTING=OFF \
      -B build-${MSYSTEM} \
      -S OpenCL-CLHPP-${pkgver}

  ${MINGW_PREFIX}/bin/cmake --build build-${MSYSTEM}
}

package() {
  DESTDIR="${pkgdir}" cmake --install build-${MSYSTEM}

  install -D -m644 "${srcdir}"/OpenCL-CLHPP-${pkgver}/LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
