aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda/build.rs
blob: 94c2c6f49e1217fd3336185ef92e1cba2f62551c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use env::VarError;
use std::{env, path::PathBuf};

// HACK ALERT
// This is a temporary hack to to make sure that linker does not pick up
// NVIDIA OpenCL .lib using paths injected by cl-sys

fn main() -> Result<(), VarError> {
    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");
        };
    }
    Ok(())
}