#!/usr/bin/env bash set -euo pipefail cd "$(dirname "$0")" print_qt_install_hint() { echo echo "Qt6 bulunamadi. macOS'ta gerekli paketleri kurmak icin:" echo " brew install cmake qt" echo "veya dogrudan: ./setup-macos.sh" } if [[ "$(uname -s)" != "Darwin" ]]; then echo "Bu calistirma betigi macOS icindir." >&2 exit 1 fi project_dir="$(pwd -P)" if [[ -f ./build/CMakeCache.txt ]]; then cached_source="$(sed -n 's/^CMAKE_HOME_DIRECTORY:INTERNAL=//p' ./build/CMakeCache.txt)" if [[ -n "$cached_source" && "$cached_source" != "$project_dir" ]]; then echo "Build klasoru farkli bir proje yoluna ait. 'macos/build' klasorunu silip tekrar deneyin." >&2 exit 1 fi fi cmake_args=(-S . -B build) if command -v brew >/dev/null 2>&1; then cmake_args+=("-DCMAKE_PREFIX_PATH=$(brew --prefix qt)") fi if ! cmake "${cmake_args[@]}"; then print_qt_install_hint exit 1 fi cmake --build build exec ./build/location_plotter.app/Contents/MacOS/location_plotter "$@"