【环境搭建】ncnn - android

1,准备
1.1 android ndk

下载android-ndk-r17c,https://developer.android.com/ndk/downloads/
vim  ~/.bashrc
# 添加android-NDK
export ANDROID_NDK=~/android-ndk-r21 
source ~/.bashrc

1.2 vulkan

# https://vulkan.lunarg.com/sdk/home,下载,vulkansdk-linux-x86_64-1.2.141.0.tar.gz
tar -xf vulkansdk-linux-x86_64-1.2.141.0.tar.gz
sudo apt install vulkan-utils

# setup vulkan env
export VULKAN_SDK=$HOME/vulkansdk-linux-x86_64-1.2.141.0/x86_64
export PATH=$VULKAN_SDK/bin:$PATH
export LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=$VULKAN_SDK/lib:$LIBRARY_PATH
export VK_LAYER_PATH=$VULKAN_SDK/etc/vulkan/explicit_layer.d

1.3 protobuf>3.0
1.4 cmake > 2.8

2,编译

git clone https://github.com/Tencent/ncnn.git
cd ncnn
mkdir -p 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-14 ..
make -j4
make install

你可能感兴趣的:(环境搭建)