Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
Update build guidelines in README with usage of cargo-sdk as a build …
Browse files Browse the repository at this point in the history
…alternative
  • Loading branch information
tuancoltech committed Nov 22, 2023
1 parent d837ae6 commit 08e67b4
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ implementation 'dev.arkbuilders:arklib:0.3.1'
- Kotlin toolchain
- Android SDK + NDK r24 (latest)

### Build Rust
### Build Rust library

You need to have Rust targets installed:
```sh
Expand All @@ -55,12 +55,31 @@ rustup target add i686-linux-android
rustup target add x86_64-linux-android
```

#### Compile Rust (option 1)

For checking if Rust code compiles without problems, you can use this command:

```sh
./gradlew cargoBuild
```

The above command should generates `libarklib.so` file inside `./arklib/target/<arch>/<buildVariant>` folder.
If the build is failed, which leads to no generated `.so` files, there's a build alternative
which doesn't require you to install extra dependencies:

https://github.com/bbqsrc/cargo-ndk

#### Compile Rust (option 2)

Using `cargo-ndk`, you can generate the `libarklib.so` files in two steps:

```sh
- cd arklib
- cargo ndk -o ./jniLibs build
```

Running the above two commands outputs same `.so` files as `./gradlew cargoBuild` does.

### Build AAR

Before make a release build, ensure you have set `profile = "release"` in cargo config.
Expand Down

0 comments on commit 08e67b4

Please sign in to comment.