Skip to content

Commit 32864c8

Browse files
mdestagnollinxiaodong
authored andcommitted
whisper: add xcframework build script (ggml-org#2873)
* whisper: add xcframework build script * added apple validation scripts * fixed Readme * validation script fix
1 parent 9a441b3 commit 32864c8

File tree

19 files changed

+3809
-54
lines changed

19 files changed

+3809
-54
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,43 @@ jobs:
9797
macOS-latest:
9898
runs-on: macOS-latest
9999

100+
strategy:
101+
matrix:
102+
destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
103+
100104
steps:
101105
- name: Clone
106+
id: checkout
102107
uses: actions/checkout@v4
103108

109+
- name: ccache
110+
uses: hendrikmuhs/[email protected]
111+
with:
112+
key: macOS-latest-swift
113+
evict-old-files: 1d
114+
104115
- name: Dependencies
105116
run: |
106117
brew update
107118
brew install sdl2 cmake
108119
109120
- name: Build
110121
run: |
111-
cmake -B build
112-
cmake --build build --config Release
122+
sysctl -a
123+
cmake -B build -G Xcode \
124+
-DGGML_METAL_USE_BF16=ON \
125+
-DGGML_METAL_EMBED_LIBRARY=ON \
126+
-DWHISPER_BUILD_EXAMPLES=OFF \
127+
-DWHISPER_BUILD_TESTS=OFF \
128+
-DWHISPER_BUILD_SERVER=OFF \
129+
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
130+
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
131+
132+
- name: xcodebuild for swift package
133+
id: xcodebuild
134+
run: |
135+
./build-xcframework.sh
136+
113137
114138
# freeBSD-latest:
115139
# runs-on: macos-12
@@ -671,18 +695,17 @@ jobs:
671695
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
672696
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
673697
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
674-
sudo cmake --install . --config Release
675698
676699
- name: xcodebuild for swift package
677700
id: xcodebuild
678701
run: |
679-
xcodebuild -scheme whisper-Package -destination 'generic/platform=iOS'
702+
./build-xcframework.sh
680703
681704
- name: Build objc example
682-
run: xcodebuild -project examples/whisper.objc/whisper.objc.xcodeproj -scheme whisper.objc -configuration ${{ matrix.build }} -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO build
705+
run: xcodebuild -project examples/whisper.objc/whisper.objc.xcodeproj -scheme whisper.objc -configuration ${{ matrix.build }} -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO FRAMEWORK_FOLDER_PATH=./build-ios build
683706

684707
- name: Build swiftui example
685-
run: xcodebuild -project examples/whisper.swiftui/whisper.swiftui.xcodeproj -scheme WhisperCppDemo -configuration ${{ matrix.build }} -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' build
708+
run: xcodebuild -project examples/whisper.swiftui/whisper.swiftui.xcodeproj -scheme WhisperCppDemo -configuration ${{ matrix.build }} -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' FRAMEWORK_FOLDER_PATH=./build-ios build
686709

687710
android:
688711
runs-on: ubuntu-22.04

Package.swift

Lines changed: 0 additions & 19 deletions
This file was deleted.

Sources/whisper/module.modulemap

Lines changed: 0 additions & 5 deletions
This file was deleted.

Sources/whisper/whisper.h

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)