Skip to content

Commit f0efd02

Browse files
authored
ios : Remove #if arch(arm) check for using Metal (#1561)
1 parent 3c28d1a commit f0efd02

File tree

1 file changed

+15
-31
lines changed

1 file changed

+15
-31
lines changed

Package.swift

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,22 @@
22

33
import PackageDescription
44

5-
#if arch(arm) || arch(arm64)
6-
let platforms: [SupportedPlatform]? = [
7-
.macOS(.v12),
8-
.iOS(.v14),
9-
.watchOS(.v4),
10-
.tvOS(.v14)
11-
]
12-
let exclude: [String] = []
13-
let resources: [Resource] = [
14-
.process("ggml-metal.metal")
15-
]
16-
let additionalSources: [String] = ["ggml-metal.m"]
17-
let additionalSettings: [CSetting] = [
18-
.unsafeFlags(["-fno-objc-arc"]),
19-
.define("GGML_USE_METAL")
20-
]
21-
#else
22-
let platforms: [SupportedPlatform]? = nil
23-
let exclude: [String] = ["ggml-metal.metal"]
24-
let resources: [Resource] = []
25-
let additionalSources: [String] = []
26-
let additionalSettings: [CSetting] = []
27-
#endif
28-
295
let package = Package(
306
name: "whisper",
31-
platforms: platforms,
7+
platforms: [
8+
.macOS(.v12),
9+
.iOS(.v14),
10+
.watchOS(.v4),
11+
.tvOS(.v14)
12+
],
3213
products: [
3314
.library(name: "whisper", targets: ["whisper"]),
3415
],
3516
targets: [
3617
.target(
3718
name: "whisper",
3819
path: ".",
39-
exclude: exclude + [
20+
exclude: [
4021
"bindings",
4122
"cmake",
4223
"coreml",
@@ -55,19 +36,22 @@ let package = Package(
5536
"whisper.cpp",
5637
"ggml-alloc.c",
5738
"ggml-backend.c",
58-
"ggml-quants.c"
59-
] + additionalSources,
60-
resources: resources,
39+
"ggml-quants.c",
40+
"ggml-metal.m"
41+
],
42+
resources: [.process("ggml-metal.metal")],
6143
publicHeadersPath: "spm-headers",
6244
cSettings: [
6345
.unsafeFlags(["-Wno-shorten-64-to-32", "-O3", "-DNDEBUG"]),
64-
.define("GGML_USE_ACCELERATE")
46+
.define("GGML_USE_ACCELERATE"),
47+
.unsafeFlags(["-fno-objc-arc"]),
48+
.define("GGML_USE_METAL")
6549
// NOTE: NEW_LAPACK will required iOS version 16.4+
6650
// We should consider add this in the future when we drop support for iOS 14
6751
// (ref: ref: https://developer.apple.com/documentation/accelerate/1513264-cblas_sgemm?language=objc)
6852
// .define("ACCELERATE_NEW_LAPACK"),
6953
// .define("ACCELERATE_LAPACK_ILP64")
70-
] + additionalSettings,
54+
],
7155
linkerSettings: [
7256
.linkedFramework("Accelerate")
7357
]

0 commit comments

Comments
 (0)