diff --git a/cargo-apk/CHANGELOG.md b/cargo-apk/CHANGELOG.md index 594a7005..1f99770d 100644 --- a/cargo-apk/CHANGELOG.md +++ b/cargo-apk/CHANGELOG.md @@ -1,6 +1,7 @@ # Unreleased - Move NDK r23 `-lgcc` workaround to `ndk-build::cargo::cargo_ndk`, to also apply to our `cargo apk --` invocations. ([#286](https://github.com/rust-windowing/android-ndk-rs/pull/286)) +- Append `--target` to blanket `cargo apk --` calls when not provided by the user. ([#287](https://github.com/rust-windowing/android-ndk-rs/pull/287)) # 0.9.1 (2022-05-12) diff --git a/cargo-apk/src/apk.rs b/cargo-apk/src/apk.rs index 892ba01d..ae8e997f 100644 --- a/cargo-apk/src/apk.rs +++ b/cargo-apk/src/apk.rs @@ -98,7 +98,6 @@ impl<'a> ApkBuilder<'a> { pub fn check(&self) -> Result<(), Error> { for target in &self.build_targets { - let triple = target.rust_triple(); let mut cargo = cargo_ndk( &self.ndk, *target, @@ -107,6 +106,7 @@ impl<'a> ApkBuilder<'a> { )?; cargo.arg("check"); if self.cmd.target().is_none() { + let triple = target.rust_triple(); cargo.arg("--target").arg(triple); } cargo.args(self.cmd.args()); @@ -246,6 +246,12 @@ impl<'a> ApkBuilder<'a> { self.cmd.target_dir(), )?; cargo.args(self.cmd.args()); + + if self.cmd.target().is_none() { + let triple = target.rust_triple(); + cargo.arg("--target").arg(triple); + } + if !cargo.status()?.success() { return Err(NdkError::CmdFailed(cargo).into()); }