openclaw-rs
High-performance sovereign agent runtime in native Rust and Mojo for NVIDIA DGX Spark
Brought by drakestapleton
openclaw-rs / build.rs
| 1 | use std::path::Path; |
| 2 | use std::process::Command; |
| 3 | |
| 4 | fn main() { |
| 5 | println!("cargo:rerun-if-changed=mojo/openclaw_simd.mojo"); |
| 6 | let out_dir = std::env::var("OUT_DIR").unwrap(); |
| 7 | let dest_path = Path::new(&out_dir).join("libopenclaw_simd.so"); |
| 8 | |
| 9 | if let Ok(status) = Command::new("mojo") |
| 10 | .args([ |
| 11 | "build", |
| 12 | "--emit", |
| 13 | "shared-lib", |
| 14 | "mojo/openclaw_simd.mojo", |
| 15 | "-o", |
| 16 | ]) |
| 17 | .arg(&dest_path) |
| 18 | .status() |
| 19 | { |
| 20 | if status.success() { |
| 21 | println!( |
| 22 | "cargo:rustc-env=OPENCLAW_SIMD_SO_BUILT={}", |
| 23 | dest_path.display() |
| 24 | ); |
| 25 | let _ = std::fs::copy(&dest_path, "mojo/libopenclaw_simd.so"); |
| 26 | } else { |
| 27 | println!("cargo:warning=mojo build exited with non-zero status"); |
| 28 | } |
| 29 | } else { |
| 30 | println!("cargo:warning=mojo binary not found on PATH, skipping libopenclaw_simd.so build"); |
| 31 | } |
| 32 | } |