#!/bin/bash # Build and Run script for Beacon Tracker with Web Viewer # This script builds the C++ project and provides instructions to run echo "===================================" echo "Beacon Tracker - Build & Run" echo "===================================" echo "" # Navigate to beacon_track directory cd "$(dirname "$0")/beacon_track/build" || exit 1 echo "Building C++ project..." echo "" # Run CMake if needed if [ ! -f "Makefile" ]; then echo "Running CMake..." cmake .. || { echo "ERROR: CMake failed"; exit 1; } fi # Build the project echo "Compiling..." make || { echo "ERROR: Make failed"; exit 1; } echo "" echo "✓ Build successful!" echo "" echo "===================================" echo "How to run:" echo "===================================" echo "" echo "1. Start the beacon tracker (this terminal):" echo " cd $(pwd)" echo " ./main realtime output.txt" echo "" echo "2. Start the web viewer (new terminal):" echo " cd $(dirname "$0")/web_viewer" echo " ./start.sh" echo "" echo "3. Open browser:" echo " http://localhost:5000" echo "" echo "===================================" echo "" read -p "Start beacon tracker now? (y/N) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo "" echo "Starting beacon tracker..." echo "Press Ctrl+C to stop" echo "" ./main realtime output.txt fi