Environmental Requirements

  • cmake (version >=3.10 is recommended)
  • protobuf (version >= 3.0 is required)
  • gcc (version >= 4.9 is required)

Build Options

When compiling with cmake, you can modify the options in CMakeLists.txt:

  • MNN_DEBUG

Defaults OFF, When OFF, remove symbols and build with optimizations.

  • MNN_OPENMP

Defaults ON, When OFF, do not use openmp multi-thread.

  • MNN_OPENCL

Defaults OFF, When ON, build the OpenCL backend, apply GPU according to setting the forward type to be MNN_FORWARD_OPENCL at inference time.

  • MNN_OPENGL

Defaults OFF, When ON, build the OpenGL backend, apply GPU according to setting the forward type to be MNN_FORWARD_OPENGL at inference time.

  • MNN_VULKAN

Defaults OFF, When ON, build the Vulkan backend, apply GPU according to setting the forward type to be MNN_FORWARD_VULKAN at inference time.

Steps

  1. Download and Install NDK, latest release version is recommended
  2. Set ANDROID_NDK path, eg: export ANDROID_NDK=/Users/username/path/to/android-ndk-r14b
  3. cd /path/to/MNN
  4. ./schema/generate.sh
  5. ./tools/script/get_model.sh(optional, models are needed only in demo project). Note get_model.sh requires you to build the MNNConvert tool first. See its build instructions here.
  6. cd project/android
  7. Build armv7 library: mkdir build_32 && cd build_32 && ../build_32.sh
  8. Build armv8 library: mkdir build_64 && cd build_64 && ../build_64.sh