//! 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()); } } }