1、vs2015编译器编译protobuf (VS2015 x64本机工具命令)
下载源码:https://github.com/google/protobuf/archive/v3.4.0.zip
进入protobuf-3.4.0 文件夹
mkdir build-vs2015
cd build-vs2015
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
protobuf-3.4.0\build-vs2015\install 目录下,会生成include bin lib文件夹
2、ncnn
下载源码
https://github.com/Tencent/ncnn/releases
cd build-vs2015 cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=E:/NCNNWin/protobuf-3.4./build-vs2015/install/include
-DProtobuf_LIBRARIES=E:/NCNNWin/protobuf-3.4./build-vs2015/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=E:/NCNNWin/protobuf-3.4./build-vs2015/install/bin/protoc.exe .. nmake nmake install
在ncnn-20180830\build-vs2015\install 文件夹下生成include和lib文件夹
vs常见错误
配置属性—c/c++---预处理器——预处理器定义添加
NOMINMAX
_CRT_SECURE_NO_WARNINGS