CMake: Update the ios assets manual test

- provide an asset catalog .json file for both Xcode 13 and 14
  formats. Apps built against the Xcode 13 SDK are not validated
  anymore by the App store, but it's still useful to see how things
  were before.

- Xcode 13 required the following icon sizes for a universal iOS app:
   60x60@2x, 76x76@2x\~ipad, 167x167, 1024x1024

- Xcode 14 only needs the 1024x1024 one

- icons need to be embedded into the asset catalog starting with iOS
  11 according to Apple docs (not sure which Xcode version, but it's
  needed for both Xcode 13 and Xcode 14), and they don't have to
  manually be copied into the bundle anymore, Xcode takes care of
  that when processing the asset catalog

- add an 167x167 icon image for the iPad pro for Xcode 13

- add an 1024x1024 icon image that is required for successful app store
  submission and embed it into the asset catalogs

- for Xcode 13, we need to manually specify all the required icon
  sizes

- for Xcode 14 we can rely on Xcode to generate the smaller icons from
  the big one

- because the icons need to live in the asset catalog folder, remove
  unnecessary icons in the appicons folder.

- for the cmake project, make sure the asset catalog compiler generates
  the icons by setting the
  XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME attribute
  qmake does automatically already.
  it would be nice if we can do that automatically in a future Qt
  version

- remove unused icon references in Info.plist file with Xcode 13

- remove all icon references in Info.plist with Xcode 14, rely on Xcode
  to add that info via its generated partial Info.plist file that gets
  merged into the main one.

- don't include CMakeLists.txt as a text resource

Amends cf3535fdf2

Pick-to: 6.5 6.6
Task-number: QTBUG-104519
Task-number: QTBUG-110921
Task-number: QTBUG-116784
Change-Id: I0bc556e66647a66bc21402ea62db3374d0970e97
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2023-09-11 19:15:29 +02:00
parent 370962315a
commit bf2587d9e5
37 changed files with 275 additions and 61 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -31,6 +31,7 @@
"size" : "40x40"
},
{
"filename" : "AppIcon60x60@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
@ -76,16 +77,19 @@
"size" : "76x76"
},
{
"filename" : "AppIcon76x76@2x~ipad.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "AppIcon167x167.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "AppIcon1024x1024.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"

View File

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 173 B

View File

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 407 B

View File

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,104 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "38x38"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "38x38"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "64x64"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "64x64"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "68x68"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "AppIcon1024x1024.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Face-16.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Face-32.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Face-48.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

View File

@ -22,12 +22,20 @@ target_link_libraries(tst_manual_ios_assets PRIVATE
)
# Custom Info.plist
set_target_properties(tst_manual_ios_assets
PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.ios.cmake.plist")
if(IOS)
if(XCODE_VERSION AND XCODE_VERSION VERSION_LESS "14")
set(plist_path "${CMAKE_CURRENT_SOURCE_DIR}/Info.ios.cmake.xcode.13.0.plist")
else()
set(plist_path "${CMAKE_CURRENT_SOURCE_DIR}/Info.ios.cmake.xcode.14.3.plist")
endif()
set_target_properties(tst_manual_ios_assets
PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${plist_path}")
endif()
# Custom resources
file(GLOB_RECURSE text_files CONFIGURE_DEPENDS "*.txt")
if(text_files)
list(FILTER text_files EXCLUDE REGEX CMakeLists.txt)
target_sources(tst_manual_ios_assets PRIVATE ${text_files})
# On iOS the 'Resources' prefix is removed by Xcode because on iOS app bundles are shallow,
# so the final location of the text file will be
@ -40,22 +48,36 @@ if(text_files)
endif()
# App icons
file(GLOB_RECURSE app_icons CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/appicon/AppIcon*.png")
if(IOS AND app_icons)
target_sources(tst_manual_ios_assets PRIVATE ${app_icons})
set_source_files_properties(
${app_icons}
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
endif()
# https://developer.apple.com/library/archive/qa/qa1686/_index.html
# https://help.apple.com/xcode/mac/current/#/dev10510b1f7
# https://web.archive.org/web/20180124234409/https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/
# https://doc.qt.io/qt-6/ios-platform-notes.html#icons
# No need to copy the icons into the bundle manually when using Xcode 13+.
# - rely on Xcode 13 to copy the needed icon files that are specified in the asset catalog (all the
# required ones should be specified manually)
# - rely on Xcode 14 to generate the needed icon files based on the 1024x1024 sized image in the
# asset catalog
# Asset catalog with images
# Asset catalog with images and icons.
if(IOS)
enable_language(OBJCXX)
set(asset_catalog_path "${CMAKE_CURRENT_SOURCE_DIR}/Assets.xcassets")
if(XCODE_VERSION AND XCODE_VERSION VERSION_LESS "14")
set(asset_catalog_path "${CMAKE_CURRENT_SOURCE_DIR}/AssetsXcode13.0.xcassets")
else()
set(asset_catalog_path "${CMAKE_CURRENT_SOURCE_DIR}/AssetsXcode14.3.xcassets")
endif()
target_sources(tst_manual_ios_assets PRIVATE "${asset_catalog_path}")
set_source_files_properties(
${asset_catalog_path}
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# Make sure asset catalog compilation generates the needed app icons image sizes.
# This might not be needed in a future Qt version where qt_add_executable might do it
# automatically. Unclear how to do it cleanly though, because specifying the option when
# the asset catalog doesn't have an AppIcon set will cause a build failure.
set_target_properties(tst_manual_ios_assets PROPERTIES
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon)
target_sources(tst_manual_ios_assets PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/utils.mm")
endif()

View File

@ -57,11 +57,6 @@
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon29x29.png</string>
<string>AppIcon29x29@2x.png</string>
<string>AppIcon40x40@2x.png</string>
<string>AppIcon57x57.png</string>
<string>AppIcon57x57@2x.png</string>
<string>AppIcon60x60@2x.png</string>
</array>
<key>CFBundleIconName</key>
@ -74,21 +69,6 @@
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon29x29.png</string>
<string>AppIcon29x29@2x.png</string>
<string>AppIcon40x40@2x.png</string>
<string>AppIcon57x57.png</string>
<string>AppIcon57x57@2x.png</string>
<string>AppIcon60x60@2x.png</string>
<string>AppIcon29x29~ipad.png</string>
<string>AppIcon29x29@2x~ipad.png</string>
<string>AppIcon40x40~ipad.png</string>
<string>AppIcon40x40@2x~ipad.png</string>
<string>AppIcon50x50~ipad.png</string>
<string>AppIcon50x50@2x~ipad.png</string>
<string>AppIcon72x72~ipad.png</string>
<string>AppIcon72x72@2x~ipad.png</string>
<string>AppIcon76x76~ipad.png</string>
<string>AppIcon76x76@2x~ipad.png</string>
</array>
</dict>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleDisplayName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>CustomLaunchScreen</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -40,11 +40,6 @@
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon29x29.png</string>
<string>AppIcon29x29@2x.png</string>
<string>AppIcon40x40@2x.png</string>
<string>AppIcon57x57.png</string>
<string>AppIcon57x57@2x.png</string>
<string>AppIcon60x60@2x.png</string>
</array>
<key>CFBundleIconName</key>
@ -57,21 +52,6 @@
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon29x29.png</string>
<string>AppIcon29x29@2x.png</string>
<string>AppIcon40x40@2x.png</string>
<string>AppIcon57x57.png</string>
<string>AppIcon57x57@2x.png</string>
<string>AppIcon60x60@2x.png</string>
<string>AppIcon29x29~ipad.png</string>
<string>AppIcon29x29@2x~ipad.png</string>
<string>AppIcon40x40~ipad.png</string>
<string>AppIcon40x40@2x~ipad.png</string>
<string>AppIcon50x50~ipad.png</string>
<string>AppIcon50x50@2x~ipad.png</string>
<string>AppIcon72x72~ipad.png</string>
<string>AppIcon72x72@2x~ipad.png</string>
<string>AppIcon76x76~ipad.png</string>
<string>AppIcon76x76@2x~ipad.png</string>
</array>
</dict>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>${ASSETCATALOG_COMPILER_APPICON_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${QMAKE_SHORT_VERSION}</string>
<key>CFBundleSignature</key>
<string>${QMAKE_PKGINFO_TYPEINFO}</string>
<key>CFBundleVersion</key>
<string>${QMAKE_FULL_VERSION}</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>${IPHONEOS_DEPLOYMENT_TARGET}</string>
<key>UILaunchStoryboardName</key>
<string>CustomLaunchScreen</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -6,7 +6,12 @@ TARGET = tst_manual_ios_assets
# Custom Info.plist
ios {
QMAKE_INFO_PLIST = Info.ios.qmake.plist
versionAtLeast(QMAKE_XCODE_VERSION, 14.0) {
plist_path = Info.ios.qmake.xcode.14.3.plist
} else {
plist_path = Info.ios.qmake.xcode.13.0.plist
}
QMAKE_INFO_PLIST = $$plist_path
}
# Custom resources
@ -23,19 +28,18 @@ ios {
macos {
textFiles.path = Contents/Resources/textFiles
}
textFiles.files -= CMakeLists.txt
QMAKE_BUNDLE_DATA += textFiles
# App icons
# Asset catalog with images and app icons
ios {
ios_icon.files = $$files($$PWD/appicon/AppIcon*.png)
QMAKE_BUNDLE_DATA += ios_icon
}
# Asset catalog with images
ios {
# The asset catalog needs to have an empty AppIcon.appiconset, otherwise Xcode refuses
# The asset catalog needs to have at least an empty AppIcon.appiconset, otherwise Xcode refuses
# to compile the asset catalog.
QMAKE_ASSET_CATALOGS += Assets.xcassets
versionAtLeast(QMAKE_XCODE_VERSION, 14.0) {
QMAKE_ASSET_CATALOGS += AssetsXcode14.3.xcassets
} else {
QMAKE_ASSET_CATALOGS += AssetsXcode13.0.xcassets
}
SOURCES += utils.mm
LIBS += -framework UIKit
}