ncnn在win10+VS2013平台编译

1、编译protobuf3.4.0

从地址https://github.com/google/protobuf/archive/v3.4.0.zip 下载protobuf3.4.0并解压,打开VS2013 x64 Native Tools Command Prompt (本机工具命令提示符)。

在命令行中移动到解压出来的protobuf-3.4.0目录,然后执行以下命令,出现以下界面安装成功:

> cd <protobuf-root-dir>
> mkdir build-vs2013
> cd build-vs2013
> cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
> nmake
> nmake install

2、编译ncnn library

由于主要是针对人脸检测项目ultra face进行的,在链接https://github.com/Tencent/ncnn/tree/22a2be4e6cb9cc6ef596d5bb801923135c82a875中下载ncnn并解压放到对应的项目目录Ultra-Light-Fast-Generic-Face-Detector-1MB/tree/master/ncnn/3rdparty/ncnn中,然后执行以下命令,出现以下界面并在路径ncnn\build\install\lib下出现ncnn.lib编译成功:

> cd <ncnn-root-dir> 
> mkdir build
> cd build
> cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=<protobuf-root-dir>/build/install/include -DProtobuf_LIBRARIES=<protobuf-root-dir>/build/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=<protobuf-root-dir>/build/install/bin/protoc.exe ..
> nmake
> nmake install

注:上述命令中,ncnn-root-dir 替换成自己项目中对应ncnn存放的目录,我这里是 D:\project\Ultra-Light-Fast-Generic-Face-Detector-1MB-master\ncnn\3rdparty\ncnn;protobuf-root-dir 替换成第一步编译后的protobuf目录,我这里是D:/soft/protobuf-3.4.0。

3、下载Vulkan SDK并安装(可选)

地址: https://vulkan.lunarg.com/sdk/home

原因:后边调用编译后的lib库的时候需要包含vulkan相关的头文件,否则会编译不过,出现下面的错误:

参考链接:

https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-windows-x64-using-visual-studio-community-2017

https://blog.csdn.net/zhaotun123/article/details/99671286

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值