Add support for building iconset and plist without Xcode

This commit is contained in:
Ilya Fedin 2023-11-02 03:05:46 +04:00 committed by John Preston
parent 0f45abd534
commit 6db4b8821e
2 changed files with 54 additions and 8 deletions

View file

@ -1540,7 +1540,39 @@ elseif (APPLE)
endif() endif()
set(icons_path ${CMAKE_CURRENT_SOURCE_DIR}/Telegram/Images.xcassets) set(icons_path ${CMAKE_CURRENT_SOURCE_DIR}/Telegram/Images.xcassets)
target_add_resource(Telegram ${icons_path}) if (CMAKE_GENERATOR STREQUAL Xcode)
target_add_resource(Telegram ${icons_path})
else()
set(icon_path ${icons_path}/Icon.iconset)
find_program(ICONUTIL iconutil)
find_program(PNG2ICNS png2icns)
if (ICONUTIL)
add_custom_command(
OUTPUT Icon.icns
COMMAND ${ICONUTIL}
ARGS
--convert icns
--output Icon.icns
${icon_path}
)
elseif (PNG2ICNS)
add_custom_command(
OUTPUT Icon.icns
COMMAND ${PNG2ICNS}
ARGS
Icon.icns
${icon_path}/icon_16x16.png
${icon_path}/icon_32x32.png
${icon_path}/icon_128x128.png
${icon_path}/icon_256x256.png
${icon_path}/icon_512x512.png
)
endif()
if (ICONUTIL OR PNG2ICNS)
set_source_files_properties(Icon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
target_add_resource(Telegram Icon.icns)
endif()
endif()
set(lang_packs set(lang_packs
en en
@ -1633,7 +1665,11 @@ if (build_macstore)
COMMAND rm -rf $<TARGET_FILE_DIR:Telegram>/../Frameworks/Breakpad.framework/Resources/Inspector COMMAND rm -rf $<TARGET_FILE_DIR:Telegram>/../Frameworks/Breakpad.framework/Resources/Inspector
) )
else() else()
set(bundle_identifier "com.tdesktop.Telegram$<$<CONFIG:Debug>:Debug>") if (CMAKE_GENERATOR STREQUAL Xcode)
set(bundle_identifier "com.tdesktop.Telegram$<$<CONFIG:Debug>:Debug>")
else()
set(bundle_identifier "com.tdesktop.Telegram")
endif()
set(bundle_entitlements "Telegram.entitlements") set(bundle_entitlements "Telegram.entitlements")
if (LINUX AND DESKTOP_APP_USE_PACKAGED) if (LINUX AND DESKTOP_APP_USE_PACKAGED)
set(output_name "telegram-desktop") set(output_name "telegram-desktop")
@ -1642,6 +1678,12 @@ else()
endif() endif()
endif() endif()
if (CMAKE_GENERATOR STREQUAL Xcode)
set(bundle_identifier_plist "$(PRODUCT_BUNDLE_IDENTIFIER)")
else()
set(bundle_identifier_plist ${bundle_identifier})
endif()
set_target_properties(Telegram PROPERTIES set_target_properties(Telegram PROPERTIES
OUTPUT_NAME ${output_name} OUTPUT_NAME ${output_name}
MACOSX_BUNDLE_GUI_IDENTIFIER ${bundle_identifier} MACOSX_BUNDLE_GUI_IDENTIFIER ${bundle_identifier}

View file

@ -3,15 +3,19 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(PRODUCT_NAME)</string> <string>@output_name@</string>
<key>CFBundleGetInfoString</key> <key>CFBundleGetInfoString</key>
<string>Telegram Desktop messaging app</string> <string>Telegram Desktop messaging app</string>
<key>CFBundleIconFile</key>
<string>Icon.icns</string>
<key>CFBundleIconName</key>
<string>Icon.icns</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <string>@bundle_identifier_plist@</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>@desktop_app_version_string@</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@ -22,7 +26,7 @@
<key>CFBundleURLIconFile</key> <key>CFBundleURLIconFile</key>
<string>Icon.icns</string> <string>Icon.icns</string>
<key>CFBundleURLName</key> <key>CFBundleURLName</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <string>@bundle_identifier_plist@</string>
<key>CFBundleURLSchemes</key> <key>CFBundleURLSchemes</key>
<array> <array>
<string>tg</string> <string>tg</string>
@ -30,13 +34,13 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>@desktop_app_version_string@</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.social-networking</string> <string>public.app-category.social-networking</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>@CMAKE_OSX_DEPLOYMENT_TARGET@</string>
<key>LSFileQuarantineEnabled</key> <key>LSFileQuarantineEnabled</key>
<true/> <true/>
<key>NOTE</key> <key>NOTE</key>