_realname=oatpp
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.3.1
pkgrel=1
pkgdesc="Oat++ is an open-source C++ web framework for highly scalable and resource-efficient web applications."
url="https://github.com/oatpp/oatpp"
license=('Apache')
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-cc"
  "${MINGW_PACKAGE_PREFIX}-cmake"
  "${MINGW_PACKAGE_PREFIX}-ninja"
)
source=("https://github.com/oatpp/oatpp/archive/${pkgver}.zip")
sha256sums=('d6bf0b4de4af1f0863e7ca946ddb7b824a6e492680c6090cf111902b6809311a')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  mkdir -p build
  cd build

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    ${MINGW_PREFIX}/bin/cmake.exe \
      -GNinja \
      -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
      -DCMAKE_BUILD_TYPE=Release \
      -DOATPP_BUILD_TESTS=OFF \
      ..

  cmake --build .
}

package() {
  cd "$srcdir/${_realname}-${pkgver}/build"
  DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake.exe --install .
}
