-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.rs
31 lines (27 loc) · 1.01 KB
/
build.rs
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
use std::env;
use std::fs;
use std::path::Path;
fn main() {
let target = env::var("TARGET").unwrap();
println!("target={}", target);
match target.find("-windows-") {
Some(..) => {
// do not build c-code on windows, use binaries
let output_dir = env::var("OUT_DIR").unwrap();
let prebuilt_dir = env::var("SOVRIN_PREBUILT_DEPS_DIR").unwrap();
let dst = Path::new(&output_dir[..]).join("..\\..\\..");
let prebuilt = Path::new(&prebuilt_dir[..]);
println!("cargo:rustc-link-search=native={}", prebuilt_dir);
println!("cargo:rustc-flags=-L {}/lib", prebuilt_dir);
println!("cargo:include={}/include", prebuilt_dir);
let files = vec![ "libeay32md.dll", "libsodium.dll", "libzmq.dll", "ssleay32md.dll" ];
for f in files.iter() {
if let Ok(_) = fs::copy(&prebuilt.join(f), &dst.join(f)) {
println!("copy {} -> {}", &prebuilt.join(f).display(), &dst.join(f).display());
}
}
return;
},
None => {}
}
}