Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xpston008 opened this issue Oct 12, 2022 · 5 comments

Comments

@xpston008
Copy link

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

@xpston008
Copy link
Author

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

@benjaminwan
Copy link
Contributor

看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
Copy link
Contributor

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

@xpston008
Copy link
Author

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

@benjaminwan
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants