Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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