#!/bin/bash -e

BUILD_DIR=build

#NOTE: the PROJECT_VERSION is a dummy placeholder just for local builds
if [ ! -d "$BUILD_DIR" ]; then
  cmake -B$BUILD_DIR -S. -GNinja \
    -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_CXX_FLAGS="-Wall -Wextra" \
    -DCMAKE_PREFIX_PATH="$HOME/Qt/6.8.3/macos" \
    -DCMAKE_COLOR_DIAGNOSTICS=ON \
    -DCMAKE_CXX_FLAGS_INIT="-DQT_QML_DEBUG" \
    -DCMAKE_OSX_ARCHITECTURES="arm64"
fi

cmake --build $BUILD_DIR --target all

$BUILD_DIR/Gallery.app/Contents/MacOS/Gallery
