fix: restore application icon and suppress console window on Windows#354
Merged
spe-ciellt merged 1 commit intogerbv:developfrom Mar 5, 2026
Merged
Conversation
The CMake build was missing two things that the old autotools build had for Windows: 1. The Windows resource file (gerbv.rc) was not compiled into the executable, so the application icon was missing — Windows showed the default GTK icon instead. Add gerbv.rc to the gerbv-app target sources and update the icon path to reference the existing desktop/gerbv_icon.ico. 2. The -mwindows linker flag was not set, so Windows always created a console window for the process. The existing attach_console_for_win() function in main.c handles re-attaching to the parent console when launched from a terminal, but it requires -mwindows to suppress the default console. Ref gerbv#333
This was referenced Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two regressions in the Windows build introduced by the autotools-to-CMake migration.
1. Missing application icon
The Windows resource file
src/gerbv.rcwas not being compiled into the executable. The old autotools build usedWINDRESto compile it and link the resulting object, but the CMake build never added it to the target sources.Fix: Add
gerbv.rctogerbv-appsources when building for Windows. Updated the.rcfile to use the correct relative path todesktop/gerbv_icon.ico.2. Unwanted console window
The
-mwindowslinker flag was not set in the CMake build. Without it, Windows creates a console window for every process. The existingattach_console_for_win()function inmain.cwas written assuming-mwindowsis active — it re-attaches to the parent console when gerbv is launched from a terminal, but that only works when the default console is suppressed.Fix: Add
-mwindowsto the linker options forgerbv-appon Windows.Changes
src/CMakeLists.txt— AddWIN32block withtarget_sourcesfor the.rcfile andtarget_link_optionsfor-mwindowssrc/gerbv.rc— Update icon path fromgerbv_icon.icoto../desktop/gerbv_icon.icoRef #333