diff options
author | Brad King <brad.king@kitware.com> | 2022-11-21 15:06:10 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-11-21 15:06:20 (GMT) |
commit | e69251c828a67c75fd422fc0969992854f217980 (patch) | |
tree | ebe9bf25f3a34ff8a74b9e7d05c9bc4eda85f353 /Tests | |
parent | 55e3168dc493ed88a7519a92a7cfbd3506b5797e (diff) | |
parent | b99c386122b3e27b3c931c49f26d4afd93580755 (diff) | |
download | CMake-e69251c828a67c75fd422fc0969992854f217980.zip CMake-e69251c828a67c75fd422fc0969992854f217980.tar.gz CMake-e69251c828a67c75fd422fc0969992854f217980.tar.bz2 |
Merge topic 'xcode-ios-extensionkit'
b99c386122 Xcode: Allow bundling extensionkit extensions
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7900
Diffstat (limited to 'Tests')
7 files changed, 72 insertions, 0 deletions
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS-check.cmake new file mode 100644 index 0000000..576be11 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS-check.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "RemoveHeadersOnCopy" TRUE) +findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS.cmake new file mode 100644 index 0000000..839f842 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-iOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedAppExtensions.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS-check.cmake new file mode 100644 index 0000000..576be11 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS-check.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "RemoveHeadersOnCopy" TRUE) +findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS.cmake new file mode 100644 index 0000000..839f842 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions-macOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedAppExtensions.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions.cmake new file mode 100644 index 0000000..91d207b --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedExtensionKitExtensions.cmake @@ -0,0 +1,22 @@ +add_executable(app_extensionkit_extension main.m) +set_target_properties(app_extensionkit_extension PROPERTIES + LINKER_LANGUAGE CXX + BUNDLE YES + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" + XCODE_ATTRIBUTE_GENERATE_INFOPLIST_FILE "YES" + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/ExtensionKit.Info.plist.in" + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app.app_extensionkit_extension" + XCODE_PRODUCT_TYPE "com.apple.product-type.extensionkit-extension" + XCODE_EXPLICIT_FILE_TYPE "wrapper.extensionkit-extension" +) + +add_executable(app MACOSX_BUNDLE main.m) +add_dependencies(app app_extension) +set_target_properties(app PROPERTIES + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_EMBED_EXTENSIONKIT_EXTENSIONS app_extension + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app" +) diff --git a/Tests/RunCMake/XcodeProject-Embed/ExtensionKit.Info.plist.in b/Tests/RunCMake/XcodeProject-Embed/ExtensionKit.Info.plist.in new file mode 100644 index 0000000..573aa22 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/ExtensionKit.Info.plist.in @@ -0,0 +1,13 @@ +<?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>EXAppExtensionAttributes</key> + <dict> + <key>EXExtensionPointIdentifier</key> + <string>com.apple.background-asset-downloader-extension</string> + <key>EXPrincipalClass</key> + <string>BackgroundDownloadHandler</string> + </dict> +</dict> +</plist> diff --git a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake index f3a6918..a7bccee 100644 --- a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake @@ -64,6 +64,25 @@ function(TestAppExtension platform) ) endfunction() +function(TestExtensionKitExtension platform) + set(testName EmbedExtensionKitExtensions-${platform}) + if(NOT platform STREQUAL "macOS") + set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=${platform}) + endif() + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(${testName}) + run_cmake_command(${testName}-build + ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} + --config Debug + --target app + ) +endfunction() + # Isolate device tests from host architecture selection. unset(ENV{CMAKE_OSX_ARCHITECTURES}) @@ -74,3 +93,11 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 8) TestAppExtension(macOS) TestAppExtension(iOS) endif() + +if(XCODE_VERSION VERSION_GREATER_EQUAL 14.1) + # The various flag on/off combinations are tested by the EmbedFrameworks... + # tests, so we don't duplicate all the combinations here. We only verify the + # defaults, which is to remove headers on copy, but not code sign. + TestAppExtension(macOS) + TestAppExtension(iOS) +endif() |