• ncnn之三(补充):window环境下vs2022安装ncnn+protobuf


    启动VS2022 下面的 x64 Native Tools Command Prompt for VS2022
    在这里插入图片描述

    protobuf

    git clone git@github.com:protocolbuffers/protobuf.git
     # 或者 下载 https://github.com/google/protobuf/archive/v3.11.2.zip
    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
    
    • 1
    • 2
    • 3
    • 4
    • 5

    抽取include文件出来,为下一步编译做打算

    $ ncnn_deploy\protobuf\build_vs2022\extract_includes.bat

    ncnn

    git clone git@github.com:Tencent/ncnn.git
    cd ncnn
    git submodule update --init
    mkdir build
    cd build
    cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=E:/cpp_code/protobuf/build_vs2022/install/include -DProtobuf_LIBRARIES=E:/cpp_code/protobuf/build_vs2022/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=E:/cpp_code/protobuf/build_vs2022/install/bin/protoc.exe -DNCNN_VULKAN=ON ..
    nmake 
    nmake install
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    如果git submodule update --init执行不成功的话,

    git clone git@github.com:Tencent/ncnn.git
    cd ncnn
    mkdir build
    cd build
    cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=ncnn_deploy/protobuf/build_vs2022/install/include -DProtobuf_LIBRARIES=ncnn_deploy/protobuf/build_vs2022/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=ncnn_deploy/protobuf/build_vs2022/install/bin/protoc.exe -DNCNN_VULKAN=OFF ..
    nmake 
    nmake install
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    1 复制 include
    复制 ncnn\build\install\include目录内容 到ncnn_vs2022\include下

    2 复制 lib

    复制 ncnn\build\install\lib\ncnn.lib到ncnn_vs2022\lib

    3 复制 exe

    复制 ncnn\build\install\bin下 onnx2ncnn.exe 到ncnn_vs2022\exe
    复制 ncnn\build\install\bin下ncnn2int8.exe 到ncnn_vs2022\exe
    复制 ncnn\build\install\bin下ncnn2mem.exe 到ncnn_vs2022\exe
    复制 ncnn\build\install\bin下ncnn2table.exe 到ncnn_vs2022\exe
    复制 ncnn\build\install\bin下ncnnmerge.exe 到ncnn_vs2022\exe
    复制 ncnn\build\install\bin下ncnnoptimize.exe 到ncnn_vs2022\exe

  • 相关阅读:
    架构师之路3. 富士康 - 再也不见
    如何从 PowerShell grep 搜索文本
    2020银川B - The Great Wall dp 1383A - String Transformation 1 并查集
    【数理方程】定解问题
    python解析.hhr文件
    Elasticsearch 索引库操作 &文档操作
    记录--纯CSS实现骚气红丝带
    JVM思维导图
    在SQL中,可以使用不同的函数来转换字符串日期格式。以下是一些常用的函数:
    Ipad平替电容笔哪个品牌口碑好?apple pencil平替笔排名
  • 原文地址:https://blog.csdn.net/shanglianlm/article/details/136184251