[docs] Introduce CrossBuildForAndroid.md for nnfw (#7976)
author이한종/On-Device Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Mon, 14 Oct 2019 12:33:24 +0000 (21:33 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 14 Oct 2019 12:33:24 +0000 (21:33 +0900)
* [docs] Introduce CrossBuildForAndroid.md for nnfw

This commit introduces `CrossBuildForAndroid.md` for Android Cross
Build Instruction.

Resolve #7892

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
* Symlink Makefile rather than copying

* Complete the incomplete sentence

docs/nnfw/howto/CrossBuildForAndroid.md [new file with mode: 0644]

diff --git a/docs/nnfw/howto/CrossBuildForAndroid.md b/docs/nnfw/howto/CrossBuildForAndroid.md
new file mode 100644 (file)
index 0000000..d13c72b
--- /dev/null
@@ -0,0 +1,54 @@
+# Cross building for Android
+
+Supported Architecture : ARM64 only (ARM32 is not supported yet)
+
+## Prepare Android NDK
+
+Use `tools/cross/build_android_ndk.sh` script to prepare Android NDK. This is recommended way to build Android NDK.
+You may download it yourself from the offical Android NDK website, but the script does a little more than just downloading and unzipping.
+
+## Build
+
+### Host Environment Requirements
+
+With Ubuntu 16.04, everything is fine except one. CMake 3.6.0 or later is required for Android NDK CMake support.
+So if you want to use Docker, please use `infra/docker/Dockerfile.1804` which is based on Ubuntu 18.04. It has CMake 3.10.2.
+
+```bash
+docker build --network host -t nnas1804 -f infra/docker/Dockerfile.1804 infra/docker
+```
+
+### Get prebuilt ARM Compute Library
+
+Download prebuilt binary from [github](https://github.com/ARM-software/ComputeLibrary/releases). Check the version we support and platform(Android).
+
+Then extract the tarball and we will use the ones in `lib/android-arm64-v8a-neon-cl`. The following files are used.
+
+```
+libarm_compute_core.so
+libarm_compute_graph.so
+libarm_compute.so
+```
+
+### Build and install the runtime
+
+Some tools/libs are still not supported and those are not built by default - mostly due to dependency on Boost library.
+Please refer to `infra/nnfw/cmake/options/options_arm64-android.cmake` for details.
+
+Different from cross build for linux,
+
+- `NDK_DIR` is required
+- `TARGET_ARCH` must be `arm64`, not `aarch64`.
+
+Here is an example of using Makefile.
+
+```bash
+ln -s Makefile.template Makefile
+
+make TARGET_ARCH=arm64 \
+     CROSS_BUILD=1 \
+     NDK_DIR=/path/android-tools/r20/ndk \
+     EXT_ACL_FOLDER=/path/arm_compute-v19.05-bin-android/lib/android-arm64-v8a-neon-cl
+
+make install
+```