-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
35 lines (28 loc) · 961 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
32
33
34
35
extern crate cmake;
use cmake::Config;
use std::env;
use std::path::PathBuf;
fn main() -> Result<(), String> {
let build_sylvan = env::var_os("CARGO_FEATURE_BUILD_SYLVAN").is_some();
if !build_sylvan {
// If silent build is active, don't do anything.
return Ok(());
}
let out_dir = env::var("OUT_DIR")
.map_err(|_| "Environmental variable `OUT_DIR` not defined.".to_string())?;
let wrapper_path = PathBuf::from("wrapper");
let mut cfg = Config::new(wrapper_path);
let is_debug = env::var_os("DEBUG").unwrap_or_else(|| "true".into());
if is_debug == "true" {
cfg.cflag("-Werror");
}
cfg.build();
println!(
"cargo:rustc-link-search=native={}",
PathBuf::from(out_dir).join("lib").display()
);
println!("cargo:rustc-link-lib=static=lace");
println!("cargo:rustc-link-lib=static=sylvan");
println!("cargo:rustc-link-lib=static=wrapper");
Ok(())
}