diff --git a/scripts/build-windows.sh b/scripts/build-windows.sh index d68ba0b..40bbff8 100755 --- a/scripts/build-windows.sh +++ b/scripts/build-windows.sh @@ -71,6 +71,9 @@ if [ -f "$RC_FILE" ]; then else echo "WARNING: windres not found; Windows icon will not be embedded in the EXE" fi + if [ ! -f "$SYMBOL_FILE" ]; then + echo "WARNING: windres did not produce $SYMBOL_FILE; icon may be missing" + fi fi # Set Windows build environment diff --git a/scripts/build.bat b/scripts/build.bat index 08013b1..fd62e37 100644 --- a/scripts/build.bat +++ b/scripts/build.bat @@ -177,9 +177,23 @@ echo. REM ---------------------------- REM Embed Windows icon (if windres is available) REM ---------------------------- +set WINDRES_PATH= where windres >nul 2>&1 if %ERRORLEVEL% equ 0 ( - windres scripts\videotools.rc -O coff -o videotools_windows_amd64.syso + for /f "delims=" %%I in ('where windres') do set WINDRES_PATH=%%I +) else if exist "C:\msys64\mingw64\bin\windres.exe" ( + set WINDRES_PATH=C:\msys64\mingw64\bin\windres.exe +) else if exist "C:\msys64\usr\bin\windres.exe" ( + set WINDRES_PATH=C:\msys64\usr\bin\windres.exe +) else if exist "C:\MinGW\bin\windres.exe" ( + set WINDRES_PATH=C:\MinGW\bin\windres.exe +) + +if not "%WINDRES_PATH%"=="" ( + "%WINDRES_PATH%" scripts\videotools.rc -O coff -o videotools_windows_amd64.syso + if not exist videotools_windows_amd64.syso ( + echo [WARN] windres did not produce videotools_windows_amd64.syso; icon may be missing + ) ) else ( echo [WARN] windres not found; Windows icon will not be embedded in the EXE ) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 18076f4..3d05e49 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -60,9 +60,22 @@ Write-Host "" $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 + $windresCandidates = @() + $windresCmd = Get-Command windres -ErrorAction SilentlyContinue + if ($windresCmd) { + $windresCandidates += $windresCmd.Path + } + $windresCandidates += @( + "C:\msys64\mingw64\bin\windres.exe", + "C:\msys64\usr\bin\windres.exe", + "C:\MinGW\bin\windres.exe" + ) + $windresPath = $windresCandidates | Where-Object { $_ -and (Test-Path $_) } | Select-Object -First 1 + if ($windresPath) { + & $windresPath $rcFile -O coff -o $sysoFile | Out-Null + if (-not (Test-Path $sysoFile)) { + Write-Host "⚠️ windres did not produce $sysoFile; icon may be missing" -ForegroundColor Yellow + } } else { Write-Host "⚠️ windres not found; Windows icon will not be embedded in the EXE" -ForegroundColor Yellow }