robjones90

build.sh

Aug 24th, 2025
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.12 KB | None | 0 0
  1. #!/bin/bash
  2. set -euo pipefail
  3.  
  4. BUILD_DIR="build-macos"
  5. CMAKE_BUILD_TYPE="Release"
  6.  
  7. # Detect Homebrew prefix (on Apple Silicon it's /opt/homebrew, on Intel it's /usr/local)
  8. BREW_PREFIX=$(brew --prefix)
  9.  
  10. echo "[INFO] Building PocketMage Desktop Emulator for macOS"
  11. echo "[INFO] Using Homebrew prefix: $BREW_PREFIX"
  12.  
  13. echo "[INFO] Checking dependencies..."
  14. if ! brew list --versions sdl2 >/dev/null 2>&1; then
  15.   echo "[ERROR] SDL2 not installed. Run: brew install sdl2"
  16.   exit 1
  17. fi
  18. if ! brew list --versions sdl2_ttf >/dev/null 2>&1; then
  19.   echo "[ERROR] SDL2_ttf not installed. Run: brew install sdl2_ttf"
  20.   exit 1
  21. fi
  22. echo "[SUCCESS] SDL2 and SDL2_ttf found via Homebrew"
  23.  
  24. echo "[INFO] Creating build directory: $BUILD_DIR"
  25. mkdir -p "$BUILD_DIR"
  26.  
  27. echo "[INFO] Configuring build with CMake..."
  28. cmake -S . -B "$BUILD_DIR" \
  29.   -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
  30.   -DCMAKE_PREFIX_PATH="$BREW_PREFIX"
  31.  
  32. echo "[INFO] Building project..."
  33. cmake --build "$BUILD_DIR" --config "$CMAKE_BUILD_TYPE" -j$(sysctl -n hw.ncpu)
  34.  
  35. echo "[SUCCESS] Build completed"
  36. echo "[INFO] Executable: $BUILD_DIR/PocketMage_Desktop_Emulator"
  37.  
Advertisement
Add Comment
Please, Sign In to add comment