赞
踩
主要编译两个架构和是否加vulkan.
在ncnn 同级目录新建 build_android.bat,写入下面内容。编译脚本在官方基础上加下面语句。
set ANDROID_NDK= your android ndk root # eg C:/android-ndk-r20
-G "Unix Makefiles"
-DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%/prebuilt/windows-x86_64/bin/make.exe"
cd ncnn
# cmake option NCNN_VULKAN for enabling vulkan
set ANDROID_NDK= your android ndk root # eg C:/android-ndk-r20
mkdir -p build-android-armv7
cd build-android-armv7
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK%/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%/prebuilt/windows-x86_64/bin/make.exe" -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-21 ..
cmake --build .
cmake --build . --target install
cd ../../
cd ncnn
# cmake option NCNN_VULKAN for enabling vulkan
set ANDROID_NDK= your android ndk root # eg C:/android-ndk-r20
mkdir -p build-android-armv7
cd build-android-armv7
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK%/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%/prebuilt/windows-x86_64/bin/make.exe" -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-24 -DNCNN_VULKAN=ON ..
cmake --build .
cmake --build . --target install
cd ../../
cd ncnn
# cmake option NCNN_VULKAN for enabling vulkan
set ANDROID_NDK=your android ndk root # eg C:/android-ndk-r20
mkdir -p build-android-aarch64
cd build-android-aarch64
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK%/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%/prebuilt/windows-x86_64/bin/make.exe" -DANDROID_ABI="arm64-v8a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-21 ..
cmake --build .
cmake --build . --target install
cd ../../
vulkan
cd ncnn
# cmake option NCNN_VULKAN for enabling vulkan
set ANDROID_NDK=your android ndk root # eg C:/android-ndk-r20
mkdir -p build-android-aarch64
cd build-android-aarch64
# if you want to enable vulkan, platform api version >= android-24 is needed
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK%/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%/prebuilt/windows-x86_64/bin/make.exe" -DANDROID_ABI="arm64-v8a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-24 -DNCNN_VULKAN=ON ..
cmake --build .
cmake --build . --target install
cd ../../
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。