Skip to content

Commit c3c4fae

Browse files
committed
ci : fixes
1 parent 729effe commit c3c4fae

File tree

6 files changed

+39
-60
lines changed

6 files changed

+39
-60
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,22 +518,41 @@ jobs:
518518
emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
519519
make
520520
521-
ios:
521+
ios-xcode-build:
522522
runs-on: macos-latest
523523

524-
strategy:
525-
matrix:
526-
build: [Release]
527-
528524
steps:
529-
- name: Clone
525+
- name: Checkout code
530526
uses: actions/checkout@v4
531527

532528
- name: Configure
533529
run: |
534530
cp models/for-tests-ggml-base.en.bin models/ggml-base.en.bin
535531
mkdir models/ggml-base.en-encoder.mlmodelc
536532
533+
- name: Build
534+
id: cmake_build
535+
run: |
536+
sysctl -a
537+
mkdir build
538+
cd build
539+
cmake -G Xcode .. \
540+
-DGGML_METAL_USE_BF16=ON \
541+
-DGGML_METAL_EMBED_LIBRARY=ON \
542+
-DWHISPER_BUILD_EXAMPLES=OFF \
543+
-DWHISPER_BUILD_TESTS=OFF \
544+
-DWHISPER_BUILD_SERVER=OFF \
545+
-DCMAKE_SYSTEM_NAME=iOS \
546+
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
547+
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
548+
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
549+
sudo cmake --install . --config Release
550+
551+
- name: xcodebuild for swift package
552+
id: xcodebuild
553+
run: |
554+
xcodebuild -scheme whisper-Package -destination 'generic/platform=iOS'
555+
537556
- name: Build objc example
538557
run: xcodebuild -project examples/whisper.objc/whisper.objc.xcodeproj -scheme whisper.objc -configuration ${{ matrix.build }} -sdk iphonesimulator build
539558

Package.swift

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,55 +14,6 @@ let package = Package(
1414
.library(name: "whisper", targets: ["whisper"]),
1515
],
1616
targets: [
17-
.target(
18-
name: "whisper",
19-
path: ".",
20-
exclude: [
21-
"build",
22-
"bindings",
23-
"cmake",
24-
"examples",
25-
"scripts",
26-
"models",
27-
"samples",
28-
"tests",
29-
"CMakeLists.txt",
30-
"Makefile",
31-
"ggml/src/ggml-metal/ggml-metal-embed.metal"
32-
],
33-
sources: [
34-
"ggml/src/ggml.c",
35-
"src/whisper.cpp",
36-
"ggml/src/ggml-aarch64.c",
37-
"ggml/src/ggml-alloc.c",
38-
"ggml/src/ggml-backend.cpp",
39-
"ggml/src/ggml-backend-reg.cpp",
40-
"ggml/src/ggml-cpu/ggml-cpu.c",
41-
"ggml/src/ggml-cpu/ggml-cpu.cpp",
42-
"ggml/src/ggml-cpu/ggml-cpu-aarch64.c",
43-
"ggml/src/ggml-cpu/ggml-cpu-quants.c",
44-
"ggml/src/ggml-quants.c",
45-
"ggml/src/ggml-threading.cpp",
46-
"ggml/src/ggml-metal/ggml-metal.m"
47-
],
48-
resources: [.process("ggml/src/ggml-metal/ggml-metal.metal")],
49-
publicHeadersPath: "spm-headers",
50-
cSettings: [
51-
.unsafeFlags(["-Wno-shorten-64-to-32", "-O3", "-DNDEBUG"]),
52-
.unsafeFlags(["-fno-objc-arc"]),
53-
.headerSearchPath("ggml/src"),
54-
.define("GGML_USE_ACCELERATE"),
55-
.define("GGML_USE_METAL")
56-
// NOTE: NEW_LAPACK will required iOS version 16.4+
57-
// We should consider add this in the future when we drop support for iOS 14
58-
// (ref: ref: https://developer.apple.com/documentation/accelerate/1513264-cblas_sgemm?language=objc)
59-
// .define("ACCELERATE_NEW_LAPACK"),
60-
// .define("ACCELERATE_LAPACK_ILP64")
61-
],
62-
linkerSettings: [
63-
.linkedFramework("Accelerate")
64-
]
65-
)
66-
],
67-
cxxLanguageStandard: .cxx11
17+
.systemLibrary(name: "whisper", pkgConfig: "whisper"),
18+
]
6819
)

Sources/whisper/module.modulemap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module whisper [system] {
2+
header "whisper.h"
3+
link "whisper"
4+
export *
5+
}

Sources/whisper/whisper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#pragma once
2+
3+
#include <whisper.h>
4+

cmake/whisper.pc.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
prefix=@CMAKE_INSTALL_PREFIX@
22
exec_prefix=${prefix}
3-
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
3+
libdir=${exec_prefix}/lib
44
includedir=${prefix}/include
55

66
Name: whisper
77
Description: Port of OpenAI's Whisper model in C/C++
88
Version: @PROJECT_VERSION@
9-
Libs: -L${libdir} -lwhisper
9+
Libs: -L${libdir} -lggml -lggml-base -lwhisper
1010
Cflags: -I${includedir}

examples/whisper.android/lib/src/main/jni/whisper/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
22

33
project(whisper.cpp)
44

5-
set(CMAKE_CXX_STANDARD 11)
5+
set(CMAKE_CXX_STANDARD 17)
66
set(WHISPER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../../../../../..)
77

88
# Path to external GGML, otherwise uses the copy in whisper.cpp.

0 commit comments

Comments
 (0)