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

VCPKG port for onnxruntime and modernize cmake builds #7150

Open
ankurvdev opened this issue Mar 26, 2021 · 5 comments
Open

VCPKG port for onnxruntime and modernize cmake builds #7150

ankurvdev opened this issue Mar 26, 2021 · 5 comments
Labels
contributions welcome lower priority issues for the core ORT teams feature request request for unsupported feature or enhancement

Comments

@ankurvdev
Copy link
Contributor

Provider a vcpkg port for onnxruntime for easier builds and linking into external projects.

There's an initial effort made that can be used as a starting template for this
microsoft/vcpkg#14903
This port succeeds for x64-windows-static-md but none of the other standard triplets.

Overall the onnxruntime cmakelist.txt needs cleaning to support such a port in an efficient manner

  • Allow for submodules to be optional
  • Submodule binaries must be picked up using find_package, find_library
  • Export standard cmake-config/cmake-target files for easier find_package(onnxruntime) support
@snnn
Copy link
Member

snnn commented Mar 26, 2021

Nice!

Also, I found finally they added versioning support. https://devblogs.microsoft.com/cppblog/take-control-of-your-vcpkg-dependencies-with-versioning-support/ That was really a blocking issue for us. If without it, Let's say if we put onnxruntime there, but later on protobuf gets a version that breaks onnxruntime build, what should we do? We can't publish a new release immediately just because Google protobuf did so. This was my main concern.

Allow for submodules to be optional

The biggest problem is how to handling ONNX. ONNX Runtime is not using a release version of ONNX. Can vcpkg accept such an ONNX package?

Submodule binaries must be picked up using find_package, find_library
If no submodule exists, that's fine. Otherwise, what if your system already installed protobuf, when you building onnxruntime which protobuf would be used , the one in submodule or the system installed one? It would be very confused.

Export standard cmake-config/cmake-target files for easier find_package(onnxruntime) support

Sorry I don't know how to do that. Welcome to contribute!

@snnn snnn added feature request request for unsupported feature or enhancement contributions welcome lower priority issues for the core ORT teams labels Mar 26, 2021
@roachsinai
Copy link

Hi, so for now find_package(onnxruntime) on windows is not supported?

@snnn
Copy link
Member

snnn commented Aug 18, 2021

Not yet. Welcome to contribute!

@chausner
Copy link
Contributor

chausner commented Oct 2, 2021

Let's say if we put onnxruntime there, but later on protobuf gets a version that breaks onnxruntime build, what should we do? We can't publish a new release immediately just because Google protobuf did so.

You are not required or expected to immediately publish a new version in this case. The vcpkg maintainers ensure that all packages stay compatible, so as part of updating protobuf, they will ensure that all dependent packages continue to work (and include patches for them to make them compatible, if needed).

snnn pushed a commit that referenced this issue Apr 4, 2023
…LLY_DISCONNECTED=ON` (#15323)

### Description
Rework some external targets to ease building with
`-DFETCHCONTENT_FULLY_DISCONNECTED=ON`
This will allow package managers to more easily provide an onnxruntime
package by reducing the amount of patching needed downstream at each
version.

### Motivation and Context
Availability of onnxruntime in some C++ package managers
#7150
conan-io/conan-center-index#16699
microsoft/vcpkg#20548

My initial intent is to get this in conan but the PR would most likely
be useful (though not tested) to vcpkg as well (and maybe others).
I tried to get only a first batch of not too specific patches (i.e. not
specific to conan).

The first commit reworks `flatbuffers` and just extends what @snnn did
in #13991
The second commit reworks `pytorch_cpuinfo`
The third commit reworks `google_nsync`
adityagoel4512 pushed a commit to adityagoel4512/onnxruntime that referenced this issue Apr 5, 2023
…LLY_DISCONNECTED=ON` (microsoft#15323)

### Description
Rework some external targets to ease building with
`-DFETCHCONTENT_FULLY_DISCONNECTED=ON`
This will allow package managers to more easily provide an onnxruntime
package by reducing the amount of patching needed downstream at each
version.

### Motivation and Context
Availability of onnxruntime in some C++ package managers
microsoft#7150
conan-io/conan-center-index#16699
microsoft/vcpkg#20548

My initial intent is to get this in conan but the PR would most likely
be useful (though not tested) to vcpkg as well (and maybe others).
I tried to get only a first batch of not too specific patches (i.e. not
specific to conan).

The first commit reworks `flatbuffers` and just extends what @snnn did
in microsoft#13991
The second commit reworks `pytorch_cpuinfo`
The third commit reworks `google_nsync`
snnn pushed a commit that referenced this issue Jun 20, 2023
**Description**: 
Adds support for cmake find_package.

**Motivation and Context**
As mentioned in issue #7150 onnxruntime doesn't have support for CMake
find_package, this PR adds that and also adds the CMake package version
file. Now anyone can link onnxruntime like this:
```cmake
find_package(onnxruntime)
add_executable(test Source.cpp)
target_link_libraries(test PRIVATE onnxruntime::onnxruntime)
```
this also simplifies #3124
@QiuYilin
Copy link

QiuYilin commented Dec 12, 2023

I tested luncliff's registry luncliff/vcpkg-registry , but encountered a similar problem with conan: conan-io/conan-center-index#17380 (comment) , luncliff/vcpkg-registry/issues/136#issuecomment-1851206111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome lower priority issues for the core ORT teams feature request request for unsupported feature or enhancement
Projects
None yet
Development

No branches or pull requests

5 participants