Use latest vcpkg commit in configuration, sync manifest with deps.txt (#23554)

### Description

`python3` dependency is removed in `onnx` port of
https://github.com/microsoft/vcpkg upstream.

* https://github.com/microsoft/vcpkg/pull/43236
*
https://github.com/microsoft/onnxruntime/pull/23285#issuecomment-2579073056
(Previous work)

Removed `nsync`, and use ONNX 1.70.0+ in vcpkg.json(manifest)

### Motivation and Context

* Help #23158
* #23456
This commit is contained in:
PARK DongHa 2025-02-01 05:34:07 +09:00 committed by GitHub
parent a9d4d08ed1
commit 169917b1e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 4 additions and 210 deletions

View file

@ -2,7 +2,7 @@
"default-registry": {
"kind": "git",
"repository": "https://github.com/Microsoft/vcpkg",
"baseline": "93570a28ecdf49d3d9676cec8aa0cc72935d43db"
"baseline": "d504de05dcd7b55df34976be1c824324ec6bca2b"
},
"registries": []
}

View file

@ -1,67 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4dd56b6..2ff3e29 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,6 +65,27 @@ endif()
include(GNUInstallDirs)
+# install protobuf files
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-data.proto
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-data.proto3
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-ml.proto
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-ml.proto3
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-operators-ml.proto
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx-operators-ml.proto3
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnx
+)
+# install python files
+if(BUILD_ONNX_PYTHON)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_data_pb.py
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_data_pb2.py
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_ml_pb2.py
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_operators_ml_pb2.py
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_operators_pb.py
+ ${CMAKE_CURRENT_BINARY_DIR}/onnx/onnx_pb.py
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnx
+ )
+endif()
+
set(ONNX_ROOT ${PROJECT_SOURCE_DIR})
# Read ONNX version
@@ -116,7 +137,8 @@ endif()
# find_package Python has replaced PythonInterp and PythonLibs since cmake 3.12
# Use the following command in the future; now this is only compatible with the latest pybind11
# find_package(Python ${PY_VERSION} COMPONENTS Interpreter Development REQUIRED)
-find_package(PythonInterp ${PY_VERSION} REQUIRED)
+find_package(Python3 ${PY_VERSION} COMPONENTS Interpreter REQUIRED)
+set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
if(BUILD_ONNX_PYTHON)
find_package(PythonLibs ${PY_VERSION})
endif()
@@ -434,6 +456,7 @@ target_link_libraries(onnx PUBLIC onnx_proto)
add_onnx_global_defines(onnx)
if(BUILD_ONNX_PYTHON)
+ find_package(Python3 ${PY_VERSION} COMPONENTS Development REQUIRED)
if("${PY_EXT_SUFFIX}" STREQUAL "")
if(MSVC)
set(PY_EXT_SUFFIX ".pyd")
@@ -452,10 +475,14 @@ if(BUILD_ONNX_PYTHON)
target_include_directories(onnx_cpp2py_export PRIVATE
$<BUILD_INTERFACE:${ONNX_ROOT}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
- $<INSTALL_INTERFACE:include>)
+ ${Python3_INCLUDE_DIRS})
+ target_link_directories(onnx_cpp2py_export PRIVATE
+ ${Python3_LIBRARY_DIRS})
+ target_link_libraries(onnx_cpp2py_export PRIVATE
+ ${Python3_LIBRARIES})
# pybind11 is a header only lib
- find_package(pybind11 2.2 CONFIG)
+ find_package(pybind11 2.2 CONFIG REQUIRED)
if(NOT pybind11_FOUND)
if(EXISTS "${ONNX_ROOT}/third_party/pybind11/include/pybind11/pybind11.h")
add_subdirectory("${ONNX_ROOT}/third_party/pybind11")

View file

@ -1,28 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d81ac1d..9f97998 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -149,6 +149,7 @@ if(ONNX_BUILD_TESTS)
set(googletest_STATIC_LIBRARIES GTest::gtest)
endif()
+find_package(protobuf CONFIG REQUIRED)
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

@ -1,83 +0,0 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO onnx/onnx
REF "v${VERSION}"
SHA512 5a18e2b19ec9c18c8b115fb7e12ed98eddaa581c95f15c4dd420cd6c86e7caa04f9a393da589e76b89cf9b3544abd3749a8c77c2446782f37502eb74e9b1f661
PATCHES
fix-cmakelists.patch
fix-dependency-protobuf.patch
)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" USE_STATIC_RUNTIME)
# ONNX_USE_PROTOBUF_SHARED_LIBS: find the library and check its file extension
find_library(PROTOBUF_LIBPATH NAMES protobuf PATHS "${CURRENT_INSTALLED_DIR}/bin" "${CURRENT_INSTALLED_DIR}/lib" REQUIRED)
get_filename_component(PROTOBUF_LIBNAME "${PROTOBUF_LIBPATH}" NAME)
set(USE_PROTOBUF_SHARED OFF)
# Like protoc, python is required for codegen.
vcpkg_find_acquire_program(PYTHON3)
# PATH for .bat scripts so it can find 'python'
get_filename_component(PYTHON_DIR "${PYTHON3}" PATH)
vcpkg_add_to_path(PREPEND "${PYTHON_DIR}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DPython3_EXECUTABLE=${PYTHON3}
-DONNX_ML=ON
-DONNX_GEN_PB_TYPE_STUBS=ON
-DONNX_USE_PROTOBUF_SHARED_LIBS=${USE_PROTOBUF_SHARED}
-DONNX_USE_LITE_PROTO=OFF
-DONNX_USE_MSVC_STATIC_RUNTIME=${USE_STATIC_RUNTIME}
-DONNX_BUILD_TESTS=OFF
-DONNX_BUILD_BENCHMARKS=OFF
-DONNX_DISABLE_STATIC_REGISTRATION=ON
MAYBE_UNUSED_VARIABLES
ONNX_USE_MSVC_STATIC_RUNTIME
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ONNX)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
# the others are empty
"${CURRENT_PACKAGES_DIR}/include/onnx/backend"
"${CURRENT_PACKAGES_DIR}/include/onnx/bin"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/controlflow"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/generator"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/image"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/logical"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/math"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/nn"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/object_detection"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/optional"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/quantization"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/reduction"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/rnn"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/sequence"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/text"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/traditionalml"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/training"
"${CURRENT_PACKAGES_DIR}/include/onnx/examples"
"${CURRENT_PACKAGES_DIR}/include/onnx/frontend"
"${CURRENT_PACKAGES_DIR}/include/onnx/onnx_cpp2py_export"
"${CURRENT_PACKAGES_DIR}/include/onnx/test"
"${CURRENT_PACKAGES_DIR}/include/onnx/tools"
"${CURRENT_PACKAGES_DIR}/include/onnx/onnx_ml"
"${CURRENT_PACKAGES_DIR}/include/onnx/onnx_data"
"${CURRENT_PACKAGES_DIR}/include/onnx/onnx_operators_ml"
"${CURRENT_PACKAGES_DIR}/include/onnx/reference/ops"
"${CURRENT_PACKAGES_DIR}/include/onnx/reference"
)

View file

@ -1,23 +0,0 @@
{
"name": "onnx",
"version-semver": "1.17.0",
"description": "Open standard for machine learning interoperability",
"homepage": "https://onnx.ai",
"license": "Apache-2.0",
"supports": "!uwp",
"dependencies": [
"protobuf",
{
"name": "protobuf",
"host": true
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View file

@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "onnxruntime",
"version-date": "2024-09-10",
"version-date": "2025-01-31",
"description": "ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator",
"homepage": "https://onnxruntime.ai/",
"license": "MIT",
@ -30,14 +30,9 @@
},
"ms-gsl",
"nlohmann-json",
{
"name": "nsync",
"platform": "!windows",
"version>=": "1.26.0"
},
{
"name": "onnx",
"version>=": "1.16.2"
"version>=": "1.17.0"
},
"optional-lite",
{
@ -82,7 +77,7 @@
},
{
"name": "flatbuffers",
"version": "23.5.26"
"version": "23.5.26#1"
}
]
}