Skip to content

Commit b66eca7

Browse files
committed
Add visionOS slices to the XCFramework
Archive Compute for visionOS and the visionOS Simulator and include both in Compute.xcframework. Use canImport(Darwin) for the attribute vtable and type description branches in Swift. The C headers select these declarations with TARGET_OS_MAC, so visionOS must use the Darwin branch as well.
1 parent b129f65 commit b66eca7

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎Scripts/create-xcframework.sh‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,28 @@ xcodebuild archive \
2525
-archivePath "$BUILD_DIR/Archives/Compute-iOS-Simulator.xcarchive" \
2626
ENABLE_USER_SCRIPT_SANDBOXING=NO
2727

28+
xcodebuild archive \
29+
-project Xcode/Compute.xcodeproj \
30+
-scheme Compute \
31+
-destination "generic/platform=visionOS" \
32+
-archivePath "$BUILD_DIR/Archives/Compute-visionOS.xcarchive" \
33+
ENABLE_USER_SCRIPT_SANDBOXING=NO
34+
35+
xcodebuild archive \
36+
-project Xcode/Compute.xcodeproj \
37+
-scheme Compute \
38+
-destination "generic/platform=visionOS Simulator" \
39+
-archivePath "$BUILD_DIR/Archives/Compute-visionOS-Simulator.xcarchive" \
40+
ENABLE_USER_SCRIPT_SANDBOXING=NO
41+
2842
rm -rf "$BUILD_DIR/Frameworks/Compute.xcframework"
2943

3044
xcodebuild -create-xcframework \
3145
-archive "$BUILD_DIR/Archives/Compute-macOS.xcarchive" -framework Compute.framework \
3246
-archive "$BUILD_DIR/Archives/Compute-iOS.xcarchive" -framework Compute.framework \
3347
-archive "$BUILD_DIR/Archives/Compute-iOS-Simulator.xcarchive" -framework Compute.framework \
48+
-archive "$BUILD_DIR/Archives/Compute-visionOS.xcarchive" -framework Compute.framework \
49+
-archive "$BUILD_DIR/Archives/Compute-visionOS-Simulator.xcarchive" -framework Compute.framework \
3450
-output "$BUILD_DIR/Frameworks/Compute.xcframework"
3551

3652
# Post-process swiftinterface files to replace ComputeCxx references with Compute

‎Sources/Compute/Attribute/AttributeType.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extension _AttributeType {
3232
vtable.pointee.self_destroy = { attributeType, body in
3333
attributeType.pointee.attributeBody._destroySelf(body)
3434
}
35-
#if os(iOS) || os(macOS)
35+
#if canImport(Darwin)
3636
vtable.pointee.self_description = { attributeType, body in
3737
let description: String
3838
if let selfType = attributeType.pointee.self_id.type

‎Sources/Compute/Runtime/Metadata.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension Metadata {
4545
extension Metadata: @retroactive CustomStringConvertible {
4646

4747
public var description: String {
48-
#if os(iOS) || os(macOS)
48+
#if canImport(Darwin)
4949
return __IAGTypeDescription(self) as String
5050
#else
5151
return String(__IAGTypeCopyDescription(self))

0 commit comments

Comments
 (0)