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

[onnx] Install proto, proto3 files #214

Merged
merged 2 commits into from
Jun 26, 2024
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
21 changes: 21 additions & 0 deletions ports/onnx/fix-cmake.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,24 @@ index d588f8a..a61af08 100644
find_package(Protobuf REQUIRED)

# import targets
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d7ca84..93999f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -764,7 +764,15 @@ if(ONNX_USE_UNITY_BUILD)

endif()

-
+# 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(TARGETS
onnx onnx_proto
62 changes: 35 additions & 27 deletions ports/onnx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,32 +84,40 @@ endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/include/onnx/reference"
# 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/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/traditionalml"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/training"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/image"
"${CURRENT_PACKAGES_DIR}/include/onnx/defs/text"
"${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"
)

# Traverse the folder and remove "some" empty folders
function(cleanup_once folder)
if(NOT IS_DIRECTORY "${folder}")
return()
endif()
file(GLOB paths LIST_DIRECTORIES true "${folder}/*")
list(LENGTH paths count)
# 1. remove if the given folder is empty
if(count EQUAL 0)
file(REMOVE_RECURSE "${folder}")
message(VERBOSE "Removed ${folder}")
return()
endif()
# 2. repeat the operation for hop 1 sub-directories
foreach(path ${paths})
cleanup_once(${path})
endforeach()
endfunction()

# Some folders may contain empty folders. They will become empty after `cleanup_once`.
# Repeat given times to delete new empty folders.
function(cleanup_repeat folder repeat)
if(NOT IS_DIRECTORY "${folder}")
return()
endif()
while(repeat GREATER_EQUAL 1)
math(EXPR repeat "${repeat} - 1" OUTPUT_FORMAT DECIMAL)
cleanup_once("${folder}")
endwhile()
endfunction()

# https://github.com/microsoft/vcpkg PR 30230
cleanup_repeat("${CURRENT_PACKAGES_DIR}/include" 4)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
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.0",
"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 @@ -130,7 +130,7 @@
},
"onnx": {
"baseline": "1.16.0",
"port-version": 0
"port-version": 1
},
"onnxruntime": {
"baseline": "1.17.3",
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": "84056c069b4cc59b487fc92bbcebb5aaa22b7f9b",
"version-semver": "1.16.0",
"port-version": 1
},
{
"git-tree": "1af25fe8c665cace7ea7cf3e1076d8a77ac2ce70",
"version-semver": "1.16.0",
Expand Down
Loading