Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Empty file.
Empty file.
36 changes: 35 additions & 1 deletion Package.swift.template
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,6 +46,15 @@ let products = deliverables([
"sqlite3",
],
],
"backend_mlx": [
"sha256": "__SHA256_backend_mlx__",
"sha256" + debug_suffix: "__SHA256_backend_mlx_debug__",
"frameworks": [
"Metal",
"Foundation",
"QuartzCore",
],
],
"backend_xnnpack": [
"sha256": "__SHA256_backend_xnnpack__",
"sha256" + debug_suffix: "__SHA256_backend_xnnpack_debug__",
Expand DownExpand Up@@ -134,11 +143,36 @@ for (key, value) in products {
packageTargets.append(target)
}

// The MLX Metal kernel libraries, one per platform slice, shipped as a single
// resource bundle both MLX products share. Kept out of the generic loop above so
// there is one bundle (executorch_backend_mlx_resources.bundle) rather than a
// separate debug copy, and so the release and debug delegates resolve the same
// name. Each slice's MLX binary asks for its own mlx-<slice>.metallib.
//
// The release job commits all three files before publishing, so they are declared
// unconditionally. A missing one is only reported at package-resolution time and
// does not fail the build, so the release job has to assert they arrived.
let mlxMetallibSlices = ["mlx-ios", "mlx-ios-simulator", "mlx-macos"]
if products.keys.contains("backend_mlx") {
packageTargets.append(.target(
name: "backend_mlx_resources",
path: ".Package.swift/backend_mlx_resources",
resources: mlxMetallibSlices.map { .copy("\($0).metallib") }
))
for suffix in ["", debug_suffix] {
if let index = packageTargets.firstIndex(where: {
$0.name == "backend_mlx\(suffix)\(dependencies_suffix)"
}) {
packageTargets[index].dependencies.append(.target(name: "backend_mlx_resources"))
}
}
}

let package = Package(
name: "executorch",
platforms: [
.iOS(.v17),
.macOS(.v12),
.macOS(.v14),
],
products: packageProducts,
targets: packageTargets
Expand Down
Loading