Skip to content

Commit 2a9c9d6

Browse files
committed
chore(whisper): Build on Darwin
Signed-off-by: Richard Palethorpe <[email protected]>
1 parent 8963110 commit 2a9c9d6

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

.github/workflows/backend.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,11 @@ jobs:
975975
tag-suffix: "-metal-darwin-arm64-mlx-audio"
976976
build-type: "mps"
977977
- backend: "stablediffusion-ggml"
978-
tag-suffix: "-metal-darwin-arm64-mlx-audio"
978+
tag-suffix: "-metal-darwin-arm64-stablediffusion-ggml"
979+
build-type: "metal"
980+
lang: "go"
981+
- backend: "whisper"
982+
tag-suffix: "-metal-darwin-arm64-whisper"
979983
build-type: "metal"
980984
lang: "go"
981985
with:

backend/go/whisper/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
66
add_subdirectory(./sources/whisper.cpp)
77

88
add_library(gowhisper MODULE gowhisper.cpp)
9-
target_link_libraries(gowhisper PRIVATE whisper ggml stdc++fs)
9+
target_link_libraries(gowhisper PRIVATE whisper ggml)
10+
11+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
12+
target_link_libraries(gosd PRIVATE stdc++fs)
13+
endif()
1014

1115
set_property(TARGET gowhisper PROPERTY CXX_STANDARD 17)
1216
set_target_properties(gowhisper PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

backend/go/whisper/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ libgowhisper.so: sources/whisper.cpp CMakeLists.txt gowhisper.cpp gowhisper.h
6868
whisper: main.go gowhisper.go libgowhisper.so
6969
CGO_ENABLED=0 $(GOCMD) build -tags "$(GO_TAGS)" -o whisper ./
7070

71-
package:
71+
package: whisper
7272
bash package.sh
7373

74-
build: whisper package
74+
build: package
7575

7676
clean:
7777
rm -rf libgowhisper.o build whisper

backend/go/whisper/package.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ CURDIR=$(dirname "$(realpath $0)")
1010
# Create lib directory
1111
mkdir -p $CURDIR/package/lib
1212

13-
cp -avrf $CURDIR/whisper $CURDIR/libgowhisper.so $CURDIR/package/
14-
cp -rfv $CURDIR/run.sh $CURDIR/package/
13+
cp -avf $CURDIR/whisper $CURDIR/libgowhisper.so $CURDIR/package/
14+
cp -fv $CURDIR/run.sh $CURDIR/package/
1515

1616
# Detect architecture and copy appropriate libraries
1717
if [ -f "/lib64/ld-linux-x86-64.so.2" ]; then
@@ -42,6 +42,8 @@ elif [ -f "/lib/ld-linux-aarch64.so.1" ]; then
4242
cp -arfLv /lib/aarch64-linux-gnu/libdl.so.2 $CURDIR/package/lib/libdl.so.2
4343
cp -arfLv /lib/aarch64-linux-gnu/librt.so.1 $CURDIR/package/lib/librt.so.1
4444
cp -arfLv /lib/aarch64-linux-gnu/libpthread.so.0 $CURDIR/package/lib/libpthread.so.0
45+
elif [ $(uname -s) = "Darwin" ]; then
46+
echo "Detected Darwin"
4547
else
4648
echo "Error: Could not detect architecture"
4749
exit 1

0 commit comments

Comments
 (0)