Allow for the build target to be specified via the command line as well

This commit is contained in:
Jesse Braham
2021-11-02 14:40:54 +01:00
parent d1b963320f
commit 70c55cd3b7
2 changed files with 8 additions and 2 deletions

View File

@@ -156,9 +156,12 @@ fn build(
cargo_config: &CargoConfig,
chip: Option<Chip>,
) -> Result<PathBuf> {
let target = cargo_config
.target()
let target = build_options
.target
.as_deref()
.or(cargo_config.target())
.ok_or_else(|| NoTargetError::new(chip))?;
if let Some(chip) = chip {
if !chip.supports_target(target) {
return Err(Error::UnsupportedTarget(UnsupportedTargetError::new(target, chip)).into());

View File

@@ -23,6 +23,9 @@ pub struct BuildArgs {
/// Image format to flash (bootloader/direct-boot)
#[clap(long)]
pub format: Option<String>,
/// Target to build for
#[clap(long)]
pub target: Option<String>,
}
#[derive(Parser)]