Embed Windows app icon via windres

This commit is contained in:
Stu Leak 2026-01-07 14:40:53 -05:00
parent 858c48cbb3
commit d30229dfae
4 changed files with 37 additions and 0 deletions

View File

@ -60,6 +60,19 @@ echo " Target: windows/amd64"
echo " Compiler: x86_64-w64-mingw32-gcc"
echo ""
# Generate Windows resource file for app icon (if windres is available)
RC_FILE="$PROJECT_ROOT/scripts/videotools.rc"
SYMBOL_FILE="$PROJECT_ROOT/videotools_windows_amd64.syso"
if [ -f "$RC_FILE" ]; then
if command -v x86_64-w64-mingw32-windres &> /dev/null; then
x86_64-w64-mingw32-windres "$RC_FILE" -O coff -o "$SYMBOL_FILE" || true
elif command -v windres &> /dev/null; then
windres "$RC_FILE" -O coff -o "$SYMBOL_FILE" || true
else
echo "WARNING: windres not found; Windows icon will not be embedded in the EXE"
fi
fi
# Set Windows build environment
export GOOS=windows
export GOARCH=amd64

View File

@ -174,6 +174,17 @@ if %ERRORLEVEL% neq 0 (
echo [OK] Dependencies downloaded
echo.
REM ----------------------------
REM Embed Windows icon (if windres is available)
REM ----------------------------
where windres >nul 2>&1
if %ERRORLEVEL% equ 0 (
windres scripts\videotools.rc -O coff -o videotools_windows_amd64.syso
) else (
echo [WARN] windres not found; Windows icon will not be embedded in the EXE
)
echo.
REM ----------------------------
REM Build VideoTools (Windows GUI mode)
REM Note: CGO is required for Fyne/OpenGL on Windows

View File

@ -56,6 +56,18 @@ Write-Host ""
Write-Host "🔨 Building VideoTools..." -ForegroundColor Yellow
Write-Host ""
# Embed Windows icon if windres is available
$rcFile = Join-Path $PROJECT_ROOT "scripts\videotools.rc"
$sysoFile = Join-Path $PROJECT_ROOT "videotools_windows_amd64.syso"
if (Test-Path $rcFile) {
$windres = Get-Command windres -ErrorAction SilentlyContinue
if ($windres) {
& $windres.Path $rcFile -O coff -o $sysoFile | Out-Null
} else {
Write-Host "⚠️ windres not found; Windows icon will not be embedded in the EXE" -ForegroundColor Yellow
}
}
# Fyne needs CGO for GLFW/OpenGL bindings
$env:CGO_ENABLED = "1"

1
scripts/videotools.rc Normal file
View File

@ -0,0 +1 @@
1 ICON "assets/logo/VT_Icon.ico"