Configure static linking for Windows - single .exe distribution with OCR

This commit is contained in:
Aether 2026-02-23 20:12:46 +00:00
parent fe6b8066ff
commit 74d95cba39
No known key found for this signature in database
GPG Key ID: 95AFEE837E39AFD2
3 changed files with 96 additions and 2 deletions

View File

@ -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.

View File

@ -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

View File

@ -47,10 +47,10 @@ uuid = { version = "1.6", features = ["v4", "serde"] }
# Regex # Regex
regex = "1.10" regex = "1.10"
# Image processing for OCR # Image processing for OCR - static linking for distribution
image = "0.24" image = "0.24"
imageproc = "0.23" imageproc = "0.23"
leptess = "0.14" leptess = { version = "0.14", features = ["static"] }
# Clipboard # Clipboard
arboard = "3.3" arboard = "3.3"