Skip to content

Commit

Permalink
apk: Use rustc --crate-type=cdylib to always force a lib to be comp…
Browse files Browse the repository at this point in the history
…iled

This automatically turns `crate-type = ["*lib"]` and `[lib]` targets
into a `cdylib`, and otherwise errors appropriately when encountering a
binary instead of succeeding the build and having `cargo-apk` later
complain when `target/aarch64-linux-android/debug/lib<yourpacakge>.so`
is not found.
  • Loading branch information
MarijnS95 committed Jun 16, 2023
1 parent 0f47f04 commit 45f03ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cargo-apk/src/apk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ impl<'a> ApkBuilder<'a> {
self.min_sdk_version(),
self.cmd.target_dir(),
)?;
cargo.arg("build");
cargo.arg("rustc");
cargo.arg("--crate-type=cdylib");
if self.cmd.target().is_none() {
cargo.arg("--target").arg(triple);
}
Expand Down

0 comments on commit 45f03ff

Please sign in to comment.