Files
cutThenThink/build.bat

68 lines
1.9 KiB
Batchfile
Raw Normal View History

@echo off
REM ================================
REM CutThenThink Windows Build Script
REM ================================
REM Change to project directory
cd /d "%~dp0"
REM Check Python and install PyInstaller if needed
echo Checking Python...
python --version 2>nul
if errorlevel 1 (
echo Python not found. Please install Python 3.8+
pause
exit /b 1
)
echo.
python -m pip list 2>nul 2>&1 | findstr /I "PyInstaller" /I "install"
if errorlevel 1 (
echo PyInstaller not found, installing now...
python -m pip install --user pyinstaller
echo.
echo NOTE: This may take a minute...
)
python -m pip list 2>nul 2>&1 | findstr /I "PyInstaller" /I "installed"
echo.
echo If PyInstaller is installed, will proceed with build.
)
REM Check PyQt6 availability
python -c "import PyQt6.QtCore" 2>nul 2>&1
if errorlevel 1 (
echo.
echo PyQt6 Core not available, will install now...
python -m pip install --user pyqt6-core
echo.
)
)
REM Install all required dependencies
echo Installing all dependencies...
python -m pip install --user pyqt6-gui 2>nul
python -m pip install --user sqlalchemy 2>nul
python -m pip install --user pyyaml 2>nul
python -m pip install --user requests 2>nul
python -m pip install --user pillow 2>nul
python -m pip install --user pyperclip 2>nul
echo.
echo 3/5. Building lightweight version...
python -m PyInstaller --noconfirm --name "CutThenThink" --windowed --onefile --add-data "src:src" --hidden-import=PyQt6.QtCore --hidden-import=PyQt6.QtGui --hidden-import=PyQt6.QtWidgets --hidden-import=sqlalchemy src/main.py
if errorlevel 1 (
echo Build Failed!
pause
exit /b 1
)
echo ================================
echo Build Complete!
echo Executable: dist\CutThenThink.exe
echo File size (without PaddleOCR): ~30-50 MB
echo ================================
echo.
echo On first run, app will auto-download and install PaddleOCR.
echo.
pause