forked from rcore-os/virtio-drivers
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.rs
29 lines (28 loc) · 869 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
use cc::Build;
use std::env;
fn main() {
env::set_var("CROSS_COMPILE", "aarch64-linux-gnu");
let platform = env::var("CARGO_CFG_PLATFORM").expect("Missing platform name");
match platform.as_ref() {
"qemu" => {
Build::new()
.file("entry.S")
.file("exceptions.S")
.file("idmap.S")
.compile("empty");
println!("cargo:rustc-link-arg=-Tqemu.ld");
}
"crosvm" => {
Build::new()
.file("entry.S")
.file("exceptions.S")
.file("idmap_crosvm.S")
.compile("empty");
println!("cargo:rustc-link-arg=-Tcrosvm.ld");
}
_ => {
panic!("Unexpected platform name \"{}\"", platform);
}
}
println!("cargo:rustc-link-arg=-Timage.ld");
}