Skip to content

Commit

Permalink
fix(ios, example): build .xcode.env.local in bootstrap script
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Mar 20, 2024
1 parent 15c4680 commit 5e87940
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ lib/
docs/API/.nojekyll

*.metallib
.xocde.env.local
1 change: 1 addition & 0 deletions example/ios/.xcode.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export NODE_BINARY=/var/folders/4z/1d45cfts3936kdm7v9jl349r0000gn/T/yarn--1710915419250-0.4370488244476127/node
9 changes: 8 additions & 1 deletion scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,18 @@ patch -p0 -d ./cpp < ./scripts/log.h.patch
patch -p0 -d ./cpp < ./scripts/llama.cpp.patch
patch -p0 -d ./cpp < ./scripts/ggml-metal.m.patch

# Build metallib (~1.4MB)

if [ "$OS" = "Darwin" ]; then
# Build metallib (~1.4MB)
cd llama.cpp
xcrun --sdk iphoneos metal -c ggml-metal.metal -o ggml-metal.air
xcrun --sdk iphoneos metallib ggml-metal.air -o ggml-llama.metallib
rm ggml-metal.air
cp ./ggml-llama.metallib ../cpp/ggml-llama.metallib

cd -

# Generate .xcode.env.local in iOS example
cd example/ios
echo export NODE_BINARY=$(command -v node) > .xcode.env.local
fi

0 comments on commit 5e87940

Please sign in to comment.