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

This commit is contained in:
PARK DongHa 2025-01-08 02:14:46 +09:00 committed by GitHub
parent f54003d659
commit 93570a28ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 23 additions and 5 deletions

View File

@ -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")

View File

@ -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"

View File

@ -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",

View File

@ -6610,7 +6610,7 @@
},
"onnx": {
"baseline": "1.16.2",
"port-version": 0
"port-version": 1
},
"onnx-optimizer": {
"baseline": "0.3.19",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "262df4daa9534c3c514b1a4f7c048369b575568f",
"version-semver": "1.16.2",
"port-version": 1
},
{
"git-tree": "57d8f77c2964232239ba10b3f2ebf16698486d9a",
"version-semver": "1.16.2",