编译环境:
windows 10
vs2019
cmake 3.18
python 3.8.10
一、ONNX Runtime(v1.12.0)源码编译
1、源码下载
管理员运行cmd ->cd /d D:/develop/onnxruntime
执行下面下载源码命令:
git clone -b rel-1.12.0 --recursive https://gitee.com/mirrors_microsoft/onnxruntime
2、管理员运行命令行进入onnxruntime目录
.\build.bat --config=Release --cmake_generator="Visual Studio 16 2019" --parallel
3、用vs2019打开生成的onnxruntime项目
正常编译会生成很多lib库
4、使用vs2019命令工具的lib.exe命令来把多个lib打包成一个lib
lib /out:onnxruntime.lib *.lib
二、MMDeploy源码编译动态库
尝试过编译静态库,编译成功,但是在运行中出现model加载失败未找到原因,就放弃了。
git clone -b main https://github.com/open-mmlab/mmdeploy.git MMDeploy cd MMDeploy git submodule update --init --recursive
-
如果由于网络等原因导致拉取仓库子模块失败,可以尝试通过如下指令手动再次安装子模块:
git clone git@github.com:NVIDIA/cub.git third_party/cub cd third_party/cub git checkout c3cceac115 # 返回至 third_party 目录, 克隆 pybind11 cd .. git clone git@github.com:pybind/pybind11.git pybind11 cd pybind11 git checkout 70a58c5 cd .. git clone git@github.com:gabime/spdlog.git spdlog cd spdlog git checkout 9e8e52c048
采用Cmake配置vs2019编译: