aien-sovereign-core
Autonomous sovereign intelligence engine and runtime core for NVIDIA DGX Spark
Brought by drakestapleton
aien-sovereign-core / crates / spark-max-cabi / build.rs
| 1 | use std::process::Command; |
| 2 | use std::path::Path; |
| 3 | |
| 4 | fn main() { |
| 5 | println!("cargo:rerun-if-changed=mojo/spark_max_bridge.mojo"); |
| 6 | let out_dir = std::env::var("OUT_DIR").unwrap(); |
| 7 | let dest_path = Path::new(&out_dir).join("libspark_max.so"); |
| 8 | |
| 9 | if let Ok(status) = Command::new("mojo") |
| 10 | .args(&["build", "--emit", "shared-lib", "mojo/spark_max_bridge.mojo", "-o"]) |
| 11 | .arg(&dest_path) |
| 12 | .status() |
| 13 | { |
| 14 | if status.success() { |
| 15 | println!("cargo:rustc-env=SPARK_MAX_SO_BUILT={}", dest_path.display()); |
| 16 | let _ = std::fs::copy(&dest_path, "mojo/libspark_max.so"); |
| 17 | } else { |
| 18 | println!("cargo:warning=mojo build exited with non-zero status"); |
| 19 | } |
| 20 | } else { |
| 21 | println!("cargo:warning=mojo binary not found on PATH, skipping libspark_max.so build"); |
| 22 | } |
| 23 | } |