2018-11-16 18:39:47 +11:00
|
|
|
[config]
|
|
|
|
skip_core_tasks = true
|
|
|
|
|
|
|
|
[tasks.create-target-dir]
|
|
|
|
script_runner = "@rust"
|
|
|
|
script = [
|
|
|
|
'''
|
|
|
|
fn main() {
|
|
|
|
std::fs::DirBuilder::new().recursive(true).create("./target/").unwrap();
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
]
|
|
|
|
|
|
|
|
[tasks.assemble]
|
|
|
|
dependencies = ["create-target-dir"]
|
|
|
|
command = "arm-none-eabi-as"
|
|
|
|
args = ["crt0.s", "-o", "target/crt0.o"]
|
|
|
|
|
2018-11-18 11:14:42 +11:00
|
|
|
[tasks.build-examples-debug]
|
2018-11-16 18:39:47 +11:00
|
|
|
dependencies = ["assemble"]
|
|
|
|
command = "cargo"
|
|
|
|
args = ["xbuild", "--examples", "--target", "thumbv4-none-agb.json"]
|
|
|
|
|
2018-11-18 11:14:42 +11:00
|
|
|
[tasks.build-examples-release]
|
2018-11-16 18:39:47 +11:00
|
|
|
dependencies = ["assemble"]
|
|
|
|
command = "cargo"
|
|
|
|
args = ["xbuild", "--examples", "--target", "thumbv4-none-agb.json", "--release"]
|
|
|
|
|
|
|
|
[tasks.pack-roms]
|
|
|
|
script_runner = "@rust"
|
|
|
|
script = [
|
|
|
|
'''
|
|
|
|
fn main() -> std::io::Result<()> {
|
|
|
|
for entry in std::fs::read_dir("examples/")? {
|
|
|
|
let entry = entry?;
|
|
|
|
let mut path = entry.path();
|
|
|
|
if path.is_dir() {
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
path.set_extension("");
|
|
|
|
let name = path.file_name().unwrap().to_str().unwrap();
|
2018-11-20 19:54:15 +11:00
|
|
|
println!("{}", name);
|
2018-11-16 18:39:47 +11:00
|
|
|
std::process::Command::new("arm-none-eabi-objcopy").args(
|
|
|
|
&["-O", "binary",
|
|
|
|
&format!("target/thumbv4-none-agb/release/examples/{}",name),
|
2018-12-15 16:57:14 +11:00
|
|
|
&format!("target/{}.gba",name)])
|
2018-11-16 18:39:47 +11:00
|
|
|
.output().expect("failed to objcopy!");
|
|
|
|
std::process::Command::new("gbafix").args(
|
2018-12-15 16:57:14 +11:00
|
|
|
&[&format!("target/{}.gba",name)])
|
2018-11-16 18:39:47 +11:00
|
|
|
.output().expect("failed to gbafix!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
]
|
|
|
|
|
2018-12-21 10:15:23 +11:00
|
|
|
[tasks.test]
|
|
|
|
command = "cargo"
|
|
|
|
args = ["test", "--lib"]
|
2018-11-18 11:14:42 +11:00
|
|
|
|
2018-12-20 14:58:41 +11:00
|
|
|
[tasks.justrelease]
|
|
|
|
dependencies = ["build-examples-release", "pack-roms"]
|
|
|
|
|
2018-12-21 10:15:23 +11:00
|
|
|
[tasks.build-all]
|
|
|
|
dependencies = ["build-examples-debug", "build-examples-release", "pack-roms"]
|
2018-11-20 19:52:48 +11:00
|
|
|
|
|
|
|
[tasks.default]
|
2018-12-21 10:15:23 +11:00
|
|
|
alias = "build-all"
|