Cargo command to work with Nintendo 3DS project binaries.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1006 B

use cargo_3ds::command::Cargo;
use cargo_3ds::{
build_3dsx, build_elf, build_smdh, check_rust_version, get_message_format, get_metadata,
get_should_link, link,
};
use clap::Parser;
use std::process;
3 years ago
fn main() {
check_rust_version();
let Cargo::Input(mut input) = Cargo::parse();
let should_link = get_should_link(&mut input);
let message_format = get_message_format(&mut input);
let (status, messages) = build_elf(input.cmd, &message_format, &input.cargo_opts);
3 years ago
if !status.success() {
process::exit(status.code().unwrap_or(1));
3 years ago
}
if !input.cmd.should_build_3dsx() {
return;
3 years ago
}
eprintln!("Getting metadata");
let app_conf = get_metadata(&messages);
3 years ago
eprintln!("Building smdh:{}", app_conf.path_smdh().display());
build_smdh(&app_conf);
3 years ago
eprintln!("Building 3dsx: {}", app_conf.path_3dsx().display());
build_3dsx(&app_conf);
3 years ago
if should_link {
eprintln!("Running 3dslink");
link(&app_conf);
3 years ago
}
}