#!/bin/sh # Build the checked-out llama.cpp fork with the Apple Metal backend used by gem. set -eu root=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd) llama_dir=${GEM_LLAMA_CPP_DIR:-"$root/../qwen38-llama-bench/llama.cpp"} build_dir=${GEM_LLAMA_BUILD_DIR:-"$llama_dir/build-gem-metal"} if [ ! -f "$llama_dir/CMakeLists.txt" ]; then echo "gem: llama.cpp source not found at $llama_dir" >&2 echo "set GEM_LLAMA_CPP_DIR to the DeepSeek-V4-enabled llama.cpp checkout" >&2 exit 1 fi cmake -S "$llama_dir" -B "$build_dir" -DGGML_METAL=ON -DLLAMA_BUILD_SERVER=ON \ -DLLAMA_BUILD_TOOLS=ON -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF cmake --build "$build_dir" --config Release