-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_bindings.sh
More file actions
21 lines (14 loc) · 900 Bytes
/
Copy pathbuild_bindings.sh
File metadata and controls
21 lines (14 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
# Auto-generated build helper that compiles the Mojo kernels into shared
# libraries and then compiles the C-based Python bindings into `bindings.so`.
set -euo pipefail
# ---------------------------------------------------------------------------
# 1. Compile Mojo kernels → shared libraries (*.so)
# ---------------------------------------------------------------------------
magic run mojo build --emit shared-lib kernels/make_4d_causal_mask.mojo
magic run mojo build --emit shared-lib kernels/apply_rotary_emb.mojo
# ---------------------------------------------------------------------------
# 2. Compile C Python extension
# ---------------------------------------------------------------------------
gcc -shared -fPIC $(python3-config --includes) bindings.c -o bindings.so -ldl
echo "[build_bindings.sh] Build complete: bindings.so + kernel shared libs generated."