#!/bin/bash set -e echo "=========================================" echo " RFCP Desktop Build (Windows)" echo " GPU-enabled ONEDIR build" echo "=========================================" cd "$(dirname "$0")/.." # 1. Build frontend echo "[1/4] Building frontend..." cd frontend npm ci npm run build cd .. # 2. Build backend with PyInstaller (GPU ONEDIR mode) echo "[2/4] Building backend (GPU)..." cd backend # Check CuPy is available if ! python -c "import cupy" 2>/dev/null; then echo "WARNING: CuPy not installed - GPU acceleration will not be available" echo " Install with: pip install cupy-cuda13x" fi python -m pip install -r requirements.txt python -m pip install pyinstaller # Build using GPU spec (ONEDIR output) python -m PyInstaller ../installer/rfcp-server-gpu.spec --clean --noconfirm # Copy ONEDIR folder to desktop staging area # Result: desktop/backend-dist/win/rfcp-server/rfcp-server.exe + _internal/ mkdir -p ../desktop/backend-dist/win rm -rf ../desktop/backend-dist/win/rfcp-server # Clean old build cp -r dist/rfcp-server ../desktop/backend-dist/win/rfcp-server echo " Backend copied to: desktop/backend-dist/win/rfcp-server/" ls -la ../desktop/backend-dist/win/rfcp-server/*.exe 2>/dev/null || true cd .. # 3. Build Electron app echo "[3/4] Building Electron app..." cd desktop npm ci npm run build:win cd .. # 4. Done echo "[4/4] Build complete!" echo "" echo "Output: desktop/dist/" ls -la desktop/dist/*.exe 2>/dev/null || echo "Build artifacts in desktop/dist/"