diff --git a/watchface/README.md b/watchface/README.md index cf9bbc14..642630f4 100644 --- a/watchface/README.md +++ b/watchface/README.md @@ -20,5 +20,25 @@ example, using `pngquant` on all images, to help keep the watch face size to a m ## Packaging the watch face To package the watch face, the [Pack](https://github.com/google/pack) is used. This is a native -library, so the pre-builts are provided in `jniLibs`. A script is also included for building these -fresh, but that should not be necessary. \ No newline at end of file +library, so the pre-builts are provided in `jniLibs`. + +## Building native libraries + +A script is also included for building these fresh, but that is generally not necessary when +building Androidify. + +However, if you do wish to build these, follow these steps in order to run the script: + +1. [Install][install-ndk] the Android NDK. +2. [Install][install-rust] Rust and Cargo. +3. Make a copy of `watchface/pack-java/.cargo-example` as + `watchface/pack-java/.cargo`. +4. Open `watchface/pack-java/.cargo/config.toml`. +5. Adjust all the `linker` and `ar` paths, replacing `` with the absolute path to your + Android NDK installation. Note that each linker must support API level 26 and above, to match + the Androidify `minSdk`. For example: `armv7a-linux-androideabi26-clang`. +6. Execute the `watchface/provide-libraries-to-androidify-project.sh` script. This will build the native + libraries and copy them to the `jniLibs` directory. + +[install-ndk]: https://developer.android.com/studio/projects/install-ndk#default-version +[install-rust]: https://rust-lang.org/tools/install/ \ No newline at end of file diff --git a/watchface/pack-java/.cargo-example/config.toml b/watchface/pack-java/.cargo-example/config.toml new file mode 100644 index 00000000..d05fcc70 --- /dev/null +++ b/watchface/pack-java/.cargo-example/config.toml @@ -0,0 +1,20 @@ +# The paths below are examples for a macOS (darwin-x86_64) host. +# You will need to adjust them for your operating system and NDK installation. +# Replace with the absolute path to your Android NDK installation. + +# Real watch +[target.armv7-linux-androideabi] +linker = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi26-clang" +ar = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" +# Emulator +[target.i686-linux-android] +linker = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android26-clang" +ar = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" +# Emulator on Apple Silicon MacBooks +[target.aarch64-linux-android] +linker = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android26-clang" +ar = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" +# Emulator (64-bit x86_64) +[target.x86_64-linux-android] +linker = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android26-clang" +ar = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" \ No newline at end of file