Win10下编译MNN
执行path\MNN\schema\generate.ps1,ps1文件是PowerShell写好的脚本文件。在Windows系统中,默认情况下是不允许执行.ps1文件的。需要 执行如下命令,降低系统的安全性,允许执行脚本:set-executionpolicy -executionpolicy unrestricted,具体做法:
(1)C:\Windows\System32\WindowsPowerShell\v1.0目录下以管理员权限打开powershell.exe,然后执行set-executionpolicy -executionpolicy unrestricted,提示选Y
cd 到path\MNN\schema下执行generate.ps1
(2)即使步骤1做了 执行 schema\generate.ps1 还会报如下错误:无法将“../../3rd_party/flatbuffers/tmp/flatc.exe”项识别为cmdlet、函数、脚本文件或可运行程序的名称。这个去 https://github.com/google/flatbuffers/releases 下载下flatc.exe 放到/3rd_party/flatbuffers/tmp 目录下即可。
(3)接下来就可以按照官方给的教程安装了(已经安装了vs2019)
但是需要注意的是第3步修改语言设置Change "Setting -> region and language -> administration -> non-Unicide program language" to English (American), otherwise compile may failed because of encoding format.
Ok设置完毕,然后重启,接着执行编译命令定会成功;
cd /path/to/MNN
mkdir build && cd build
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ..
nmake
编译完成
Build目录下:MNN.dll和MNN.lib,头文件就在MNN根目录的include里面,好了现在开始配置验证吧!