From 5884160db62f32bed91f8449c4ca1204b8ba5dbd Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 7 Jan 2015 13:49:52 +0100 Subject: [PATCH] iOS: add AppIcon asset name to Xcode project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current work-flow for adding app icons to an iOS app during deployment is not good. You basically need to specify that you want to use asset catalogs from within Xcode and add your icons there. The problem is that qmake will regenerate the Xcode project the next time it runs, and your changes will then be lost. This patch will check if the project has a valid asset catalog assigned to QMAKE_BUNDLE_DATA, and configure the Xcode project to use it for app icons. Change-Id: I06621ca46aad91de96cb23ba8ca3b1a3f1226670 Reviewed-by: Tor Arne Vestbø --- mkspecs/macx-ios-clang/features/default_post.prf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf index aa849eb8b1..f1f23dd716 100644 --- a/mkspecs/macx-ios-clang/features/default_post.prf +++ b/mkspecs/macx-ios-clang/features/default_post.prf @@ -174,6 +174,21 @@ macx-xcode { ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY QMAKE_MAC_XCODE_SETTINGS += ios_device_family + # If QMAKE_BUNDLE_DATA contains an asset catalog that includes an + # AppIcon.appiconset, we configure Xcode to use it for app icons. + for(bundle_data, QMAKE_BUNDLE_DATA) { + for(bundle_file, $${bundle_data}.files) { + !contains(bundle_file, .*\.xcassets$): next() + !exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next() + + asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME" + asset_catalog_appicon.value = "AppIcon" + QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon + break() + } + !isEmpty(asset_catalog_appicon.name): break() + } + # Set up default 4-inch iPhone/iPod launch image so that our apps # support the full screen resolution of those devices. launch_image = Default-568h@2x.png