build_ble_relay.bat 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. @echo off
  2. setlocal
  3. echo === BLE Relay Build Script ===
  4. echo.
  5. REM Check Python
  6. where python >nul 2>nul
  7. if %errorlevel% neq 0 (
  8. echo ERROR: Python not found. Please install Python 3 and add to PATH.
  9. exit /b 1
  10. )
  11. REM Install dependencies
  12. echo Installing dependencies...
  13. python -m pip install pyinstaller bleak
  14. if %errorlevel% neq 0 (
  15. echo ERROR: Failed to install dependencies.
  16. exit /b 1
  17. )
  18. REM Create output dir
  19. if not exist bin mkdir bin
  20. REM Build
  21. echo.
  22. echo Building ble_relay.exe...
  23. python -m PyInstaller --onefile --name ble_relay --distpath bin --specpath build --workpath build scripts\ble_relay.py
  24. if %errorlevel% neq 0 (
  25. echo ERROR: PyInstaller build failed.
  26. exit /b 1
  27. )
  28. REM Copy to cmd/monitor for go:embed
  29. echo.
  30. echo Copying to cmd/monitor/ for embedding...
  31. copy /Y bin\ble_relay.exe cmd\monitor\ble_relay.exe >nul
  32. if %errorlevel% neq 0 (
  33. echo ERROR: Failed to copy ble_relay.exe
  34. exit /b 1
  35. )
  36. echo.
  37. echo === Build complete ===
  38. echo bin\ble_relay.exe
  39. echo cmd\monitor\ble_relay.exe
  40. echo.
  41. echo Now run: go build -tags ble -o bin\opencode-monitor.exe .\cmd\monitor
  42. endlocal