-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
31 lines (28 loc) · 891 Bytes
/
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
fn main() {
println!(
"cargo:rustc-env=HULK_BUILD_TIME={}",
chrono::Utc::now().format("%Y-%m-%d %H:%M:%S").to_string()
);
tonic_build::configure()
.out_dir("src/proto")
.compile(
&[
"proto/common.proto",
"proto/peer.proto",
"proto/storage.proto",
],
&["proto"],
)
.unwrap();
print_link_search_path();
}
fn print_link_search_path() {
if std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "windows" {
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
if std::env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "x86_64" {
println!("cargo:rustc-link-search=native={}/lib/x64", manifest_dir);
} else {
println!("cargo:rustc-link-search=native={}/lib", manifest_dir);
}
}
}