ncnn之三:window10+vs2015+opencv4.1.1+protobuf+ncnn
protobuf
$ git clone [email protected]:protocolbuffers/protobuf.git
$ cd .\protobuf\cmake
$ mkdir build
$ cd build
$ cmake .. -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -G "Visual Studio 14 2015 Win64"
啓動vs2015打開 ncnn_deploy\protobuf\cmake\build下的protobuf.sln工程,編譯Debug及Release版本;
ncnn
$ cd ../3rdparty/src/ncnn
$ mkdir build
$ cd build
$ ./ncnn_deploy/protobuf/cmake/build/extract_includes.bat
## Debug
$ cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=F:\code\cpp_code\ncnn_deploy\protobuf\cmake\build\include -DProtobuf_LIBRARIES=F:\code\cpp_code\ncnn_deploy\protobuf\cmake\build\Debug\libprotobufd.lib -DProtobuf_PROTOC_EXECUTABLE=F:\code\cpp_code\ncnn_deploy\protobuf\cmake\build\Release\protoc.exe
## Release
$ cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=F:\code\cpp_code\ncnn_deploy\protobuf\cmake\build\include -DProtobuf_LIBRARIES=F:\code\cpp_code\ncnn_deploy\protobuf\cmake\build\Release\libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=F:\code\cpp_code\ncnn_deploy\protobuf\cmake\build\Release\protoc.exe
啓動vs2015打開 ncnn_deploy\ncnn\build下的ncnn.sln工程,編譯Debug及Release版本;
1 複製 include
複製 ncnn\src目錄下
layer.h、blob.h、cpu.h、mat.h、net.h、opencv.h、paramdict.h、modelbin.h、layer_type.h
到ncnn_library\include\ncnn下
複製 ncnn\build\src\目錄下
layer_type_enum.h、layer_registry.h、layer_declaration.h、platform.h
到ncnn_library\include\ncnn下
2 複製 lib
複製 ncnn\build\src\Release\ncnn.lib到ncnn_library\lib
複製 ncnn\build\src\Debug\ncnn.lib到ncnn_library\lib (改名爲ncnnd.lib)
3 複製 exe
複製 ncnn\build\tools\caffe\Release下caffe2ncnn.exe到ncnn_library\exe
複製 ncnn\build\tools\onnx\Release下 onnx2ncnn.exe到ncnn_library\exe
複製 ncnn\build\tools\mxnet\Release下mxnet2ncnn.exe到ncnn_library\exe
opencv
從https://opencv.org下載 opencv4.1.1並解壓到 D:\opencv411
1 複製 D:\opencv411\build\include 目錄下
opencv2
到 ncnn_deploy\ncnn_library\include目錄下.
2 複製 D:\opencv411\build\x64\vc14\lib 目錄下
opencv_world411.lib
opencv_world411d.lib
到 ncnn_deploy\ncnn_library\lib目錄下.
3 複製 D:\opencv411\build\x64\vc14\bin 目錄下
opencv_videoio_ffmpeg411_64.dll
opencv_world411.dll
opencv_world411d.dll
到 ncnn_deploy\ncnn_library\bin目錄下.