Android 配置 ncnn

https://blog.csdn.net/Skies_/article/details/109350500

1. ncnn编译

按官网提示,ncnn代码下有build.sh

2. android-studio,native code使用ncnn配置

a. 拷贝ncnn库

在${PROJECT_DIR}/app/src/main/cpp/下新建third_party/ncnn-lib文件夹,把编译、install出来的安卓库文件拷贝进去。目录结构:

 

 b. CMakeLists.txt配置:

 1 set(ncnn_DIR ${PROJECT_DIR}/app/src/main/cpp/third_party/ncnn-lib/${CMAKE_ANDROID_ARCH_ABI}/lib/cmake/ncnn)
 2 find_package(ncnn REQUIRED)
 3 message( STATUS "ncnn library status:" )
 4 message( STATUS "    found: ${ncnn_FOUND}" )
 5 message( STATUS "    version: ${NCNN_VERSION}" )
 6 message( STATUS "    libraries: ${NCNN_LIBS}" )
 7 message( STATUS "    include path: ${ncnn_INCLUDE_DIRS}" )
 8 include_directories("${PROJECT_DIR}/app/src/main/cpp/third_party/ncnn-lib/${CMAKE_ANDROID_ARCH_ABI}/include")
 9 file(GLOB NCNN_LIBS ${PROJECT_DIR}/app/src/main/cpp/third_party/ncnn-lib/${CMAKE_ANDROID_ARCH_ABI}/lib/*.a)
10 set(DEPENDENCIES ${DEPENDENCIES} ${NCNN_LIBS})

 

posted @ 2021-06-19 17:36  imoon22  阅读(653)  评论(0编辑  收藏  举报