From bf2ec70ffe159e9cae83ba1f0a02612520c3bd20 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Wed, 7 Jan 2026 14:40:53 -0500 Subject: [PATCH] Embed Windows app icon via windres --- scripts/build-windows.sh | 13 +++++++++++++ scripts/build.bat | 11 +++++++++++ scripts/build.ps1 | 12 ++++++++++++ scripts/videotools.rc | 1 + 4 files changed, 37 insertions(+) create mode 100644 scripts/videotools.rc diff --git a/scripts/build-windows.sh b/scripts/build-windows.sh index 962594a..d68ba0b 100755 --- a/scripts/build-windows.sh +++ b/scripts/build-windows.sh @@ -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 diff --git a/scripts/build.bat b/scripts/build.bat index e5015df..08013b1 100644 --- a/scripts/build.bat +++ b/scripts/build.bat @@ -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 diff --git a/scripts/build.ps1 b/scripts/build.ps1 index f712861..18076f4 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -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" diff --git a/scripts/videotools.rc b/scripts/videotools.rc new file mode 100644 index 0000000..0a51aae --- /dev/null +++ b/scripts/videotools.rc @@ -0,0 +1 @@ +1 ICON "assets/logo/VT_Icon.ico"