ncnn 编译(Build for Windows x64 using Visual Studio Community 2017)
按照github上ncnn的安装提示进行编译(https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-windows-x64-using-visual-studio-community-2017);
1、下载安装vs2017社区版;
2、在 开始 菜单中在vs2017目录下,选择 vs2017 X64 命令工具;
3、下载protobuf(https://github.com/google/protobuf/archive/v3.4.0.zip);
4、在vs2017 X64 命令工具中使用命令编译protobuf(前提是安装了cmake,并设置好环境变量):
G: cd G:\protobuf\protobuf-3.4.0 mkdir build20211229 cd build20211229 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
5、下载Vulkan SDK (https://vulkan.lunarg.com/sdk/home),安装设置好环境变量(https://vulkan.lunarg.com/doc/sdk/1.2.198.1/windows/getting_started.html);
6、下载ncnn,下载glslang放在ncnn目录下的glslang文件夹中;
7、在vs2017 X64 命令工具中使用命令编译ncnn:
G: cd G:\ncnn\ncnn-20211208
mkdir -p build20211229
cd build20211229
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=G:/protobuf/protobuf-3.4.0/build20211229/install/include -DProtobuf_LIBRARIES=G:/protobuf/protobuf-3.4.0/build20211229/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=G:/protobuf/protobuf-3.4.0/build20211229/install/bin/protoc.exe -DNCNN_VULKAN=ON ..
nmake
nmake install
8、安装编译完成(G:\ncnn\ncnn-20211208\build20211229\install)。