-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
40 lines (31 loc) · 1.12 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
36
37
38
39
40
use std::env;
use std::path::Path;
fn main() -> miette::Result<()> {
let wrapper_path = std::path::PathBuf::from("./");
let sta_path = env::var("OPENSTA_DIR").unwrap_or("./opensta".to_string());
let sta_path = std::path::PathBuf::from(sta_path)
.join("include")
.join("sta");
if !sta_path.exists() {
eprintln!(
"{} is not a directory! Set OPENSTA_DIR environmnet variable!",
sta_path.display()
);
}
let mut sta_bind =
autocxx_build::Builder::new("src/bridge.rs", &[&wrapper_path, &sta_path]).build()?;
sta_bind.flag_if_supported("-std=c++17").compile("sta");
println!("cargo:rerun-if-changed=src/bridge.rs");
// OpenSTA
let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
println!("cargo:rustc-link-lib=OpenSTA");
println!(
"cargo:rustc-link-search={}",
Path::new(&dir).join("opensta").join("lib").display()
);
// Tcl
println!("cargo:rustc-link-lib=static=tcl");
println!("cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu/");
println!("cargo:rustc-link-lib=static=z");
Ok(())
}