-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.rs
35 lines (30 loc) · 903 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
//! Rust script to compile non-rust files.
use std::path::Path;
/// Orders to Cargo to link a library.
fn add_lib(lib: &str) {
println!("cargo:rustc-link-lib={}", lib);
}
fn add_dependency(dep: &Path) {
println!("cargo:rerun-if-changed={}", dep.display());
}
fn main() {
let exh_file = "src/search_space/choices.exh";
let out_dir = std::env::var_os("OUT_DIR").unwrap();
for file in glob::glob("src/search_space/*.exh").unwrap() {
add_dependency(&file.unwrap());
}
let exh_out = Path::new(&out_dir).join("choices.rs");
telamon_gen::process_file(
&Path::new(exh_file),
&exh_out,
cfg!(feature = "format_exh"),
)
.unwrap_or_else(|err| {
eprintln!("could not compile EXH file: {}", err);
std::process::exit(-1);
});
if cfg!(feature = "mppa") {
add_lib("telajax");
add_lib("OpenCL");
}
}