@echo off
REM Build script for Word Search application (Windows)

echo =========================================
echo Word Search Application Builder
echo =========================================
echo.

REM Check if PyInstaller is installed
pyinstaller --version >nul 2>&1
if %errorlevel% neq 0 (
    echo PyInstaller not found. Installing dependencies...
    pip install -r requirements.txt
)

REM Clean previous builds
echo Cleaning previous builds...
if exist build rmdir /s /q build
if exist dist rmdir /s /q dist

echo Building for platform: Windows
echo.

REM Build the application
echo Running PyInstaller...
pyinstaller word_search.spec

REM Check if build was successful
if exist dist (
    echo.
    echo =========================================
    echo Build completed successfully!
    echo =========================================
    echo.
    echo Platform: Windows
    echo Output location: dist\
    echo Executable: dist\WordSearch.exe
    echo.
    echo To run: dist\WordSearch.exe
) else (
    echo.
    echo Build failed! Check the error messages above.
    exit /b 1
)
