Skip to content

Commit

Permalink
[onnx] update to 1.13.1 (#30234)
Browse files Browse the repository at this point in the history
* [onnx] update to 1.13.1

* update version
  • Loading branch information
JonLiu1993 committed Mar 20, 2023
1 parent a65afc1 commit e718473
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 62 deletions.
91 changes: 36 additions & 55 deletions ports/onnx/fix-cmakelists.patch
Original file line number Diff line number Diff line change
@@ -1,44 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 628dcaa..300e4ea 100644
index 4dd56b6..2ff3e29 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,8 +111,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(PythonLibs ${PY_VERSION})
+find_package(Python3 ${PY_VERSION} COMPONENTS Interpreter REQUIRED)
+set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})

if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
set(CMAKE_NO_SYSTEM_FROM_IMPORTED 1)
@@ -422,6 +422,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")
@@ -441,10 +442,13 @@ if(BUILD_ONNX_PYTHON)
$<BUILD_INTERFACE:${ONNX_ROOT}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>
- ${PYTHON_INCLUDE_DIR})
-
+ ${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)
+ find_package(pybind11 2.2 CONFIG REQUIRED)
if(pybind11_FOUND)
target_include_directories(onnx_cpp2py_export PUBLIC
${pybind11_INCLUDE_DIRS})
@@ -687,6 +691,27 @@ endif()
@@ -65,6 +65,27 @@ endif()

include(GNUInstallDirs)

Expand All @@ -63,24 +27,41 @@ index 628dcaa..300e4ea 100644
+ )
+endif()
+
install(DIRECTORY ${ONNX_ROOT}/onnx
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
@@ -639,7 +639,7 @@ endif()
set(ONNX_ROOT ${PROJECT_SOURCE_DIR})

if (NOT ANDROID AND NOT IOS)
# ---[ ONNXIFI wrapper
- add_library(onnxifi_wrapper MODULE onnx/onnxifi_wrapper.c)
+ add_library(onnxifi_wrapper onnx/onnxifi_wrapper.c)
if(MSVC)
add_msvc_runtime_flag(onnxifi_wrapper)
endif()
@@ -669,7 +669,7 @@ if (NOT ANDROID AND NOT IOS)
# 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)

# ---[ ONNXIFI dummy backend
-add_library(onnxifi_dummy SHARED onnx/onnxifi_dummy.c)
+add_library(onnxifi_dummy onnx/onnxifi_dummy.c)
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})

if(ONNXIFI_ENABLE_EXT)
add_definitions(-DONNXIFI_ENABLE_EXT=ON)
# 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")
8 changes: 5 additions & 3 deletions ports/onnx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO onnx/onnx
REF v1.10.2
SHA512 7519d326cd2b2b13a269ec0d01af07c32115d183dae6e1eaae55f5b23b6c92b2aadbb2b1e555557f4201bbcf921fa563d09d45d7f1d3bd2399c1a94a6ef63303
REF "v${VERSION}"
SHA512 325859f591dece43a083a0945aefe3427bfdb68a98ef5922343bf7ed959528947e7664d6c8e3e3d35c390d6c20ef22d07c672e5311f80c72c199931be6c256c3
PATCHES
fix-cmakelists.patch
fix-dependency-protobuf.patch
Expand Down Expand Up @@ -63,7 +63,7 @@ endif()
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ONNX)

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
Expand Down Expand Up @@ -92,4 +92,6 @@ file(REMOVE_RECURSE
"${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"
)
3 changes: 1 addition & 2 deletions ports/onnx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "onnx",
"version-semver": "1.10.2",
"port-version": 1,
"version-semver": "1.13.1",
"description": "Open standard for machine learning interoperability",
"homepage": "https://onnx.ai",
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5653,8 +5653,8 @@
"port-version": 1
},
"onnx": {
"baseline": "1.10.2",
"port-version": 1
"baseline": "1.13.1",
"port-version": 0
},
"onnx-optimizer": {
"baseline": "0.2.6",
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": "9b31a613878d713e6573b82752f4aa6b78e71820",
"version-semver": "1.13.1",
"port-version": 0
},
{
"git-tree": "62ee0b78332273115540d669065a467314aace3a",
"version-semver": "1.10.2",
Expand Down

0 comments on commit e718473

Please sign in to comment.