mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-04 06:01:35 +11:00
Remove the need for a linker script and move multiboot to a feature
This commit is contained in:
parent
0e0cc6f909
commit
eff075f50b
|
@ -10,6 +10,7 @@ repository = "https://github.com/agbrs/agb"
|
||||||
[features]
|
[features]
|
||||||
default = ["testing"]
|
default = ["testing"]
|
||||||
testing = []
|
testing = []
|
||||||
|
multiboot = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "2"
|
bitflags = "2"
|
||||||
|
|
16
agb/build.rs
16
agb/build.rs
|
@ -1,5 +1,19 @@
|
||||||
fn main() {
|
use std::{env, error::Error, fs, path::PathBuf};
|
||||||
|
|
||||||
|
fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
let out = &PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||||
|
let linker_script = if env::var("CARGO_FEATURE_MULTIBOOT").is_ok() {
|
||||||
|
include_bytes!("gba_mb.ld").as_slice()
|
||||||
|
} else {
|
||||||
|
include_bytes!("gba.ld").as_slice()
|
||||||
|
};
|
||||||
|
|
||||||
|
fs::write(out.join("gba.ld"), linker_script)?;
|
||||||
|
println!("cargo:rustc-link-search={}", out.display());
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=gba.ld");
|
println!("cargo:rerun-if-changed=gba.ld");
|
||||||
println!("cargo:rerun-if-changed=gba_mb.ld");
|
println!("cargo:rerun-if-changed=gba_mb.ld");
|
||||||
println!("cargo:rerun-if-changed=build.rs");
|
println!("cargo:rerun-if-changed=build.rs");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue