Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.21 KB

compile_android.md

File metadata and controls

48 lines (36 loc) · 1.21 KB

Source Code Compilation (Android)

Install Android NDK

Android NDK url

Prepare Android Toolchain Files

(optional) delete debug compilation parameters to reduce the binary volume android-ndk issue ,The file android.toolchain.cmake can be found from $ANDROID_NDK/build/cmake:

# vi $ANDROID_NDK/build/cmake/android.toolchain.cmake
# delete line "-g"
list(APPEND ANDROID_COMPILER_FLAGS
  -g
  -DANDROID
  ...)

Downlad Tengine Source Code

git clone -b tengine-lite https://github.com/OAID/Tengine.git Tengine

Compile Tengine

Arm64 Android

cd Tengine
mkdir build-android-aarch64
cd build-android-aarch64
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-21 ..
make -j$(nproc)
make install

Arm32 Android

cd Tengine
mkdir build-android-armv7
cd build-android-armv7
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-19 ..
make -j$(nproc)
make install