xous-core/apps/app-loader/spawn/build.rs
Vihaan Jim ded9049ee4 Turn app-loader into an app instead of a service
When the user selects App Loader from the app menu, a new menu shows
up that displays the currently loaded apps (in the future this will
contain options to add/remove apps as well). This is a much more sane
approach than whatever I was doing before because it requires minimal
changes to the rest of the source tree (I had to change xtask so that
it would replace -'s with _'s in constant names so that I could name
my app app-loader).
2023-08-01 22:16:40 -04:00

33 lines
1 KiB
Rust

// NOTE: Adapted from cortex-m/build.rs
use std::env;
use std::fs;
use std::io::Write;
use std::path::PathBuf;
fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let target = env::var("TARGET").unwrap();
// let name = env::var("CARGO_PKG_NAME").unwrap();
if target.starts_with("riscv") {
// fs::copy(
// format!("bin/{}.a", target),
// out_dir.join(format!("lib{}.a", name)),
// ).unwrap();
// println!("cargo:rustc-link-lib=static={}", name);
// println!("cargo:rustc-link-search={}", out_dir.display());
// println!("cargo:rerun-if-changed=bin/{}.a", target);
println!("cargo:rustc-link-arg=-Tlink.x");
}
// Put the linker script somewhere the linker can find it
fs::File::create(out_dir.join("link.x"))
.unwrap()
.write_all(include_bytes!("link.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out_dir.display());
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=link.x");
}