Build SDK for the local hardware

It's likely that you want to build the SDK to run on the emulator on your
machine, so let's default to that, rather than aarch64.
This commit is contained in:
Richard van der Hoff
2024-12-11 18:03:09 +00:00
parent 91444aee67
commit 60ea133357
2 changed files with 8 additions and 4 deletions

View File

@@ -130,9 +130,9 @@ Prerequisites:
```
cargo install cargo-ndk
```
* Install the Android Rust toolchain:
* Install the Android Rust toolchain for your machine's hardware:
```
rustup target add aarch64-linux-android
rustup target add `uname -m`-linux-android
```
* Depending on the location of the Android SDK, you may need to set
`ANDROID_HOME`:

View File

@@ -59,6 +59,10 @@ buildApp=${buildApp:-no}
cd "${elementPwd}"
default_arch="$(uname -m)-linux-android"
read -p "Enter the architecture you want to build for (default '$default_arch'): " target_arch
target_arch="${target_arch:-${default_arch}}"
# If folder ../matrix-rust-components-kotlin does not exist, clone the repo
if [ ! -d "../matrix-rust-components-kotlin" ]; then
printf "\nFolder ../matrix-rust-components-kotlin does not exist. Cloning the repository into ../matrix-rust-components-kotlin.\n\n"
@@ -71,8 +75,8 @@ git reset --hard
git checkout main
git pull
printf "\nBuilding the SDK for aarch64-linux-android...\n\n"
./scripts/build.sh -p "${rustSdkPath}" -m sdk -t aarch64-linux-android -o "${elementPwd}/libraries/rustsdk"
printf "\nBuilding the SDK for ${target_arch}...\n\n"
./scripts/build.sh -p "${rustSdkPath}" -m sdk -t "${target_arch}" -o "${elementPwd}/libraries/rustsdk"
cd "${elementPwd}"
mv ./libraries/rustsdk/sdk-android-debug.aar ./libraries/rustsdk/matrix-rust-sdk.aar