lispm-llm / native-api /build.rs
Ryan.K
Add reusable Emacs retraining workflow and C FFI API
2109241 unverified
Raw History Blame Contribute Delete
588 Bytes
//! Locate the same LibTorch libraries used by the independent native C ABI.
use std::{env, path::PathBuf};
/// Embed a runtime search path in this library rather than its dependencies.
fn main() {
println!("cargo:rerun-if-env-changed=LIBTORCH");
if let Some(directory) = env::var_os("LIBTORCH") {
let library = PathBuf::from(directory).join("lib");
if matches!(
env::var("CARGO_CFG_TARGET_OS").as_deref(),
Ok("macos" | "linux")
) {
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", library.display());
}
}
}