-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from rcore-os/examples
Tidy up aarch64 example build
- Loading branch information
Showing
2 changed files
with
22 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
use cc::Build; | ||
use std::env; | ||
|
||
const PLATFORMS: [&str; 2] = ["crosvm", "qemu"]; | ||
|
||
fn main() { | ||
env::set_var("CROSS_COMPILE", "aarch64-linux-gnu"); | ||
println!( | ||
"cargo::rustc-check-cfg=cfg(platform, values(\"{}\"))", | ||
PLATFORMS.join("\", \"") | ||
); | ||
|
||
env::set_var("CROSS_COMPILE", "aarch64-none-elf"); | ||
env::set_var("CC", "clang"); | ||
|
||
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); | ||
} | ||
} | ||
assert!( | ||
PLATFORMS.contains(&platform.as_str()), | ||
"Unexpected platform name {:?}. Supported platforms: {:?}", | ||
platform, | ||
PLATFORMS, | ||
); | ||
Build::new() | ||
.file("entry.S") | ||
.file("exceptions.S") | ||
.file(format!("idmap_{platform}.S")) | ||
.compile("example"); | ||
println!("cargo:rustc-link-arg=-T{platform}.ld"); | ||
println!("cargo:rustc-link-arg=-Timage.ld"); | ||
} |
File renamed without changes.