Skip to content
New issue

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

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

Already on GitHub? # to your account

[onnx] Remove Protobuf_INCLUDE_DIR in ONNXConfig.cmake and use find_dependency(protobuf) #43126

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ports/onnx/fix-dependency-protobuf.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,19 @@ index d81ac1d..9f97998 100644
if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf))
# Sometimes we need to use protoc compiled for host architecture while linking
# libprotobuf against target architecture. See https://github.com/caffe2/caffe
diff --git a/cmake/ONNXConfig.cmake.in b/cmake/ONNXConfig.cmake.in
index d588f8a..dbd4398 100644
--- a/cmake/ONNXConfig.cmake.in
+++ b/cmake/ONNXConfig.cmake.in
@@ -6,9 +6,8 @@
# library version information
set(ONNX_VERSION "@ONNX_VERSION@")

-list(APPEND CMAKE_PREFIX_PATH "@PROTOBUF_DIR@")
-set(Protobuf_INCLUDE_DIR "@PROTOBUF_INCLUDE_DIR@")
-find_package(Protobuf REQUIRED)
+include(CMakeFindDependencyMacro)
+find_dependency(protobuf CONFIG)

# import targets
include ("${CMAKE_CURRENT_LIST_DIR}/ONNXTargets.cmake")
4 changes: 0 additions & 4 deletions ports/onnx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ONNX)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/ONNXConfig.cmake" "# import targets"
[[# import targets
include(CMakeFindDependencyMacro)
find_dependency(protobuf CONFIG)]])

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
Expand Down
1 change: 1 addition & 0 deletions ports/onnx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "onnx",
"version-semver": "1.16.2",
"port-version": 1,
"description": "Open standard for machine learning interoperability",
"homepage": "https://onnx.ai",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6610,7 +6610,7 @@
},
"onnx": {
"baseline": "1.16.2",
"port-version": 0
"port-version": 1
},
"onnx-optimizer": {
"baseline": "0.3.19",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/onnx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "262df4daa9534c3c514b1a4f7c048369b575568f",
"version-semver": "1.16.2",
"port-version": 1
},
{
"git-tree": "57d8f77c2964232239ba10b3f2ebf16698486d9a",
"version-semver": "1.16.2",
Expand Down
Loading