#!/usr/bin/env bash

set -eu
set -o pipefail

mkdir -p cmake-build-release
cmake -S . -B cmake-build-release -DBUILD_GUI=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_ASAN=OFF

cd cmake-build-release
make clean
rm -fr kge.app*
make
zip -r kge.app.zip kge.app 
sha256sum kge.app.zip
open .
cd ..

# Qt build disabled — ImGui frontend is the primary GUI.
# mkdir -p cmake-build-release-qt
# cmake -S . -B cmake-build-release-qt -DBUILD_GUI=ON -DKTE_USE_QT=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_ASAN=OFF
#
# cd cmake-build-release-qt
# make clean
# rm -fr kge.app* kge-qt.app*
# make
# mv -f kge.app kge-qt.app
# macdeployqt kge-qt.app -always-overwrite -verbose=3
# cmake -DAPP_BUNDLE="$(pwd)/kge-qt.app" -P "${PWD%/*}/cmake/fix_bundle.cmake"
# zip -r kge-qt.app.zip kge-qt.app
# sha256sum kge-qt.app.zip
# open .
# cd ..
