-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
32 lines (27 loc) · 1.01 KB
/
build.rs
File metadata and controls
32 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// build.rs
use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
#[cfg(target_os = "windows")]
println!("cargo:rustc-link-lib=advapi32");
if env::var("CARGO_FEATURE_DENOISE").is_ok() {
if let Ok(oidn_dir) = env::var("OIDN_DIR") {
let bin = PathBuf::from(&oidn_dir).join("bin");
// target/{debug|release}/
let profile = env::var("PROFILE").unwrap();
let out_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.join("target")
.join(&profile);
fs::create_dir_all(&out_dir).ok();
for dll in &["OpenImageDenoise.dll", "OpenImageDenoise_core.dll",
"OpenImageDenoise_device_cpu.dll", "tbb12.dll"] {
let src = bin.join(dll);
let dst = out_dir.join(dll);
if src.exists() && !dst.exists() {
fs::copy(&src, &dst).ok();
}
}
}
}
}