-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
39 lines (34 loc) · 988 Bytes
/
build.rs
File metadata and controls
39 lines (34 loc) · 988 Bytes
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
use std::{env, path::PathBuf, process::Command};
fn main() {
println!("cargo::rerun-if-changed=src/clib/builtin.c");
println!("cargo::rerun-if-changed=src/clib/bdwgc/*");
let out_dir = env::var("OUT_DIR").unwrap();
Command::new("mkdir")
.args(["src/clib/bdwgc/build"])
.status()
.unwrap();
Command::new("cmake")
.current_dir("src/clib/bdwgc/build")
.args([".."])
.status()
.unwrap();
Command::new("cmake")
.current_dir("src/clib/bdwgc/build")
.args(["--build", "."])
.status()
.unwrap();
let out_path = PathBuf::from(out_dir).join("builtin.bc");
let status = Command::new("clang")
.args([
"-emit-llvm",
"-c",
"src/clib/builtin.c",
"-o",
out_path.to_str().unwrap(),
])
.status()
.unwrap();
if !status.success() {
panic!("Failed to compile builtin.c");
}
}