-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_voxtral_lib.sh
More file actions
executable file
·34 lines (25 loc) · 970 Bytes
/
build_voxtral_lib.sh
File metadata and controls
executable file
·34 lines (25 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
DIR="$SCRIPT_DIR/voxtral.c"
CFLAGS="-Wall -Wextra -O3 -march=native -ffast-math -DUSE_BLAS -DUSE_METAL -DACCELERATE_NEW_LAPACK"
OBJCFLAGS="$CFLAGS -fobjc-arc"
# Library source files to compile
SRCS="voxtral.c voxtral_kernels.c voxtral_audio.c voxtral_encoder.c voxtral_decoder.c voxtral_tokenizer.c voxtral_safetensors.c voxtral_mic_macos.c"
cd "$DIR"
echo "==> Generating voxtral_shaders_source.h from Metal shader..."
xxd -i voxtral_shaders.metal > voxtral_shaders_source.h
echo "==> Compiling C sources (MPS backend)..."
OBJS=""
for src in $SRCS; do
obj="${src%.c}.mps.o"
echo " $src -> $obj"
clang $CFLAGS -c -o "$obj" "$src"
OBJS="$OBJS $obj"
done
echo "==> Compiling Objective-C Metal backend..."
clang $OBJCFLAGS -c -o voxtral_metal.o voxtral_metal.m
OBJS="$OBJS voxtral_metal.o"
echo "==> Archiving libvoxtral.a..."
ar rcs libvoxtral.a $OBJS
echo "Done: $DIR/libvoxtral.a"