-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.rs
executable file
·51 lines (44 loc) · 1.17 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
41
42
43
44
45
46
47
48
49
50
51
use std::process::Command;
fn build_pmdk() {
Command::new("git")
.args(["submodule", "update", "--init", "--recursive"])
.current_dir("./")
.status()
.expect("failed to submodule update!");
Command::new("git")
.args(["apply", "../pmdk-rs.patch"])
.current_dir("./ext/pmdk-rs")
.status()
.expect("failed to submodule update!");
println!("cargo:rustc-link-lib=pmemobj");
}
fn build_ralloc() {
// Build Ralloc
Command::new("make")
.args(["clean"])
.current_dir("./ext/ralloc/test")
.status()
.expect("failed to make clean!");
let args = {
#[cfg(not(feature = "no_persist"))]
{
&["libralloc.a"]
}
#[cfg(feature = "no_persist")]
{
&["libralloc.a", "FEATURE=no_persist"]
}
};
Command::new("make")
.args(args)
.current_dir("./ext/ralloc/test")
.status()
.expect("failed to make!");
// Link libralloc.a
println!("cargo:rustc-link-search=ext/ralloc/test");
println!("cargo:rustc-link-lib=dylib=stdc++");
}
fn main() {
build_ralloc();
build_pmdk();
}