| 1 | use std::path::PathBuf; |
| 2 | |
| 3 | fn main() { |
| 4 | println!("cargo::rustc-cdylib-link-arg=/EXPORT:OrtGetApiBase"); |
| 5 | // The xwin SDK names these libraries all lower case; ort-sys asks for mixed case on a case-sensitive file system. |
| 6 | let Some(sdk) = std::env::var("LIB").ok().and_then(|paths| paths.split(';').map(PathBuf::from).find(|path| path.join("pathcch.lib").exists())) else { return }; |
| 7 | let shims = PathBuf::from(std::env::var("OUT_DIR").expect("out dir")).join("case-shims"); |
| 8 | std::fs::create_dir_all(&shims).expect("shim dir"); |
| 9 | for (wanted, existing) in [("DirectML.lib", "directml.lib"), ("PathCch.lib", "pathcch.lib")] { |
| 10 | let link = shims.join(wanted); |
| 11 | let _ = std::fs::remove_file(&link); |
| 12 | #[cfg(unix)] |
| 13 | std::os::unix::fs::symlink(sdk.join(existing), &link).expect("shim link"); |
| 14 | } |
| 15 | println!("cargo::rustc-link-search=native={}", shims.display()); |
| 16 | } |