diff options
author | Tor Arne Vestbø <[email protected]> | 2024-02-12 15:19:56 +0100 |
---|---|---|
committer | Tor Arne Vestbø <[email protected]> | 2024-02-13 21:53:34 +0100 |
commit | 9cca899574ea44cd9c4f2be096e8b7a70f6280f2 (patch) | |
tree | fbab3ff7468349c957354fef23ea8ab18c97ba6d | |
parent | 6657acf8f57529bfe601d18db5d594773f51fe91 (diff) |
cmake: Generate Apple privacy manifest files for Qt modules
The default manifest is a minimal file that claims NSPrivacyTracking
false, along with an empty list of NSPrivacyTrackingDomains and
NSPrivacyCollectedDataTypes, as Qt does not generally do user tracking.
Modules can override the default manifest by setting the
PRIVACY_MANIFEST target property, specifying a custom privacy
manifest.
The NSPrivacyAccessedAPITypes key is only required for iOS for now.
Even though we don't build Qt for iOS as frameworks yet, which is
required to embed a privacy manifest, we include the keys for the
APIs we known we use.
Task-number: QTBUG-114319
Change-Id: I654bb52b98ee963adeeb744b35f3a1c2a1270969
Reviewed-by: Alexandru Croitor <[email protected]>
-rw-r--r-- | cmake/QtBaseGlobalTargets.cmake | 10 | ||||
-rw-r--r-- | cmake/QtBuildHelpers.cmake | 4 | ||||
-rw-r--r-- | cmake/QtModuleHelpers.cmake | 17 | ||||
-rw-r--r-- | cmake/ios/PrivacyInfo.xcprivacy | 14 | ||||
-rw-r--r-- | cmake/macos/PrivacyInfo.xcprivacy | 12 | ||||
-rw-r--r-- | src/corelib/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/corelib/platform/ios/PrivacyInfo.xcprivacy | 31 | ||||
-rw-r--r-- | src/gui/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/gui/platform/ios/PrivacyInfo.xcprivacy | 23 | ||||
-rw-r--r-- | src/widgets/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/widgets/platform/ios/PrivacyInfo.xcprivacy | 25 |
11 files changed, 151 insertions, 0 deletions
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake index 4031dad39b1..3535f41a3be 100644 --- a/cmake/QtBaseGlobalTargets.cmake +++ b/cmake/QtBaseGlobalTargets.cmake @@ -329,6 +329,7 @@ if(APPLE) set(platform_shortname "ios") endif() + # Info.plist qt_copy_or_install(FILES "cmake/${platform_shortname}/Info.plist.app.in" DESTINATION "${__GlobalConfig_install_dir}/${platform_shortname}" ) @@ -337,6 +338,15 @@ if(APPLE) DESTINATION "${__GlobalConfig_build_dir}/${platform_shortname}" ) + # Privacy manifest + qt_copy_or_install(FILES "cmake/${platform_shortname}/PrivacyInfo.xcprivacy" + DESTINATION "${__GlobalConfig_install_dir}/${platform_shortname}" + ) + # For examples built as part of prefix build before install + file(COPY "cmake/${platform_shortname}/PrivacyInfo.xcprivacy" + DESTINATION "${__GlobalConfig_build_dir}/${platform_shortname}" + ) + if(IOS) qt_copy_or_install(FILES "cmake/ios/LaunchScreen.storyboard" DESTINATION "${__GlobalConfig_install_dir}/ios" diff --git a/cmake/QtBuildHelpers.cmake b/cmake/QtBuildHelpers.cmake index adaa107cba0..847c0d20281 100644 --- a/cmake/QtBuildHelpers.cmake +++ b/cmake/QtBuildHelpers.cmake @@ -131,6 +131,10 @@ macro(qt_internal_set_apple_archiver_flags) endif() endmacro() +macro(qt_internal_set_apple_privacy_manifest target manifest_file) + set_target_properties(${target} PROPERTIES _qt_privacy_manifest "${manifest_file}") +endmacro() + macro(qt_internal_set_debug_extend_target) option(QT_CMAKE_DEBUG_EXTEND_TARGET "Debug extend_target calls in Qt's build system" OFF) endmacro() diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake index 602720cebfa..a4fa66c037f 100644 --- a/cmake/QtModuleHelpers.cmake +++ b/cmake/QtModuleHelpers.cmake @@ -911,6 +911,22 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)") qt_add_list_file_finalizer(qt_finalize_module ${target} ${arg_INTERNAL_MODULE} ${arg_NO_PRIVATE_MODULE}) endfunction() +function(qt_internal_apply_apple_privacy_manifest target) + if(APPLE) + # Privacy manifest + get_target_property(is_framework ${target} FRAMEWORK) + if(is_framework) + get_target_property(privacy_manifest ${target} _qt_privacy_manifest) + if(NOT privacy_manifest) + set(privacy_manifest + "${__qt_internal_cmake_apple_support_files_path}/PrivacyInfo.xcprivacy") + endif() + target_sources("${target}" PRIVATE "${privacy_manifest}") + set_property(TARGET "${target}" APPEND PROPERTY RESOURCE "${privacy_manifest}") + endif() + endif() +endfunction() + function(qt_finalize_module target) qt_internal_collect_module_headers(module_headers ${target}) @@ -934,6 +950,7 @@ function(qt_finalize_module target) qt_generate_prl_file(${target} "${INSTALL_LIBDIR}") qt_generate_module_pri_file("${target}" ${ARGN}) qt_internal_generate_pkg_config_file(${target}) + qt_internal_apply_apple_privacy_manifest(${target}) endfunction() # Get a set of Qt module related values based on the target. diff --git a/cmake/ios/PrivacyInfo.xcprivacy b/cmake/ios/PrivacyInfo.xcprivacy new file mode 100644 index 00000000000..d75908da058 --- /dev/null +++ b/cmake/ios/PrivacyInfo.xcprivacy @@ -0,0 +1,14 @@ +<?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>NSPrivacyTracking</key> + <false/> + <key>NSPrivacyCollectedDataTypes</key> + <array/> + <key>NSPrivacyTrackingDomains</key> + <array/> + <key>NSPrivacyAccessedAPITypes</key> + <array/> +</dict> +</plist> diff --git a/cmake/macos/PrivacyInfo.xcprivacy b/cmake/macos/PrivacyInfo.xcprivacy new file mode 100644 index 00000000000..96aff954eaa --- /dev/null +++ b/cmake/macos/PrivacyInfo.xcprivacy @@ -0,0 +1,12 @@ +<?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>NSPrivacyTracking</key> + <false/> + <key>NSPrivacyCollectedDataTypes</key> + <array/> + <key>NSPrivacyTrackingDomains</key> + <array/> +</dict> +</plist> diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 28d97c06994..e03863e069a 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -1442,6 +1442,11 @@ if(APPLE AND QT_FEATURE_framework AND QT_FEATURE_separate_debug_info) ) endif() +if(IOS) + qt_internal_set_apple_privacy_manifest(Core + "${CMAKE_CURRENT_SOURCE_DIR}/platform/ios/PrivacyInfo.xcprivacy") +endif() + set(linker_script_contents "") if (QT_NAMESPACE STREQUAL "") set(tag_symbol "qt_version_tag") diff --git a/src/corelib/platform/ios/PrivacyInfo.xcprivacy b/src/corelib/platform/ios/PrivacyInfo.xcprivacy new file mode 100644 index 00000000000..5f84a229a57 --- /dev/null +++ b/src/corelib/platform/ios/PrivacyInfo.xcprivacy @@ -0,0 +1,31 @@ +<?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>NSPrivacyTracking</key> + <false/> + <key>NSPrivacyCollectedDataTypes</key> + <array/> + <key>NSPrivacyTrackingDomains</key> + <array/> + <key>NSPrivacyAccessedAPITypes</key> + <array> + <dict> + <key>NSPrivacyAccessedAPIType</key> + <string>NSPrivacyAccessedAPICategoryFileTimestamp</string> + <key>NSPrivacyAccessedAPITypeReasons</key> + <array> + <string>0A2A.1</string> <!-- QFileInfo --> + </array> + </dict> + <dict> + <key>NSPrivacyAccessedAPIType</key> + <string>NSPrivacyAccessedAPICategoryDiskSpace</string> + <key>NSPrivacyAccessedAPITypeReasons</key> + <array> + <string>85F4.1</string> <!-- QStorageInfo --> + </array> + </dict> + </array> +</dict> +</plist> diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 7015e1e82fc..70bbfc7a6bc 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -1032,4 +1032,9 @@ qt_internal_add_docs(Gui doc/qtgui.qdocconf ) +if(IOS) + qt_internal_set_apple_privacy_manifest(Gui + "${CMAKE_CURRENT_SOURCE_DIR}/platform/ios/PrivacyInfo.xcprivacy") +endif() + qt_internal_add_optimize_full_flags() diff --git a/src/gui/platform/ios/PrivacyInfo.xcprivacy b/src/gui/platform/ios/PrivacyInfo.xcprivacy new file mode 100644 index 00000000000..bde2b167c75 --- /dev/null +++ b/src/gui/platform/ios/PrivacyInfo.xcprivacy @@ -0,0 +1,23 @@ +<?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>NSPrivacyTracking</key> + <false/> + <key>NSPrivacyCollectedDataTypes</key> + <array/> + <key>NSPrivacyTrackingDomains</key> + <array/> + <key>NSPrivacyAccessedAPITypes</key> + <array> + <dict> + <key>NSPrivacyAccessedAPIType</key> + <string>NSPrivacyAccessedAPICategorySystemBootTime</string> + <key>NSPrivacyAccessedAPITypeReasons</key> + <array> + <string>35F9.1</string> <!-- QUIView event handling --> + </array> + </dict> + </array> +</dict> +</plist> diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index f77117dc563..2ba8e4719a7 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -911,6 +911,11 @@ qt_internal_add_docs(Widgets doc/qtwidgets.qdocconf ) +if(IOS) + qt_internal_set_apple_privacy_manifest(Widgets + "${CMAKE_CURRENT_SOURCE_DIR}/platform/ios/PrivacyInfo.xcprivacy") +endif() + # include the snippet projects for developer-builds if(QT_FEATURE_private_tests) add_subdirectory(doc/snippets/customviewstyle) diff --git a/src/widgets/platform/ios/PrivacyInfo.xcprivacy b/src/widgets/platform/ios/PrivacyInfo.xcprivacy new file mode 100644 index 00000000000..819b868e1a7 --- /dev/null +++ b/src/widgets/platform/ios/PrivacyInfo.xcprivacy @@ -0,0 +1,25 @@ +<?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>NSPrivacyTracking</key> + <false/> + <key>NSPrivacyCollectedDataTypes</key> + <array/> + <key>NSPrivacyTrackingDomains</key> + <array/> + <key>NSPrivacyAccessedAPITypes</key> + <array> + <dict> + <key>NSPrivacyAccessedAPIType</key> + <string>NSPrivacyAccessedAPICategoryFileTimestamp</string> + <key>NSPrivacyAccessedAPITypeReasons</key> + <array> + <string>DDA9.1</string> <!-- QFileDialog --> + <string>C617.1</string> <!-- QFileDialog --> + <string>3B52.1</string> <!-- QFileDialog --> + </array> + </dict> + </array> +</dict> +</plist> |