diff --git a/ports/onnx/fix-cmakelists.patch b/ports/onnx/fix-cmakelists.patch index e6c68370b27992..c5863deafe53b8 100644 --- a/ports/onnx/fix-cmakelists.patch +++ b/ports/onnx/fix-cmakelists.patch @@ -66,3 +66,21 @@ index 628dcaa..300e4ea 100644 install(DIRECTORY ${ONNX_ROOT}/onnx DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING +@@ -639,7 +639,7 @@ endif() + + 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) + endif() + + # ---[ ONNXIFI dummy backend +-add_library(onnxifi_dummy SHARED onnx/onnxifi_dummy.c) ++add_library(onnxifi_dummy onnx/onnxifi_dummy.c) + + if(ONNXIFI_ENABLE_EXT) + add_definitions(-DONNXIFI_ENABLE_EXT=ON) diff --git a/ports/onnx/portfile.cmake b/ports/onnx/portfile.cmake index 1c565ab0d5f302..7d8968fcaf8e57 100644 --- a/ports/onnx/portfile.cmake +++ b/ports/onnx/portfile.cmake @@ -9,15 +9,9 @@ vcpkg_from_github( SHA512 a3eecc74ce4f22524603fb86367d21c87a143ba27eef93ef4bd2e2868c2cadeb724b84df58a429286e7824adebdeba7fa059095b7ab29df8dcea8777bd7f4101 PATCHES fix-cmakelists.patch - wrap-onnxifi-targets.patch ) -if(VCPKG_TARGET_IS_WINDOWS) - string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" USE_STATIC_RUNTIME) - list(APPEND PLATFORM_OPTIONS - -DONNX_USE_MSVC_STATIC_RUNTIME=${USE_STATIC_RUNTIME} - ) -endif() +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) @@ -30,35 +24,30 @@ endif() vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES - pybind11 BUILD_ONNX_PYTHON + pybind11 BUILD_ONNX_PYTHON + protobuf-lite ONNX_USE_LITE_PROTO ) # Like protoc, python is required for codegen. vcpkg_find_acquire_program(PYTHON3) -# PATH for .bat scripts can find 'python' +# PATH for .bat scripts so it can find 'python' get_filename_component(PYTHON_DIR ${PYTHON3} PATH) vcpkg_add_to_path(PREPEND ${PYTHON_DIR}) -if("pybind11" IN_LIST FEATURES) - # When BUILD_ONNX_PYTHON, we need Development component. Give a hint for FindPython3 - list(APPEND FEATURE_OPTIONS - -DPython3_ROOT_DIR=${CURRENT_INSTALLED_DIR} - ) -endif() - vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - ${FEATURE_OPTIONS} ${PLATFORM_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 - -DONNXIFI_ENABLE_EXT=OFF + -DONNX_USE_MSVC_STATIC_RUNTIME=${USE_STATIC_RUNTIME} -DONNX_BUILD_TESTS=OFF -DONNX_BUILD_BENCHMARKS=OFF + MAYBE_UNUSED_VARIABLES + ONNX_USE_MSVC_STATIC_RUNTIME ) if("pybind11" IN_LIST FEATURES) diff --git a/ports/onnx/vcpkg.json b/ports/onnx/vcpkg.json index 6f9ee73238067e..3e8d6a1e2e2ce6 100644 --- a/ports/onnx/vcpkg.json +++ b/ports/onnx/vcpkg.json @@ -1,8 +1,10 @@ { "name": "onnx", "version-semver": "1.9.0", + "port-version": 1, "description": "Open standard for machine learning interoperability", "homepage": "https://onnx.ai", + "license": "Apache-2.0", "supports": "!uwp", "dependencies": [ "protobuf", @@ -10,10 +12,6 @@ "name": "protobuf", "host": true }, - { - "name": "python3", - "host": true - }, { "name": "vcpkg-cmake", "host": true @@ -24,11 +22,11 @@ } ], "features": { + "protobuf-lite": { + "description": "Use lite protobuf instead of full" + }, "pybind11": { - "description": "Build Python binaries", - "dependencies": [ - "pybind11" - ] + "description": "Build Python binaries" } } } diff --git a/ports/onnx/wrap-onnxifi-targets.patch b/ports/onnx/wrap-onnxifi-targets.patch deleted file mode 100644 index 598edf6030b079..00000000000000 --- a/ports/onnx/wrap-onnxifi-targets.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 300e4ea..155dd0d 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -614,6 +614,7 @@ if(APPLE) - set_target_properties(onnx PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") - endif() - -+if(ONNXIFI_ENABLE_EXT) - # ---[ ONNX Interface for Framework Integratin (ONNXIFI) - add_library(onnxifi INTERFACE) - target_include_directories(onnxifi INTERFACE -@@ -688,6 +689,7 @@ if(MSVC) - # lists from 'identifier2' - ) - endif() -+endif() # ONNXIFI_ENABLE_EXT - - include(GNUInstallDirs) - -@@ -737,8 +739,14 @@ install(FILES - install(EXPORT ONNXTargets DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ONNX") - install(TARGETS - onnx onnx_proto -- onnxifi onnxifi_dummy onnxifi_loader - EXPORT ONNXTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+if(ONNXIFI_ENABLE_EXT) -+ install(TARGETS -+ onnxifi onnxifi_dummy onnxifi_loader -+ EXPORT ONNXTargets -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - - if(NOT ANDROID AND NOT IOS) - install(TARGETS onnxifi_wrapper -@@ -748,6 +756,7 @@ endif() - if(ONNXIFI_DUMMY_BACKEND) - add_definitions(-DONNXIFI_DUMMY_BACKEND=1) - endif() -+endif() # ONNXIFI_ENABLE_EXT - - if(ONNX_BUILD_TESTS) - include(${ONNX_ROOT}/cmake/unittest.cmake) diff --git a/versions/baseline.json b/versions/baseline.json index c977d55ca6fcb1..e483c9b06ca66c 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4710,7 +4710,7 @@ }, "onnx": { "baseline": "1.9.0", - "port-version": 0 + "port-version": 1 }, "onnx-optimizer": { "baseline": "0.2.6", diff --git a/versions/o-/onnx.json b/versions/o-/onnx.json index 5f4fc6e16a5846..6641b095c6803b 100644 --- a/versions/o-/onnx.json +++ b/versions/o-/onnx.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "27724661edbd68109ff786713dffa66b8c31f234", + "version-semver": "1.9.0", + "port-version": 1 + }, { "git-tree": "b53c9c9e969928def925c57ea5ddcdfb09293693", "version-semver": "1.9.0",