diff --git a/docs/BUILD_WINDOWS_STATIC.md b/docs/BUILD_WINDOWS_STATIC.md new file mode 100644 index 0000000..342618a --- /dev/null +++ b/docs/BUILD_WINDOWS_STATIC.md @@ -0,0 +1,63 @@ +# Static Build Configuration for Windows + +This configuration builds EU-Utility V3 as a single .exe file with all OCR libraries statically linked. + +## Prerequisites + +### 1. Install vcpkg + +```powershell +git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg +C:\vcpkg\bootstrap-vcpkg.bat +C:\vcpkg\vcpkg integrate install +``` + +### 2. Install Static Libraries + +```powershell +# Install Tesseract and dependencies as static libraries +C:\vcpkg\vcpkg install tesseract:x64-windows-static-md +C:\vcpkg\vcpkg install leptonica:x64-windows-static-md +C:\vcpkg\vcpkg install libpng:x64-windows-static-md +C:\vcpkg\vcpkg install tiff:x64-windows-static-md +C:\vcpkg\vcpkg install libjpeg-turbo:x64-windows-static-md +``` + +**Note:** This takes 30-60 minutes on first run. + +### 3. Set Environment Variables + +```powershell +$env:VCPKG_ROOT = "C:\vcpkg" +$env:VCPKGRS_DYNAMIC = "0" +``` + +## Building + +### Development Build +```powershell +npm run tauri-dev +``` + +### Production Build (Single .exe) +```powershell +npm run tauri-build +``` + +The output will be: +- `src-tauri/target/release/bundle/msi/*.msi` - Windows installer +- `src-tauri/target/release/eu-utility-v3.exe` - Standalone executable + +## Build Size + +- **Without OCR:** ~15MB +- **With OCR (static):** ~80-120MB + +## Distribution + +The .msi installer includes everything needed: +- Main application (single .exe) +- WebView2 runtime (if not present) +- Start menu shortcuts + +Users do not need to install Tesseract separately. diff --git a/scripts/build-windows-static.ps1 b/scripts/build-windows-static.ps1 new file mode 100644 index 0000000..3f64bec --- /dev/null +++ b/scripts/build-windows-static.ps1 @@ -0,0 +1,31 @@ +# Build script for Windows static linking +# Run this in PowerShell before building + +Write-Host "Setting up environment for static build..." -ForegroundColor Green + +# Set vcpkg environment +$env:VCPKG_ROOT = "C:\vcpkg" +$env:VCPKGRS_DYNAMIC = "0" + +# Verify vcpkg is installed +if (-not (Test-Path "C:\vcpkg\vcpkg.exe")) { + Write-Host "vcpkg not found at C:\vcpkg" -ForegroundColor Red + Write-Host "Install with:" -ForegroundColor Yellow + Write-Host " git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg" -ForegroundColor Cyan + Write-Host " C:\vcpkg\bootstrap-vcpkg.bat" -ForegroundColor Cyan + exit 1 +} + +# Check for static libraries +$libs = @("tesseract", "leptonica") +foreach ($lib in $libs) { + $installed = C:\vcpkg\vcpkg list | Select-String $lib + if (-not $installed) { + Write-Host "$lib not installed. Installing..." -ForegroundColor Yellow + Write-Host "This may take 30+ minutes..." -ForegroundColor Yellow + C:\vcpkg\vcpkg install "${lib}:x64-windows-static-md" + } +} + +Write-Host "Environment configured for static build!" -ForegroundColor Green +Write-Host "Run: npm run tauri-build" -ForegroundColor Cyan diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index e79c28e..c63dbd6 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -47,10 +47,10 @@ uuid = { version = "1.6", features = ["v4", "serde"] } # Regex regex = "1.10" -# Image processing for OCR +# Image processing for OCR - static linking for distribution image = "0.24" imageproc = "0.23" -leptess = "0.14" +leptess = { version = "0.14", features = ["static"] } # Clipboard arboard = "3.3"