From 592a6926afddda7b546589602e792202a8563d26 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Mon, 20 Jul 2026 05:06:51 +0000 Subject: [PATCH 58/71] feat(macos): bundle icon (reuse contour's .icns for the dock icon) The CONTOUR_MACOS_BUNDLE path already builds a real Contour.app (dock icon + Finder launch) but had no icon, so it showed the generic app icon. Wire in contour's existing multi-resolution src/contour/res/images/contour-logo.icns: add it as a bundle resource (MACOSX_PACKAGE_LOCATION Resources) and name it via MACOSX_BUNDLE_ICON_FILE (CFBundleIconFile). CMake copies it into Contents/Resources; it is a resource, not a source, so it is not compiled or linked and is compatible with both the default OBJCXX and the gcc-4.2 custom-object build paths for `contour`. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01AeG2jwYMX5gdvvtUnx3PJa --- src/contour_macos/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/contour_macos/CMakeLists.txt b/src/contour_macos/CMakeLists.txt index 77331047..0682bc16 100644 --- a/src/contour_macos/CMakeLists.txt +++ b/src/contour_macos/CMakeLists.txt @@ -176,12 +176,21 @@ Empty = use the modern default OBJCXX compiler.") # harfbuzz, fontconfig, libunicode, yaml-cpp, ...) into Contents/Frameworks and rewrite # load paths to @executable_path-relative, so the app runs with MacPorts deactivated. # System frameworks (AppKit/Foundation/ApplicationServices) are left as-is. + + # Dock/Finder icon: reuse contour's existing multi-resolution .icns. Adding it as a bundle + # resource with the MACOSX_PACKAGE_LOCATION Resources property makes CMake copy it into + # Contents/Resources; MACOSX_BUNDLE_ICON_FILE names it in Info.plist (CFBundleIconFile). + set(_bundle_icon "${PROJECT_SOURCE_DIR}/src/contour/res/images/contour-logo.icns") + set_source_files_properties("${_bundle_icon}" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") + target_sources(contour PRIVATE "${_bundle_icon}") + set_target_properties(contour PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_BUNDLE_NAME "Contour" MACOSX_BUNDLE_GUI_IDENTIFIER "org.contourterminal.Contour" MACOSX_BUNDLE_BUNDLE_VERSION "${CONTOUR_VERSION_STRING}" MACOSX_BUNDLE_SHORT_VERSION_STRING "${CONTOUR_VERSION}" + MACOSX_BUNDLE_ICON_FILE "contour-logo.icns" INSTALL_RPATH "@executable_path/../Frameworks") install(TARGETS contour BUNDLE DESTINATION ".")