diff options
Diffstat (limited to 'hip_runtime-sys/build.rs')
-rw-r--r-- | hip_runtime-sys/build.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/hip_runtime-sys/build.rs b/hip_runtime-sys/build.rs index 9c3d9b4..3bc1250 100644 --- a/hip_runtime-sys/build.rs +++ b/hip_runtime-sys/build.rs @@ -1,9 +1,21 @@ use std::env::VarError; +use std::{env, path::PathBuf}; fn main() -> Result<(), VarError> { println!("cargo:rustc-link-lib=dylib=amdhip64"); - //println!("cargo:rustc-link-search=native=/opt/rocm/lib/"); - println!("cargo:rustc-link-search=native=/home/ubuntu/hipamd/build/lib"); - println!("cargo:rustc-link-search=native=/home/vosen/hipamd/build/lib"); + if cfg!(windows) { + let env = env::var("CARGO_CFG_TARGET_ENV")?; + if env == "msvc" { + let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?); + path.push("lib"); + println!("cargo:rustc-link-search=native={}", path.display()); + } else { + println!("cargo:rustc-link-search=native=C:\\Windows\\System32"); + }; + } else { + //println!("cargo:rustc-link-search=native=/opt/rocm/lib/"); + println!("cargo:rustc-link-search=native=/home/ubuntu/hipamd/build/lib"); + println!("cargo:rustc-link-search=native=/home/vosen/hipamd/build/lib"); + } Ok(()) } |