1.均需要安装cmake
2. download protobuf-3.4.0 from https://github.com/google/protobuf/archive/v3.4.0.zip
如果你是vs2015:
3.cd <protobuf-root-dir>
4.mkdir build-vs2015
5.cd build-vs2015
5.1: "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 8.1
初始化一下环境变量。
如果你是vs2017:
可能2017比较自动化,打开就是初始化好的
3.cd <protobuf-root-dir>
4.mkdir build-vs2017
5.cd build-vs2017
然后按照ncnn官方教程执行
6.cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
7.nmake
8.nmake install
然后继续编译ncnn:
当然其中vs2015和vs2017的区别同上。
cd <ncnn-root-dir>
mkdir -p build-vs2017
cd build-vs2017
# cmake option NCNN_VULKAN for enabling vulkan
(这一步请自行修改编译好的protobuf有关路径,vs2015和vs2017的路径之类的)
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=<protobuf-root-dir>/build-vs2017/install/include -DProtobuf_LIBRARIES=<protobuf-root-dir>/build-vs2017/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=<protobuf-root-dir>/build-vs2017/install/bin/protoc.exe -DNCNN_VULKAN=OFF ..
nmake
nmake install
没报错真舒服。。。。。。。。。。。。。。。。。