Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 32-bit ARM support (armeabi and armeabi-v7a) #199

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ jobs:
arch: x64
- platform: android
arch: arm64
- platform: android
arch: arm
- platform: android
arch: armv7
- platform: ios
arch: arm64

Expand Down
8 changes: 5 additions & 3 deletions apk/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ use anyhow::{Context, Result};
#[repr(u8)]
pub enum Target {
ArmV7a = 1,
Arm64V8a = 2,
X86 = 3,
X86_64 = 4,
Armeabi = 2,
Arm64V8a = 3,
X86 = 4,
X86_64 = 5,
Comment on lines 4 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the repr values here might not be desired, but I need to check where it is even used.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright

}

impl Target {
/// Identifier used in the NDK to refer to the ABI
pub fn android_abi(self) -> &'static str {
match self {
Self::Arm64V8a => "arm64-v8a",
Self::Armeabi => "armeabi",
Self::ArmV7a => "armeabi-v7a",
Self::X86 => "x86",
Self::X86_64 => "x86_64",
Expand Down
3 changes: 3 additions & 0 deletions xbuild/src/devices/imd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ impl IMobileDevice {
pub fn arch(&self, device: &str) -> Result<Arch> {
match self.getkey(device, "CPUArchitecture")?.as_str() {
"arm64" | "arm64e" => Ok(Arch::Arm64),
"armv7" => Ok(Arch::Armv7),
"arm" => Ok(Arch::Arm),
"x86_64" => Ok(Arch::X64),
Comment on lines 128 to +132
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is iOS code, did you confirm that it returns x86_64?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly didn't know what this does in first place

arch => anyhow::bail!("unsupported arch {}", arch),
}
}
Expand Down
18 changes: 13 additions & 5 deletions xbuild/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ impl std::str::FromStr for Platform {

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Arch {
//Arm,
Armv7,
Arm,
Arm64,
X64,
//X86,
Expand All @@ -113,7 +114,8 @@ impl Arch {
impl std::fmt::Display for Arch {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
//Self::Arm => write!(f, "arm"),
Self::Armv7 => write!(f, "armv7"),
Self::Arm => write!(f, "arm"),
Self::Arm64 => write!(f, "arm64"),
Self::X64 => write!(f, "x64"),
//Self::X86 => write!(f, "x86"),
Expand All @@ -126,7 +128,8 @@ impl std::str::FromStr for Arch {

fn from_str(arch: &str) -> Result<Self> {
Ok(match arch {
//"arm" => Self::Arm,
"arm" => Self::Arm,
"armv7" => Self::Armv7,
"arm64" => Self::Arm64,
"x64" => Self::X64,
//"x86" => Self::X86,
Expand Down Expand Up @@ -281,6 +284,8 @@ impl CompileTarget {
pub fn android_abi(self) -> apk::Target {
assert_eq!(self.platform(), Platform::Android);
match self.arch() {
Arch::Armv7 => apk::Target::ArmV7a,
Arch::Arm => apk::Target::Armeabi,
Arch::Arm64 => apk::Target::Arm64V8a,
Arch::X64 => apk::Target::X86_64,
}
Expand All @@ -291,7 +296,8 @@ impl CompileTarget {
assert_eq!(self.platform(), Platform::Android);
match self.arch() {
Arch::Arm64 => "aarch64-linux-android",
//Arch::Arm => "arm-linux-androideabi",
Arch::Arm => "arm-linux-androideabi",
Arch::Armv7 => "armv7-linux-androideabi",
//Arch::X86 => "i686-linux-android",
Arch::X64 => "x86_64-linux-android",
}
Expand All @@ -300,6 +306,8 @@ impl CompileTarget {
pub fn rust_triple(self) -> Result<&'static str> {
Ok(match (self.arch, self.platform) {
(Arch::Arm64, Platform::Android) => "aarch64-linux-android",
(Arch::Armv7, Platform::Android) => "armv7-linux-androideabi",
(Arch::Arm, Platform::Android) => "arm-linux-androideabi",
(Arch::Arm64, Platform::Ios) => "aarch64-apple-ios",
(Arch::Arm64, Platform::Linux) => "aarch64-unknown-linux-gnu",
(Arch::Arm64, Platform::Macos) => "aarch64-apple-darwin",
Expand Down Expand Up @@ -381,7 +389,7 @@ pub struct BuildTargetArgs {
#[clap(long, conflicts_with = "device")]
platform: Option<Platform>,
/// Build artifacts for target arch. Can be one of
/// `arm64` or `x64`.
/// `arm`, `armv7` `arm64` or `x64`.
#[clap(long, requires = "platform")]
arch: Option<Arch>,
/// Build artifacts for target device. To find the device
Expand Down
Loading