#!/bin/bash # build_vindex_bench.sh — build the vindex_bench oracle/proof harness, with the # real Metal batch-cosine bridge on Darwin and a zero-dependency CPU stub # everywhere else. Mirrors the two-step recipe documented in vindex_bench.c's # own header comment; this script exists so that recipe is one command, not a # copy-pasted paragraph. # # Usage: ./build_vindex_bench.sh [output_path] set -euo pipefail cd "$(dirname "$0")" OUT="${1:-./vindex_bench}" CC="${CC:-cc}" if [ "$(uname -s)" = "Darwin" ]; then echo "== Darwin: building with the real Metal bridge ==" "$CC" -O2 -std=c11 -x objective-c -c eg_metal_cosine.m -o /tmp/eg_metal_cosine.o \ -framework Metal -framework Foundation "$CC" -O2 -std=c11 -w vindex_bench.c engram_vindex.c /tmp/eg_metal_cosine.o -lm \ -framework Metal -framework Foundation -o "$OUT" else echo "== non-Darwin: building with the CPU-only stub (no Metal) ==" "$CC" -O2 -std=c11 -w vindex_bench.c engram_vindex.c eg_metal_cosine_stub.c -lm -o "$OUT" fi echo "built: $OUT"