#!/bin/bash

mkdir build && cd build

USE_SUBMODULE_KCOLORPICKER=${USE_SUBMODULE_KCOLORPICKER:-OFF}
USE_SUBMODULE_KIMAGEANNOTATOR=${USE_SUBMODULE_KIMAGEANNOTATOR:-OFF}

EXTRA_CMAKE_ARGS=()
if [[ -n "${CMAKE_OSX_ARCHITECTURES:-}" ]]; then
  EXTRA_CMAKE_ARGS+=("-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}")
fi

cmake .. -G"${CMAKE_GENERATOR}" -DBUILD_TESTS=${BUILD_TESTS} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DVERSION_SUFIX=${VERSION_SUFFIX} -DBUILD_NUMBER=${BUILD_NUMBER} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DBUILD_WITH_QT6="${USE_QT6}" -DUSE_SUBMODULE_KCOLORPICKER="${USE_SUBMODULE_KCOLORPICKER}" -DUSE_SUBMODULE_KIMAGEANNOTATOR="${USE_SUBMODULE_KIMAGEANNOTATOR}" "${EXTRA_CMAKE_ARGS[@]}"
${MAKE_BINARY}
