aboutsummaryrefslogtreecommitdiffhomepage
path: root/level_zero-sys/build.rs
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2021-01-08 17:17:46 +0100
committerGitHub <[email protected]>2021-01-08 17:17:46 +0100
commit078ae20c2c0aff93858eeb69d0c46dad4d997998 (patch)
tree38d2313c5bab64e2a84c90a219bd60ce6808f116 /level_zero-sys/build.rs
parent2c0e9b912fe341bd1e513614014fa43b666d257d (diff)
downloadZLUDA-078ae20c2c0aff93858eeb69d0c46dad4d997998.tar.gz
ZLUDA-078ae20c2c0aff93858eeb69d0c46dad4d997998.zip
Improve build procedure and instructions (#28)
Fixes issues pointed out in #27: * spirv_tools-sys was build in non-test profiles * By default ZLUDA dll has a wrong name * We relied on third-party OpenCL installation on Windows * We encouraged building debug configuration * We didn't provide build information for developers (cmake, python, submodules)
Diffstat (limited to 'level_zero-sys/build.rs')
-rw-r--r--level_zero-sys/build.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/level_zero-sys/build.rs b/level_zero-sys/build.rs
index 4a638ec..0d2488c 100644
--- a/level_zero-sys/build.rs
+++ b/level_zero-sys/build.rs
@@ -1,18 +1,17 @@
use env::VarError;
use std::{env, path::PathBuf};
-fn main() -> Result<(), VarError> {
+fn main() -> Result<(), VarError> {
println!("cargo:rustc-link-lib=dylib=ze_loader");
- if env::var("CARGO_CFG_WINDOWS").is_ok() {
+ if cfg!(windows) {
let env = env::var("CARGO_CFG_TARGET_ENV")?;
- if env == "gnu" {
- println!("cargo:rustc-link-search=native=C:\\Windows\\System32");
- } else {
+ if env == "msvc" {
let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
- path.push("src");
+ path.push("lib");
println!("cargo:rustc-link-search=native={}", path.display());
+ } else {
+ println!("cargo:rustc-link-search=native=C:\\Windows\\System32");
};
}
- println!("cargo:rerun-if-changed=build.rs");
Ok(())
}