Repository navigation
Generate a real .icns for the macOS bundle - #86
Merged
Merged
Conversation
gen_icon now writes either container, picked from the output extension: the existing multi-size .ico, or an .icns with PNG representations for 16-1024 px (icp4/5/6, ic07-ic10, @2x ic11-ic14). The PNG/deflate writer is self-contained so the generator still builds with the bare host compiler on every platform. make macos drops the unused logo.ico from the portable directory and ships build/AppIcon.icns instead; macos_bundle.sh already copies the portable contents into Contents/Resources, so the icon now lands over CFBundleIconFile=AppIcon from source rather than a committed binary. The committed bundle/Contents/Resources/AppIcon.icns is removed: it was never reached by macos_bundle.sh after this change and would only drift from logo_raster.h. Closes #85
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.
Implements the second option in #85: the macOS icon is now generated from
src/ui/logo_raster.hinstead of being a committed binary, and the dead.icocopy is gone.What changed
scripts/gen_icon.cpppicks the container from the output extension and writes either the existing multi-size.icoor a real.icnswith PNG representations for every slot macOS 10.7+ reads:icp4/icp5/icp6,ic07-ic10(16, 32, 64, 128, 256, 512, 1024) plus the@2xslotsic11-ic14. The PNG encoder and its fixed-Huffman deflate are ~180 lines of self-contained C++ so the generator still builds with the bare host compiler (HOST_CXX, no zlib, no image library) on every platform we cross-compile from.Makefile: the generator is its own rule now, sobuild/logo.icoandbuild/AppIcon.icnsare separate outputs.make macosdepends on the.icns, ships it in the portable directory asAppIcon.icns, and no longer copieslogo.ico.macos_bundle.shfails early with a clear message if the portable directory has noAppIcon.icns. It already copies the portable contents intoContents/Resources/, so the generated icon lands overCFBundleIconFile=AppIconwith no extra step.bundle/Contents/Resources/AppIcon.icnsdeleted (363 KB): after the above it is unreachable and would silently drift from the rasterizer. The repo now has one source for the icon, as the.gitignorerule forbuild/logo.icoalready intended.Contents/Resources/AppIcon.icnsexists.How it was verified (Linux host, since no macOS runner here)
.ico370 070 bytes / 6 sizes,.icns193 410 bytes / 11 representations, 0.27 s, and the.icnsheader length matches the file size exactly.zlib+ Pillow, two independent PNG implementations) and is byte-identical tologo_raster::Render()output at the same pixel size — so the icon really is the app's own logo, not an approximation.macos_bundle.shend-to-end against a stub portable directory:TLEscope.app/Contents/{MacOS,Resources}correct, generated 193 KBAppIcon.icnsinResources/,Info.plistuntouched. Negative case (no.icns) exits 1 withMissing app icon: ... (run: make macos).make build/logo.icostill works.Not verified: an actual macOS build and Finder/Dock rendering — that needs the CI macOS runners on this PR.