finnvoorhees commited on
Commit
3a600be
·
unverified ·
1 Parent(s): 3931068

ios : Remove `#if arch(arm)` check for using Metal (#1561)

Browse files
Files changed (1) hide show
  1. Package.swift +15 -31
Package.swift CHANGED
@@ -2,33 +2,14 @@
2
 
3
  import PackageDescription
4
 
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
-
29
  let package = Package(
30
  name: "whisper",
31
- platforms: platforms,
 
 
 
 
 
32
  products: [
33
  .library(name: "whisper", targets: ["whisper"]),
34
  ],
@@ -36,7 +17,7 @@ let package = Package(
36
  .target(
37
  name: "whisper",
38
  path: ".",
39
- exclude: exclude + [
40
  "bindings",
41
  "cmake",
42
  "coreml",
@@ -55,19 +36,22 @@ let package = Package(
55
  "whisper.cpp",
56
  "ggml-alloc.c",
57
  "ggml-backend.c",
58
- "ggml-quants.c"
59
- ] + additionalSources,
60
- resources: resources,
 
61
  publicHeadersPath: "spm-headers",
62
  cSettings: [
63
  .unsafeFlags(["-Wno-shorten-64-to-32", "-O3", "-DNDEBUG"]),
64
- .define("GGML_USE_ACCELERATE")
 
 
65
  // NOTE: NEW_LAPACK will required iOS version 16.4+
66
  // We should consider add this in the future when we drop support for iOS 14
67
  // (ref: ref: https://developer.apple.com/documentation/accelerate/1513264-cblas_sgemm?language=objc)
68
  // .define("ACCELERATE_NEW_LAPACK"),
69
  // .define("ACCELERATE_LAPACK_ILP64")
70
- ] + additionalSettings,
71
  linkerSettings: [
72
  .linkedFramework("Accelerate")
73
  ]
 
2
 
3
  import PackageDescription
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  let package = Package(
6
  name: "whisper",
7
+ platforms: [
8
+ .macOS(.v12),
9
+ .iOS(.v14),
10
+ .watchOS(.v4),
11
+ .tvOS(.v14)
12
+ ],
13
  products: [
14
  .library(name: "whisper", targets: ["whisper"]),
15
  ],
 
17
  .target(
18
  name: "whisper",
19
  path: ".",
20
+ exclude: [
21
  "bindings",
22
  "cmake",
23
  "coreml",
 
36
  "whisper.cpp",
37
  "ggml-alloc.c",
38
  "ggml-backend.c",
39
+ "ggml-quants.c",
40
+ "ggml-metal.m"
41
+ ],
42
+ resources: [.process("ggml-metal.metal")],
43
  publicHeadersPath: "spm-headers",
44
  cSettings: [
45
  .unsafeFlags(["-Wno-shorten-64-to-32", "-O3", "-DNDEBUG"]),
46
+ .define("GGML_USE_ACCELERATE"),
47
+ .unsafeFlags(["-fno-objc-arc"]),
48
+ .define("GGML_USE_METAL")
49
  // NOTE: NEW_LAPACK will required iOS version 16.4+
50
  // We should consider add this in the future when we drop support for iOS 14
51
  // (ref: ref: https://developer.apple.com/documentation/accelerate/1513264-cblas_sgemm?language=objc)
52
  // .define("ACCELERATE_NEW_LAPACK"),
53
  // .define("ACCELERATE_LAPACK_ILP64")
54
+ ],
55
  linkerSettings: [
56
  .linkedFramework("Accelerate")
57
  ]