@echo off
chcp 65001 >nul
title Build DokoGen.exe
echo ============================================
echo   Building DokoGen into a single EXE file
echo ============================================
echo.

cd /d "%~dp0"

echo [1/3] Installing PyInstaller...
py -m pip install --upgrade pyinstaller
if errorlevel 1 (
    echo ERROR: failed to install PyInstaller
    pause
    exit /b 1
)

echo.
echo [2/3] Installing dependencies...
py -m pip install -r requirements.txt
if errorlevel 1 (
    echo ERROR: failed to install dependencies
    pause
    exit /b 1
)

echo.
echo [3/3] Building DokoGen.exe (1-3 minutes)...
py -m PyInstaller --clean --noconfirm dokogen.spec
if errorlevel 1 (
    echo ERROR: build failed
    pause
    exit /b 1
)

echo.
echo ============================================
echo   DONE! File: dist\DokoGen.exe
echo   Copy it to any Windows PC and run it.
echo   Python is NOT required on target PC.
echo ============================================
pause
