@echo off
setlocal

echo === Activating virtual environment ===
call venv310\Scripts\activate.bat
if errorlevel 1 (
    echo [ERROR] Failed to activate virtual environment!
    pause
    exit /b 1
)

echo === Installing PyInstaller (if not present) ===
pip show pyinstaller >nul 2>&1
if errorlevel 1 (
    echo Installing PyInstaller...
    pip install pyinstaller
) else (
    echo PyInstaller already installed.
)

echo === Building win_udp_listener.exe ===
pyinstaller --noconsole --onefile win_udp_listener.py

echo.
echo === Build complete! Check the dist\ directory. ===
pause
