天天看點

ncnn在win10+VS2013平台編譯1、編譯protobuf3.4.02、編譯ncnn library3、下載下傳Vulkan SDK并安裝(可選)

1、編譯protobuf3.4.0

從位址https://github.com/google/protobuf/archive/v3.4.0.zip 下載下傳protobuf3.4.0并解壓,打開VS2013 x64 Native Tools Command Prompt (本機工具指令提示符)。

ncnn在win10+VS2013平台編譯1、編譯protobuf3.4.02、編譯ncnn library3、下載下傳Vulkan SDK并安裝(可選)

在指令行中移動到解壓出來的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
           
ncnn在win10+VS2013平台編譯1、編譯protobuf3.4.02、編譯ncnn library3、下載下傳Vulkan SDK并安裝(可選)
ncnn在win10+VS2013平台編譯1、編譯protobuf3.4.02、編譯ncnn library3、下載下傳Vulkan SDK并安裝(可選)
ncnn在win10+VS2013平台編譯1、編譯protobuf3.4.02、編譯ncnn library3、下載下傳Vulkan SDK并安裝(可選)

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。

ncnn在win10+VS2013平台編譯1、編譯protobuf3.4.02、編譯ncnn library3、下載下傳Vulkan SDK并安裝(可選)
ncnn在win10+VS2013平台編譯1、編譯protobuf3.4.02、編譯ncnn library3、下載下傳Vulkan SDK并安裝(可選)
ncnn在win10+VS2013平台編譯1、編譯protobuf3.4.02、編譯ncnn library3、下載下傳Vulkan SDK并安裝(可選)

3、下載下傳Vulkan SDK并安裝(可選)

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

原因:後邊調用編譯後的lib庫的時候需要包含vulkan相關的頭檔案,否則會編譯不過,出現下面的錯誤:

ncnn在win10+VS2013平台編譯1、編譯protobuf3.4.02、編譯ncnn library3、下載下傳Vulkan SDK并安裝(可選)

參考連結:

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

繼續閱讀