forked from hyperledger-archives/indy-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
35 lines (28 loc) · 1.19 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
32
33
34
35
use std::env;
use std::fs;
use std::path::Path;
fn main() {
let target = env::var("TARGET").unwrap();
println!("target={}", target);
if target.find("-windows-").is_some() {
println!("cargo:rustc-link-lib=indy.dll");
let profile = env::var("PROFILE").unwrap();
println!("profile={}", profile);
let output_dir = env::var("OUT_DIR").unwrap();
println!("output_dir={}", output_dir);
let output_dir = Path::new(output_dir.as_str());
let indy_dir = env::var("INDY_DIR").unwrap_or(format!("..\\libindy\\target\\{}", profile));
println!("indy_dir={}", indy_dir);
let indy_dir = Path::new(indy_dir.as_str());
let dst = output_dir.join("..\\..\\..");
println!("cargo:rustc-flags=-L {}", indy_dir.as_os_str().to_str().unwrap());
let files = vec!["indy.dll", "libeay32md.dll", "libsodium.dll", "libzmq.dll", "ssleay32md.dll"];
for f in files.iter() {
if let Ok(_) = fs::copy(&indy_dir.join(f), &dst.join(f)) {
println!("copy {} -> {}", &indy_dir.join(f).display(), &dst.join(f).display());
}
}
} else {
println!("cargo:rustc-link-lib=indy");
}
}