DayBreak-u / chineseocr_lite

超轻量级中文ocr,支持竖排文字识别, 支持ncnn、mnn、tnn推理 ( dbnet(1.8M) + crnn(2.5M) + anglenet(378KB)) 总模型仅4.7M
GNU General Public License v2.0
11.72k stars 2.25k forks source link

如何在提供编译build-onnxruntime-vs2019.bat 添加onnxruntime -T v140 #424

Open xpston008 opened 1 year ago

xpston008 commented 1 year ago

请问:如何在提供编译build-onnxruntime-vs2019.bat 添加 -T v140,让编译出来的库支持vs2015

xpston008 commented 1 year ago

看了一下build.py,这样添加是否正确。 --cmake_extra_defines -T v140 CMAKE_INSTALL_PREFIX=./install onnxruntime_BUILD_UNIT_TESTS=OFF ^

benjaminwan commented 1 year ago

看onnxruntime源代码,第517行 https://github.com/microsoft/onnxruntime/blob/main/tools/ci_build/build.py#L517

只支持这些选项 choices=["Visual Studio 15 2017", "Visual Studio 16 2019", "Visual Studio 17 2022", "Ninja"], 默认是这个default="Visual Studio 16 2019"

再看官方的说明文档 https://onnxruntime.ai/docs/build/inferencing.html

The default Windows CMake Generator is Visual Studio 2017, but you can also use the newer Visual Studio 2019 by passing --cmake_generator "Visual Studio 16 2019" to .\build.bat

所以结论是不支持2015

benjaminwan commented 1 year ago

如果想用vs2015编译 ocrlite项目,那就动态链接onnxruntime的dll,不要静态链接它。

xpston008 commented 1 year ago

@benjaminwan 谢谢解惑。build.py 有一个-T 选项,以为时可以增加。 不知下面方法是否可以行。 1.选择的opencv-static + onnxruntime-static 2.Project_OcrLiteOnnx-1.7.0 选择CAPI( 多线程 DLL (/MD)),构建一个onnx.dll 3.在vs2015项目中从onnx导出函数.是否可以行?

benjaminwan commented 1 year ago

做成dll调用,当然可以 这里有个简单的demo用于参考(没有把所有方法导出) https://github.com/benjaminwan/OcrLiteOnnxLibTest