From b09d17bc3af64bd3721386c44ed9c821423fff45 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sun, 15 Dec 2024 05:14:07 +0100 Subject: [PATCH] Add the MetalPerformanceShaders framework The exact semantics of Cargo features in umbrella frameworks are still undecided, see https://github.com/madsmtm/objc2/issues/640. So for now I've gone with the solution that required the least code-changes, which is that each file still gets its own feature. --- .github/workflows/ci.yml | 22 +- Cargo.lock | 13 + crates/header-translator/src/config.rs | 2 - crates/header-translator/src/id.rs | 57 +- crates/header-translator/src/library.rs | 31 +- crates/header-translator/src/main.rs | 17 +- crates/header-translator/src/module.rs | 35 +- crates/header-translator/src/rust_type.rs | 5 +- .../header-translator/src/unexposed_attr.rs | 8 + .../src/topics/about_generated/CHANGELOG.md | 1 + .../src/topics/about_generated/list_data.md | 1 + .../Cargo.toml | 746 ++++++++++++++++++ .../objc2-metal-performance-shaders/README.md | 14 + .../src/generated | 1 + .../src/lib.rs | 28 + .../src/packed.rs | 34 + .../translation-config.toml | 61 ++ .../objc2-quartz-core/translation-config.toml | 1 - generated | 2 +- 19 files changed, 1017 insertions(+), 62 deletions(-) create mode 100644 framework-crates/objc2-metal-performance-shaders/Cargo.toml create mode 100644 framework-crates/objc2-metal-performance-shaders/README.md create mode 120000 framework-crates/objc2-metal-performance-shaders/src/generated create mode 100644 framework-crates/objc2-metal-performance-shaders/src/lib.rs create mode 100644 framework-crates/objc2-metal-performance-shaders/src/packed.rs create mode 100644 framework-crates/objc2-metal-performance-shaders/translation-config.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6ed7b3ce..6db71eab3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,17 +46,17 @@ env: # BEGIN AUTOMATICALLY GENERATED FRAMEWORKS_MACOS_10_12: --package=objc2-accounts --package=objc2-automator --package=objc2-av-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-local-authentication --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-multipeer-connectivity --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-saver --package=objc2-service-management --package=objc2-social --package=objc2-store-kit --package=objc2-web-kit - FRAMEWORKS_MACOS_10_13: --package=objc2-accounts --package=objc2-automator --package=objc2-av-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-external-accessory --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-local-authentication --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-multipeer-connectivity --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-saver --package=objc2-service-management --package=objc2-social --package=objc2-store-kit --package=objc2-vision --package=objc2-web-kit - FRAMEWORKS_MACOS_11: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-business-chat --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-saver --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-system-extensions --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit - FRAMEWORKS_MACOS_12: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-business-chat --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-saver --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-system-extensions --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit - FRAMEWORKS_MACOS_13: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-background-assets --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-capture-kit --package=objc2-screen-saver --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-system-extensions --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit - FRAMEWORKS_MACOS_14: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-background-assets --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-capture-kit --package=objc2-screen-saver --package=objc2-sensitive-content-analysis --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-system-extensions --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit - FRAMEWORKS_MACOS_15: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-background-assets --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-capture-kit --package=objc2-screen-saver --package=objc2-sensitive-content-analysis --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-system-extensions --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit - FRAMEWORKS_IOS_10: --package=objc2-accounts --package=objc2-ad-support --package=objc2-av-kit --package=objc2-call-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-event-kit --package=objc2-event-kit-ui --package=objc2-external-accessory --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-local-authentication --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-multipeer-connectivity --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-social --package=objc2-speech --package=objc2-store-kit --package=objc2-ui-kit --package=objc2-user-notifications - FRAMEWORKS_IOS_17: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-av-kit --package=objc2-background-assets --package=objc2-background-tasks --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-event-kit-ui --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-metric-kit --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-sensitive-content-analysis --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-ui-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-vision --package=objc2-web-kit - FRAMEWORKS_TVOS_17: --package=objc2-accessibility --package=objc2-ad-support --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-av-kit --package=objc2-background-tasks --package=objc2-cloud-kit --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-text --package=objc2-core-video --package=objc2-data-detection --package=objc2-device-check --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-sound-analysis --package=objc2-store-kit --package=objc2-symbols --package=objc2-ui-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-vision - FRAMEWORKS_MAC_CATALYST_17: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-background-assets --package=objc2-background-tasks --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-event-kit-ui --package=objc2-exception-handling --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider-ui --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-sensitive-content-analysis --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-ui-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-vision --package=objc2-web-kit - FRAMEWORKS_VISIONOS_1: --package=objc2-accessibility --package=objc2-ad-services --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-av-kit --package=objc2-background-assets --package=objc2-background-tasks --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-event-kit-ui --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metric-kit --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-ui-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-vision --package=objc2-web-kit + FRAMEWORKS_MACOS_10_13: --package=objc2-accounts --package=objc2-automator --package=objc2-av-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-external-accessory --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-local-authentication --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-multipeer-connectivity --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-saver --package=objc2-service-management --package=objc2-social --package=objc2-store-kit --package=objc2-vision --package=objc2-web-kit + FRAMEWORKS_MACOS_11: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-business-chat --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-saver --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-system-extensions --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit + FRAMEWORKS_MACOS_12: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-business-chat --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-saver --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-system-extensions --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit + FRAMEWORKS_MACOS_13: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-background-assets --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-capture-kit --package=objc2-screen-saver --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-system-extensions --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit + FRAMEWORKS_MACOS_14: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-background-assets --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-capture-kit --package=objc2-screen-saver --package=objc2-sensitive-content-analysis --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-system-extensions --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit + FRAMEWORKS_MACOS_15: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-background-assets --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-capture-kit --package=objc2-screen-saver --package=objc2-sensitive-content-analysis --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-system-extensions --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit + FRAMEWORKS_IOS_10: --package=objc2-accounts --package=objc2-ad-support --package=objc2-av-kit --package=objc2-call-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-event-kit --package=objc2-event-kit-ui --package=objc2-external-accessory --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-local-authentication --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-multipeer-connectivity --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-social --package=objc2-speech --package=objc2-store-kit --package=objc2-ui-kit --package=objc2-user-notifications + FRAMEWORKS_IOS_17: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-av-kit --package=objc2-background-assets --package=objc2-background-tasks --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-event-kit-ui --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-metric-kit --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-sensitive-content-analysis --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-ui-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-vision --package=objc2-web-kit + FRAMEWORKS_TVOS_17: --package=objc2-accessibility --package=objc2-ad-support --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-av-kit --package=objc2-background-tasks --package=objc2-cloud-kit --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-text --package=objc2-core-video --package=objc2-data-detection --package=objc2-device-check --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-sound-analysis --package=objc2-store-kit --package=objc2-symbols --package=objc2-ui-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-vision + FRAMEWORKS_MAC_CATALYST_17: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-background-assets --package=objc2-background-tasks --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-event-kit-ui --package=objc2-exception-handling --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider-ui --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-sensitive-content-analysis --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-ui-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-vision --package=objc2-web-kit + FRAMEWORKS_VISIONOS_1: --package=objc2-accessibility --package=objc2-ad-services --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-av-kit --package=objc2-background-assets --package=objc2-background-tasks --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-event-kit-ui --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-io-surface --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metal-performance-shaders --package=objc2-metric-kit --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-ui-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-vision --package=objc2-web-kit FRAMEWORKS_WATCHOS_10: --package=objc2-accessibility --package=objc2-authentication-services --package=objc2-av-kit --package=objc2-call-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-core-audio-types --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-foundation --package=objc2-core-graphics --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-text --package=objc2-core-video --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-extension-kit --package=objc2-foundation --package=objc2-game-kit --package=objc2-health-kit --package=objc2-local-authentication --package=objc2-map-kit --package=objc2-media-player --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-photos-ui --package=objc2-sound-analysis --package=objc2-store-kit --package=objc2-symbols --package=objc2-ui-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications FRAMEWORKS_GNUSTEP: --package=objc2-app-kit --package=objc2-foundation # END AUTOMATICALLY GENERATED diff --git a/Cargo.lock b/Cargo.lock index 2ca10ec6b..b23fe4a67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1002,6 +1002,19 @@ dependencies = [ "objc2-quartz-core", ] +[[package]] +name = "objc2-metal-performance-shaders" +version = "0.2.2" +dependencies = [ + "bitflags", + "block2", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-metal", +] + [[package]] name = "objc2-metric-kit" version = "0.2.2" diff --git a/crates/header-translator/src/config.rs b/crates/header-translator/src/config.rs index 00e5744b2..53aa12abf 100644 --- a/crates/header-translator/src/config.rs +++ b/crates/header-translator/src/config.rs @@ -110,8 +110,6 @@ pub struct LibraryConfig { pub framework: String, #[serde(rename = "crate")] pub krate: String, - #[serde(rename = "umbrella-header")] - pub umbrella_header: Option, /// Dependencies are optional by default, this can be used to make a /// dependency required. /// diff --git a/crates/header-translator/src/id.rs b/crates/header-translator/src/id.rs index d8d6f50c9..f79df4913 100644 --- a/crates/header-translator/src/id.rs +++ b/crates/header-translator/src/id.rs @@ -4,7 +4,7 @@ use std::borrow::Cow; use std::cmp::Ordering; use std::collections::BTreeSet; -use clang::source::Module; +use clang::source::{File, Module}; use clang::Entity; use crate::cfgs::PlatformCfg; @@ -152,6 +152,49 @@ impl Location { }) } + pub fn from_file(file: File<'_>) -> Self { + // Get from module first if available + if let Some(module) = file.get_module() { + return Location::from_module(module); + } + + let path = file.get_path(); + + if !path.to_string_lossy().contains("System/Library/Frameworks") { + // Likely a built-in macro from stddef.h, stdarg.h or assert.h. + return Location::from_components(vec!["System".into()]); + } + + // The item likely comes from a private sub-framework, so let's try + // to parse framework names from the sub-framework here. + let mut components: Vec> = path + .components() + .map(|component| component.as_os_str()) + .skip_while(|s| !s.as_encoded_bytes().ends_with(b".sdk")) + .skip(1) + .map(|s| s.to_str().expect("component to_str")) + .filter(|s| !matches!(*s, "System" | "Library" | "Frameworks" | "Headers")) + .map(|component| component.strip_suffix(".framework").unwrap_or(component)) + .map(|component| component.strip_suffix(".h").unwrap_or(component)) + .map(|s| s.to_string().into()) + .collect(); + + if let [.., second_last, last] = &*components { + if second_last == last { + // Remove umbrella header + components.pop(); + } + } + + Self::from_components(components) + } + + pub(crate) fn components( + &self, + ) -> impl DoubleEndedIterator + ExactSizeIterator + '_ { + self.path_components.iter().map(|c| &**c) + } + pub(crate) fn from_components(path_components: Vec>) -> Self { Self { path_components } } @@ -195,7 +238,10 @@ impl Location { } } else { let file_name = self.file_name(); - let required = config.libraries[emission_library] + let required = config + .libraries + .get(emission_library) + .unwrap_or_else(|| panic!("{emission_library} not found in libraries")) .required_dependencies .contains(krate); LocationLibrary::InExternalLibrary { @@ -275,12 +321,7 @@ impl ItemIdentifier { .file .expect("expanded location file"); - let mut location = if let Some(module) = file.get_module() { - Location::from_module(module) - } else { - // If file module is not available, the item is likely a built-in macro. - Location::from_components(vec!["System".into()]) - }; + let mut location = Location::from_file(file); // Defined in multiple places for some reason. if let Some("IOSurfaceRef" | "__IOSurface") = name.to_option() { diff --git a/crates/header-translator/src/library.rs b/crates/header-translator/src/library.rs index b5a84c97c..1e8c83326 100644 --- a/crates/header-translator/src/library.rs +++ b/crates/header-translator/src/library.rs @@ -15,6 +15,7 @@ use crate::config::LibraryConfig; use crate::display_helper::FormatterFn; use crate::module::Module; use crate::Config; +use crate::Location; use crate::VERSION; #[derive(Debug, PartialEq)] @@ -24,7 +25,7 @@ pub struct Library { pub data: LibraryConfig, } -type Dependencies<'c> = BTreeMap<&'c str, (bool, String, BTreeSet)>; +pub(crate) type Dependencies<'c> = BTreeMap<&'c str, (bool, String, BTreeSet)>; impl Library { pub fn new(name: &str, data: &LibraryConfig) -> Self { @@ -35,26 +36,20 @@ impl Library { } } - pub fn add_module(&mut self, components: Vec) { + pub fn add_module(&mut self, location: Location) { let mut current = &mut self.module; - for component in components { - current = current.submodules.entry(component).or_default(); + for component in location.components().skip(1) { + current = current.submodules.entry(component.into()).or_default(); } } - pub fn module_mut(&mut self, mut module: clang::source::Module<'_>) -> &mut Module { - let mut components = vec![]; - while let Some(parent) = module.get_parent() { - components.insert(0, module.get_name()); - module = parent; - } - + pub fn module_mut(&mut self, location: Location) -> &mut Module { let mut current = &mut self.module; - for component in components { - current = match current.submodules.entry(component) { + for component in location.components().skip(1) { + current = match current.submodules.entry(component.into()) { Entry::Occupied(entry) => entry.into_mut(), Entry::Vacant(entry) => { - error!(?module, "expected module to be available in library"); + error!(?location, "expected module to be available in library"); entry.insert(Default::default()) } }; @@ -382,9 +377,11 @@ see that for related crates.", self.data.krate, self.link_name)?; add_newline_at_end(&mut cargo_toml["features"]); // Own features - let mut generated_features = self - .module - .required_cargo_features_inner(config, &self.link_name); + let mut generated_features = self.module.required_cargo_features_inner( + config, + &self.link_name, + &dependency_map[&*self.link_name], + ); let _ = generated_features.insert( "all".to_string(), diff --git a/crates/header-translator/src/main.rs b/crates/header-translator/src/main.rs index 5348360db..7de364bae 100644 --- a/crates/header-translator/src/main.rs +++ b/crates/header-translator/src/main.rs @@ -14,7 +14,7 @@ use tracing_subscriber::util::SubscriberInitExt; use tracing_tree::HierarchicalLayer; use header_translator::{ - global_analysis, run_cargo_fmt, Config, Context, Library, LibraryConfig, MacroEntity, + global_analysis, run_cargo_fmt, Config, Context, Library, LibraryConfig, Location, MacroEntity, MacroLocation, Stmt, }; @@ -304,15 +304,9 @@ fn parse_framework(tu: TranslationUnit<'_>, context: &mut Context<'_>, library: match entity.get_kind() { EntityKind::InclusionDirective if preprocessing => { let file = entity.get_file().expect("inclusion directive has file"); - if let Some(mut module) = file.get_module() { - let mut components = vec![]; - while let Some(parent) = module.get_parent() { - components.insert(0, module.get_name()); - module = parent; - } - if module.get_name() == library.data.framework { - library.add_module(components); - } + let location = Location::from_file(file); + if location.library_name() == library.data.framework { + library.add_module(location); } } EntityKind::MacroExpansion if preprocessing => { @@ -337,8 +331,9 @@ fn parse_framework(tu: TranslationUnit<'_>, context: &mut Context<'_>, library: .get_expansion_location() .file .expect("expanded location file"); + let location = Location::from_file(file); - let module = library.module_mut(file.get_module().expect("file module")); + let module = library.module_mut(location); for stmt in Stmt::parse(&entity, context) { module.add_stmt(stmt); } diff --git a/crates/header-translator/src/module.rs b/crates/header-translator/src/module.rs index 224c26caa..ce8b25427 100644 --- a/crates/header-translator/src/module.rs +++ b/crates/header-translator/src/module.rs @@ -6,6 +6,7 @@ use std::{fmt, fs}; use crate::cfgs::PlatformCfg; use crate::display_helper::FormatterFn; use crate::id::{cfg_gate_ln, Location}; +use crate::library::Dependencies; use crate::stmt::Stmt; use crate::{Config, ItemIdentifier}; @@ -45,6 +46,7 @@ impl Module { &self, config: &Config, emission_library: &str, + dependencies: &Dependencies<'_>, ) -> BTreeMap> { let mut required_features: BTreeMap> = BTreeMap::new(); @@ -59,6 +61,11 @@ impl Module { .library(config, emission_library) .cargo_toml_feature() { + if feature == "bitflags" { + if let Some((true, _, _)) = dependencies.get("bitflags") { + continue; + } + } // Feature names are based on the file name, not the // whole path to the feature. features.insert(feature); @@ -66,8 +73,11 @@ impl Module { } } required_features.insert(clean_name(file_name), features); - required_features - .extend(module.required_cargo_features_inner(config, emission_library)); + required_features.extend(module.required_cargo_features_inner( + config, + emission_library, + dependencies, + )); } required_features @@ -120,22 +130,27 @@ impl Module { FormatterFn(move |f| { for (name, module) in &self.submodules { let name = clean_name(name); + write!(f, "#[cfg(feature = \"{name}\")]")?; if module.submodules.is_empty() { - write!(f, "#[cfg(feature = \"{name}\")]")?; writeln!(f, "#[path = \"{name}.rs\"]")?; - writeln!(f, "mod __{name};")?; } else { - write!(f, "#[cfg(feature = \"{name}\")]")?; - writeln!(f, "mod {name};")?; + writeln!(f, "#[path = \"{name}/mod.rs\"]")?; } + writeln!(f, "mod __{name};")?; } writeln!(f)?; - for (file_name, file) in &self.submodules { - for stmt in &file.stmts { + for (module_name, module) in &self.submodules { + if !module.submodules.is_empty() { + write!(f, "#[cfg(feature = \"{module_name}\")]")?; + write!(f, "pub use self::__{}::*;", clean_name(module_name))?; + continue; + } + + for stmt in &module.stmts { if let Some(item) = stmt.provided_item() { - item.location().assert_file(file_name); + item.location().assert_file(module_name); let mut items = stmt.required_items(); items.push(item.clone()); @@ -153,7 +168,7 @@ impl Module { write!( f, "{visibility} use self::__{}::{{{}}};", - clean_name(file_name), + clean_name(module_name), item.name, )?; } diff --git a/crates/header-translator/src/rust_type.rs b/crates/header-translator/src/rust_type.rs index cef3e0c77..f925cd5a8 100644 --- a/crates/header-translator/src/rust_type.rs +++ b/crates/header-translator/src/rust_type.rs @@ -543,6 +543,9 @@ impl Ty { ty = modified; } else { error!("expected unexposed / attributed type to have modified type"); + ty = ty.get_canonical_type(); + name = ty.get_display_name(); + break; } } @@ -691,7 +694,7 @@ impl Ty { Self::AnyProtocol } else { let decl = ItemRef::new(&declaration, context); - if decl.id.name != name { + if decl.id.name != name.strip_prefix("const ").unwrap_or(&name) { error!(?name, "invalid interface name"); } Self::Class { diff --git a/crates/header-translator/src/unexposed_attr.rs b/crates/header-translator/src/unexposed_attr.rs index f2dcc846c..1a0f3271c 100644 --- a/crates/header-translator/src/unexposed_attr.rs +++ b/crates/header-translator/src/unexposed_attr.rs @@ -150,6 +150,12 @@ impl UnexposedAttr { | "MLCOMPUTE_AVAILABLE_STARTING_BUT_DEPRECATED_MACOS14" | "MLCOMPUTE_CLASS_AVAILABLE_STARTING" | "MLCOMPUTE_ENUM_AVAILABLE_STARTING" + | "MPS_AVAILABLE_STARTING" + | "MPS_AVAILABLE_STARTING_BUT_DEPRECATED" + | "MPS_CLASS_AVAILABLE_STARTING" + | "MPS_ENUM_AVAILABLE_STARTING" + | "MPS_ENUM_AVAILABLE_STARTING_BUT_DEPRECATED" + | "MPS_UNAVAILABLE" | "MODELCOLLECTION_SUNSET" | "MP_API" | "MP_DEPRECATED" @@ -215,6 +221,7 @@ impl UnexposedAttr { | "AVKIT_INIT_UNAVAILABLE" | "CA_CANONICAL_DEPRECATED" | "CB_CM_API_AVAILABLE" + | "DEPRECATED_ATTRIBUTE" | "MP_INIT_UNAVAILABLE" | "CF_AUTOMATED_REFCOUNT_UNAVAILABLE" | "CG_OBSOLETE" @@ -232,6 +239,7 @@ impl UnexposedAttr { | "CF_SWIFT_UNAVAILABLE_FROM_ASYNC" | "DISPATCH_SWIFT_NAME" | "IOSFC_SWIFT_NAME" + | "MPS_SWIFT_NAME" | "NS_REFINED_FOR_SWIFT_ASYNC" | "NS_SWIFT_ASYNC_NAME" | "NS_SWIFT_ASYNC_THROWS_ON_FALSE" diff --git a/crates/objc2/src/topics/about_generated/CHANGELOG.md b/crates/objc2/src/topics/about_generated/CHANGELOG.md index 99ab8378f..8ac80f074 100644 --- a/crates/objc2/src/topics/about_generated/CHANGELOG.md +++ b/crates/objc2/src/topics/about_generated/CHANGELOG.md @@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `CoreVideo` / `objc2-core-video`. - `EventKitUI` / `objc2-event-kit-ui`. - `IOSurface` / `objc2-io-surface`. + - `MetalPerformanceShaders` / `objc2-metal-performance-shaders`. - `ScreenSaver` / `objc2-screen-saver`. * Added `#[must_use]` attributes where the C headers have them. diff --git a/crates/objc2/src/topics/about_generated/list_data.md b/crates/objc2/src/topics/about_generated/list_data.md index f5461ba10..cebfd7242 100644 --- a/crates/objc2/src/topics/about_generated/list_data.md +++ b/crates/objc2/src/topics/about_generated/list_data.md @@ -57,6 +57,7 @@ | `Metal` | [![`objc2-metal`](https://badgen.net/crates/v/objc2-metal)](https://crates.io/crates/objc2-metal) | [![docs.rs](https://docs.rs/objc2-metal/badge.svg)](https://docs.rs/objc2-metal/) | | `MetalFX` | [![`objc2-metal-fx`](https://badgen.net/crates/v/objc2-metal-fx)](https://crates.io/crates/objc2-metal-fx) | [![docs.rs](https://docs.rs/objc2-metal-fx/badge.svg)](https://docs.rs/objc2-metal-fx/) | | `MetalKit` | [![`objc2-metal-kit`](https://badgen.net/crates/v/objc2-metal-kit)](https://crates.io/crates/objc2-metal-kit) | [![docs.rs](https://docs.rs/objc2-metal-kit/badge.svg)](https://docs.rs/objc2-metal-kit/) | +| `MetalPerformanceShaders` | [![`objc2-metal-performance-shaders`](https://badgen.net/crates/v/objc2-metal-performance-shaders)](https://crates.io/crates/objc2-metal-performance-shaders) | [![docs.rs](https://docs.rs/objc2-metal-performance-shaders/badge.svg)](https://docs.rs/objc2-metal-performance-shaders/) | | `MetricKit` | [![`objc2-metric-kit`](https://badgen.net/crates/v/objc2-metric-kit)](https://crates.io/crates/objc2-metric-kit) | [![docs.rs](https://docs.rs/objc2-metric-kit/badge.svg)](https://docs.rs/objc2-metric-kit/) | | `MultipeerConnectivity` | [![`objc2-multipeer-connectivity`](https://badgen.net/crates/v/objc2-multipeer-connectivity)](https://crates.io/crates/objc2-multipeer-connectivity) | [![docs.rs](https://docs.rs/objc2-multipeer-connectivity/badge.svg)](https://docs.rs/objc2-multipeer-connectivity/) | | `NaturalLanguage` | [![`objc2-natural-language`](https://badgen.net/crates/v/objc2-natural-language)](https://crates.io/crates/objc2-natural-language) | [![docs.rs](https://docs.rs/objc2-natural-language/badge.svg)](https://docs.rs/objc2-natural-language/) | diff --git a/framework-crates/objc2-metal-performance-shaders/Cargo.toml b/framework-crates/objc2-metal-performance-shaders/Cargo.toml new file mode 100644 index 000000000..6e56d2c91 --- /dev/null +++ b/framework-crates/objc2-metal-performance-shaders/Cargo.toml @@ -0,0 +1,746 @@ +# This file has been automatically generated by `objc2`'s `header-translator`. +# DO NOT EDIT + +[package] +name = "objc2-metal-performance-shaders" +version.workspace = true +description = "Bindings to the MetalPerformanceShaders framework" +edition.workspace = true +rust-version.workspace = true +keywords = ["cocoa", "apple", "framework", "macos", "ios"] +categories.workspace = true +repository.workspace = true +license.workspace = true + +[lints] +workspace = true + +[dependencies] +bitflags = { version = "2.5.0", default-features = false } +block2 = { path = "../../crates/block2", version = "0.5.1", default-features = false, optional = true } +objc2 = { path = "../../crates/objc2", version = "0.5.2", default-features = false } +objc2-core-foundation = { path = "../objc2-core-foundation", version = "0.2.2", default-features = false, optional = true } +objc2-core-graphics = { path = "../objc2-core-graphics", version = "0.2.2", default-features = false, optional = true } +objc2-foundation = { path = "../objc2-foundation", version = "0.2.2", default-features = false } +objc2-metal = { path = "../objc2-metal", version = "0.2.2", default-features = false, features = ["MTLCommandBuffer", "MTLDevice"] } + +[package.metadata.docs.rs] +default-target = "aarch64-apple-darwin" +features = ["all"] +targets = [ + "aarch64-apple-darwin", + "x86_64-apple-darwin", + "aarch64-apple-ios", + "aarch64-apple-tvos", + "aarch64-apple-ios-macabi", +] + +[features] +default = ["std"] + +# Currently not possible to turn off, put here for forwards compatibility. +std = ["alloc", "bitflags/std", "block2?/std", "objc2/std", "objc2-core-foundation?/std", "objc2-core-graphics?/std", "objc2-foundation/std", "objc2-metal/std"] +alloc = ["block2?/alloc", "objc2/alloc", "objc2-core-foundation?/alloc", "objc2-core-graphics?/alloc", "objc2-foundation/alloc", "objc2-metal/alloc"] +block2 = ["dep:block2", "objc2-core-foundation?/block2", "objc2-core-graphics?/block2", "objc2-foundation/block2", "objc2-metal/block2"] +objc2-core-foundation = ["dep:objc2-core-foundation", "objc2-core-graphics?/objc2-core-foundation", "objc2-foundation/objc2-core-foundation", "objc2-metal/objc2-core-foundation"] +objc2-core-graphics = ["dep:objc2-core-graphics"] + +MPSAccelerationStructure = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSAccelerationStructureGroup = ["objc2-metal/MTLDevice"] +MPSCNNBatchNormalization = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSString", + "objc2-foundation/NSZone", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSCNNConvolution = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSData", + "objc2-foundation/NSObject", + "objc2-foundation/NSString", + "objc2-foundation/NSZone", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSCNNDropout = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSData", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", + "objc2-metal/MTLTypes", +] +MPSCNNGroupNormalization = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSString", + "objc2-foundation/NSZone", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSCNNInstanceNormalization = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSString", + "objc2-foundation/NSZone", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSCNNKernel = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSCNNLoss = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSData", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", + "objc2-metal/MTLTypes", +] +MPSCNNMath = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSCNNNeuron = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSData", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSCNNNeuronType = [] +MPSCNNNormalization = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSCNNNormalizationWeights = [ + "objc2-foundation/NSArray", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSCNNPooling = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSCNNSoftMax = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSCNNTypes = [] +MPSCNNUpsampling = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSCommandBuffer = [ + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLCommandQueue", + "objc2-metal/MTLDevice", + "objc2-metal/MTLHeap", + "objc2-metal/MTLResource", +] +MPSCore = [] +MPSCoreTypes = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSValue", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSFunctionConstantIndices = [] +MPSImage = [] +MPSImageConversion = [ + "objc2-core-foundation?/CFCGTypes", + "objc2-core-graphics?/CGColorConversionInfo", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSImageConvolution = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSImageCopy = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSImageDistanceTransform = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSImageEDLines = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", + "objc2-metal/MTLTypes", +] +MPSImageGuidedFilter = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSImageHistogram = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLPixelFormat", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", + "objc2-metal/MTLTypes", +] +MPSImageIntegral = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSImageKernel = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", + "objc2-metal/MTLTypes", +] +MPSImageKeypoint = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", + "objc2-metal/MTLTypes", +] +MPSImageMath = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSImageMedian = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSImageMorphology = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSImageReduce = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSImageResampling = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSImageStatistics = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSImageThreshold = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSImageTranspose = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSImageTypes = [] +MPSInstanceAccelerationStructure = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", +] +MPSKernel = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSString", + "objc2-foundation/NSZone", + "objc2-metal/MTLDevice", +] +MPSKernelTypes = [] +MPSKeyedUnarchiver = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSData", + "objc2-foundation/NSError", + "objc2-foundation/NSKeyedArchiver", + "objc2-foundation/NSSet", + "objc2-foundation/NSString", + "objc2-metal/MTLDevice", +] +MPSMatrix = [] +MPSMatrixBatchNormalization = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSMatrixCombination = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSMatrixDecomposition = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", +] +MPSMatrixFindTopK = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSMatrixFullyConnected = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSMatrixLayer = [] +MPSMatrixMultiplication = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSMatrixNeuron = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSData", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSMatrixRandom = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSMatrixSoftMax = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSMatrixSolve = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSMatrixSum = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSMatrixTypes = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSNDArray = [] +MPSNDArrayGather = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSNDArrayGradientState = [ + "objc2-foundation/NSArray", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSNDArrayIdentity = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSValue", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLCommandEncoder", + "objc2-metal/MTLComputeCommandEncoder", + "objc2-metal/MTLDevice", +] +MPSNDArrayKernel = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLCommandEncoder", + "objc2-metal/MTLComputeCommandEncoder", + "objc2-metal/MTLDevice", +] +MPSNDArrayMatrixMultiplication = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSNDArrayQuantization = ["objc2-foundation/NSObject"] +MPSNDArrayQuantizedMatrixMultiplication = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSNDArrayStridedSlice = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSNDArrayTypes = [] +MPSNNGradientState = [ + "objc2-foundation/NSArray", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSNNGraph = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSError", + "objc2-foundation/NSObject", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSNNGraphNodes = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSData", + "objc2-foundation/NSObject", + "objc2-foundation/NSString", + "objc2-metal/MTLTypes", +] +MPSNNGridSample = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSNNOptimizers = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSNNReduce = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", + "objc2-metal/MTLTypes", +] +MPSNNReshape = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSData", + "objc2-foundation/NSObject", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", +] +MPSNNResize = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSNNSlice = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSNeuralNetwork = [] +MPSNeuralNetworkTypes = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSObject", + "objc2-foundation/NSString", +] +MPSPolygonAccelerationStructure = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", +] +MPSPolygonBuffer = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLResource", +] +MPSQuadrilateralAccelerationStructure = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +MPSRNNLayer = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", + "objc2-metal/MTLTypes", +] +MPSRayIntersector = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLBuffer", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLRenderCommandEncoder", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSRayIntersectorTypes = [] +MPSSVGF = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLPixelFormat", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSState = [ + "objc2-foundation/NSArray", + "objc2-foundation/NSString", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLPixelFormat", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSTemporalAA = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-foundation/NSZone", + "objc2-metal/MTLAllocation", + "objc2-metal/MTLCommandBuffer", + "objc2-metal/MTLDevice", + "objc2-metal/MTLResource", + "objc2-metal/MTLTexture", +] +MPSTriangleAccelerationStructure = [ + "objc2-foundation/NSCoder", + "objc2-foundation/NSObject", + "objc2-metal/MTLDevice", +] +all = [ + "MPSAccelerationStructure", + "MPSAccelerationStructureGroup", + "MPSCNNBatchNormalization", + "MPSCNNConvolution", + "MPSCNNDropout", + "MPSCNNGroupNormalization", + "MPSCNNInstanceNormalization", + "MPSCNNKernel", + "MPSCNNLoss", + "MPSCNNMath", + "MPSCNNNeuron", + "MPSCNNNeuronType", + "MPSCNNNormalization", + "MPSCNNNormalizationWeights", + "MPSCNNPooling", + "MPSCNNSoftMax", + "MPSCNNTypes", + "MPSCNNUpsampling", + "MPSCommandBuffer", + "MPSCore", + "MPSCoreTypes", + "MPSFunctionConstantIndices", + "MPSImage", + "MPSImageConversion", + "MPSImageConvolution", + "MPSImageCopy", + "MPSImageDistanceTransform", + "MPSImageEDLines", + "MPSImageGuidedFilter", + "MPSImageHistogram", + "MPSImageIntegral", + "MPSImageKernel", + "MPSImageKeypoint", + "MPSImageMath", + "MPSImageMedian", + "MPSImageMorphology", + "MPSImageReduce", + "MPSImageResampling", + "MPSImageStatistics", + "MPSImageThreshold", + "MPSImageTranspose", + "MPSImageTypes", + "MPSInstanceAccelerationStructure", + "MPSKernel", + "MPSKernelTypes", + "MPSKeyedUnarchiver", + "MPSMatrix", + "MPSMatrixBatchNormalization", + "MPSMatrixCombination", + "MPSMatrixDecomposition", + "MPSMatrixFindTopK", + "MPSMatrixFullyConnected", + "MPSMatrixLayer", + "MPSMatrixMultiplication", + "MPSMatrixNeuron", + "MPSMatrixRandom", + "MPSMatrixSoftMax", + "MPSMatrixSolve", + "MPSMatrixSum", + "MPSMatrixTypes", + "MPSNDArray", + "MPSNDArrayGather", + "MPSNDArrayGradientState", + "MPSNDArrayIdentity", + "MPSNDArrayKernel", + "MPSNDArrayMatrixMultiplication", + "MPSNDArrayQuantization", + "MPSNDArrayQuantizedMatrixMultiplication", + "MPSNDArrayStridedSlice", + "MPSNDArrayTypes", + "MPSNNGradientState", + "MPSNNGraph", + "MPSNNGraphNodes", + "MPSNNGridSample", + "MPSNNOptimizers", + "MPSNNReduce", + "MPSNNReshape", + "MPSNNResize", + "MPSNNSlice", + "MPSNeuralNetwork", + "MPSNeuralNetworkTypes", + "MPSPolygonAccelerationStructure", + "MPSPolygonBuffer", + "MPSQuadrilateralAccelerationStructure", + "MPSRNNLayer", + "MPSRayIntersector", + "MPSRayIntersectorTypes", + "MPSSVGF", + "MPSState", + "MPSTemporalAA", + "MPSTriangleAccelerationStructure", + "block2", + "objc2-core-foundation", + "objc2-core-graphics", +] diff --git a/framework-crates/objc2-metal-performance-shaders/README.md b/framework-crates/objc2-metal-performance-shaders/README.md new file mode 100644 index 000000000..1b400060b --- /dev/null +++ b/framework-crates/objc2-metal-performance-shaders/README.md @@ -0,0 +1,14 @@ +# `objc2-metal-performance-shaders` + +[![Latest version](https://badgen.net/crates/v/objc2-metal-performance-shaders)](https://crates.io/crates/objc2-metal-performance-shaders) +[![License](https://badgen.net/badge/license/MIT/blue)](../LICENSE.txt) +[![Documentation](https://docs.rs/objc2-metal-performance-shaders/badge.svg)](https://docs.rs/objc2-metal-performance-shaders/) +[![CI](https://github.com/madsmtm/objc2/actions/workflows/ci.yml/badge.svg)](https://github.com/madsmtm/objc2/actions/workflows/ci.yml) + +Rust bindings to Apple's framework MetalPerformanceShaders. + +This README is kept intentionally small to consolidate the documentation, see +[the Rust docs](https://docs.rs/objc2-metal-performance-shaders/) for more details on this crate. + +This crate is part of the [`objc2` project](https://github.com/madsmtm/objc2), +see that for related crates. diff --git a/framework-crates/objc2-metal-performance-shaders/src/generated b/framework-crates/objc2-metal-performance-shaders/src/generated new file mode 120000 index 000000000..4a52e18d5 --- /dev/null +++ b/framework-crates/objc2-metal-performance-shaders/src/generated @@ -0,0 +1 @@ +../../../generated/MetalPerformanceShaders \ No newline at end of file diff --git a/framework-crates/objc2-metal-performance-shaders/src/lib.rs b/framework-crates/objc2-metal-performance-shaders/src/lib.rs new file mode 100644 index 000000000..cc4ebf3cf --- /dev/null +++ b/framework-crates/objc2-metal-performance-shaders/src/lib.rs @@ -0,0 +1,28 @@ +//! # Bindings to the `MetalPerformanceShaders` framework +//! +//! See [Apple's docs][apple-doc] and [the general docs on framework crates][framework-crates] for more information. +//! +//! [apple-doc]: https://developer.apple.com/documentation/metalperformanceshaders/ +//! [framework-crates]: https://docs.rs/objc2/latest/objc2/topics/about_generated/index.html +#![no_std] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] +// Update in Cargo.toml as well. +#![doc(html_root_url = "https://docs.rs/objc2-metal-performance-shaders/0.2.2")] + +#[cfg(feature = "alloc")] +extern crate alloc; + +#[cfg(feature = "std")] +extern crate std; + +mod generated; +#[cfg(feature = "MPSRayIntersectorTypes")] +mod packed; +#[allow(unused_imports, unreachable_pub)] +pub use self::generated::*; +#[cfg(feature = "MPSRayIntersectorTypes")] +pub use self::packed::MPSPackedFloat3; + +/// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimagebatch?language=objc) +#[cfg(feature = "MPSImage")] +pub type MPSImageBatch = objc2_foundation::NSArray; diff --git a/framework-crates/objc2-metal-performance-shaders/src/packed.rs b/framework-crates/objc2-metal-performance-shaders/src/packed.rs new file mode 100644 index 000000000..ccedc3397 --- /dev/null +++ b/framework-crates/objc2-metal-performance-shaders/src/packed.rs @@ -0,0 +1,34 @@ +use core::ffi::c_float; + +use objc2::encode::{Encode, Encoding, RefEncode}; + +/// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpspackedfloat3?language=objc) +/// +/// This is similar to `MTLPackedFloat3`. +#[repr(C)] +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct MPSPackedFloat3 { + pub x: c_float, + pub y: c_float, + pub z: c_float, +} + +unsafe impl Encode for MPSPackedFloat3 { + const ENCODING: Encoding = Encoding::Struct( + "_MPSPackedFloat3", + &[Encoding::Union( + "?", + &[ + Encoding::Struct( + "?", + &[c_float::ENCODING, c_float::ENCODING, c_float::ENCODING], + ), + Encoding::Array(3, &c_float::ENCODING), + ], + )], + ); +} + +unsafe impl RefEncode for MPSPackedFloat3 { + const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING); +} diff --git a/framework-crates/objc2-metal-performance-shaders/translation-config.toml b/framework-crates/objc2-metal-performance-shaders/translation-config.toml new file mode 100644 index 000000000..4e0de53ac --- /dev/null +++ b/framework-crates/objc2-metal-performance-shaders/translation-config.toml @@ -0,0 +1,61 @@ +framework = "MetalPerformanceShaders" +crate = "objc2-metal-performance-shaders" +required-dependencies = ["objc2-foundation", "objc2-metal"] +custom-lib-rs = true +macos = "10.13" +maccatalyst = "13.0" +ios = "9.0" +tvos = "9.0" +visionos = "1.0" + +# Defined in both MPSCore.MPSImage and MPSCore.MPSNDArray +typedef.MPSImageBatch.skipped = true + +# Needs SIMD types, which we cannot yet describe the ABI of in Rust +struct.MPSCustomKernelSourceInfo.skipped = true +typedef.MPSCustomKernelSourceInfo.skipped = true +struct.MPSCustomKernelInfo.skipped = true +typedef.MPSCustomKernelInfo.skipped = true +class.MPSNDArrayDescriptor.methods.dimensionOrder.skipped = true +struct.MPSImageHistogramInfo.skipped = true +typedef.MPSImageHistogramInfo.skipped = true +class.MPSImageHistogram.methods.minPixelThresholdValue.skipped = true +class.MPSImageHistogram.methods."setMinPixelThresholdValue:".skipped = true +class.MPSImageHistogram.methods.histogramInfo.skipped = true +class.MPSImageHistogram.methods."initWithDevice:histogramInfo:".skipped = true +class.MPSImageNormalizedHistogram.methods.histogramInfo.skipped = true +class.MPSImageNormalizedHistogram.methods."initWithDevice:histogramInfo:".skipped = true +class.MPSImageHistogramEqualization.methods.histogramInfo.skipped = true +class.MPSImageHistogramEqualization.methods."initWithDevice:histogramInfo:".skipped = true +class.MPSImageHistogramSpecification.methods.histogramInfo.skipped = true +class.MPSImageHistogramSpecification.methods."initWithDevice:histogramInfo:".skipped = true +struct.MPSImageKeypointData.skipped = true +typedef.MPSImageKeypointData.skipped = true +protocol.MPSCNNConvolutionDataSource.methods.rangesForUInt8Kernel.skipped = true +struct._MPSAxisAlignedBoundingBox.skipped = true +typedef.MPSAxisAlignedBoundingBox.skipped = true +class.MPSAccelerationStructure.methods.boundingBox.skipped = true +struct.MPSRayOriginDirection.skipped = true +typedef.MPSRayOriginDirection.skipped = true +struct.MPSIntersectionDistancePrimitiveIndexCoordinates.skipped = true +typedef.MPSIntersectionDistancePrimitiveIndexCoordinates.skipped = true +struct.MPSIntersectionDistancePrimitiveIndexBufferIndexCoordinates.skipped = true +typedef.MPSIntersectionDistancePrimitiveIndexBufferIndexCoordinates.skipped = true +struct.MPSIntersectionDistancePrimitiveIndexInstanceIndexCoordinates.skipped = true +typedef.MPSIntersectionDistancePrimitiveIndexInstanceIndexCoordinates.skipped = true +struct.MPSIntersectionDistancePrimitiveIndexBufferIndexInstanceIndexCoordinates.skipped = true +typedef.MPSIntersectionDistancePrimitiveIndexBufferIndexInstanceIndexCoordinates.skipped = true + +# tries to derive with `PartialEq` which fails because of `Bool` fields +# struct.MPSImageHistogramInfo.skipped = true + +# Uses unions internally +struct._MPSPackedFloat3.skipped = true +typedef.MPSPackedFloat3.skipped = true + +# Array in static is unimplemented +static.MPSFunctionConstantNoneArray.skipped = true + +# Unclear how to handle these (non-null return error methods). +class.MPSKeyedUnarchiver.methods."initForReadingFromData:error:".skipped = true +class.MPSKeyedUnarchiver.methods."initForReadingFromData:device:error:".skipped = true diff --git a/framework-crates/objc2-quartz-core/translation-config.toml b/framework-crates/objc2-quartz-core/translation-config.toml index f9f7724be..ec873a5fe 100644 --- a/framework-crates/objc2-quartz-core/translation-config.toml +++ b/framework-crates/objc2-quartz-core/translation-config.toml @@ -1,6 +1,5 @@ framework = "QuartzCore" crate = "objc2-quartz-core" -umbrella-header = "CoreAnimation.h" required-dependencies = ["objc2-foundation"] custom-lib-rs = true macos = "10.3" diff --git a/generated b/generated index 4d7199680..c3730c7a8 160000 --- a/generated +++ b/generated @@ -1 +1 @@ -Subproject commit 4d7199680294c260d78c2795ef661d4e9b5ec322 +Subproject commit c3730c7a8b298bebfe4f1713a9f1c332b7044906