forked from weld-project/weld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
35 lines (30 loc) · 1002 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
use std::env;
use std::process::Command;
fn main() {
let project_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let status = Command::new("make")
.arg("clean")
.arg("-C")
.arg(format!("{}/weld_rt/cpp/", project_dir))
.status()
.unwrap();
assert!(status.success());
let status = Command::new("make")
.arg("-C")
.arg(format!("{}/weld_rt/cpp/", project_dir))
.status()
.unwrap();
assert!(status.success());
// Link C++ standard library and some Mac-specific libraries
let target = env::var("TARGET").unwrap();
if target == "x86_64-apple-darwin" {
let libs = vec!["z", "c++"];
for lib in libs {
println!("cargo:rustc-link-lib={}", lib);
}
}
println!("cargo:rustc-link-lib=dylib=stdc++");
// Link the weldrt C++ library
println!("cargo:rustc-link-lib=static=weldrt");
println!("cargo:rustc-link-search=native={}/weld_rt/cpp", project_dir);
}