From 598faac7ef16e58a91454291428972fb194d5039 Mon Sep 17 00:00:00 2001 From: ilya-fedin Date: Sun, 25 Jul 2021 18:19:40 +0000 Subject: [PATCH] Generate icns file with cmake (#201) --- Telegram/CMakeLists.txt | 17 ++++++++++++++--- Telegram/Telegram.plist.in | 6 +++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index d29dc9b87..211753337 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -1281,9 +1281,20 @@ elseif (APPLE) target_link_libraries(Telegram PRIVATE desktop-app::external_iconv) endif() - set(icons_path ${CMAKE_CURRENT_SOURCE_DIR}/Telegram/Images.xcassets) - set_target_properties(Telegram PROPERTIES RESOURCE ${icons_path}) - target_sources(Telegram PRIVATE ${icons_path}) + set(appicon_path ${CMAKE_CURRENT_SOURCE_DIR}/Telegram/Images.xcassets/Icon.iconset) + + add_custom_command( + OUTPUT AppIcon.icns + COMMAND iconutil + ARGS + --convert icns + --output AppIcon.icns + ${appicon_path} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + set_source_files_properties(AppIcon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + target_sources(Telegram PRIVATE AppIcon.icns) set(lang_packs en diff --git a/Telegram/Telegram.plist.in b/Telegram/Telegram.plist.in index f9ed6212a..5e67416b7 100644 --- a/Telegram/Telegram.plist.in +++ b/Telegram/Telegram.plist.in @@ -6,6 +6,10 @@ @output_name@ CFBundleGetInfoString Telegram Desktop messaging app + CFBundleIconFile + AppIcon + CFBundleIconName + AppIcon CFBundleIdentifier @bundle_identifier@ CFBundlePackageType @@ -20,7 +24,7 @@ CFBundleTypeRole Viewer CFBundleURLIconFile - Icon.icns + AppIcon CFBundleURLName @bundle_identifier@ CFBundleURLSchemes