diff --git a/ports/onnx-optimizer/fix-cmakelists.patch b/ports/onnx-optimizer/fix-cmakelists.patch index e590b400f8d9a7..d98ed10920cd3b 100644 --- a/ports/onnx-optimizer/fix-cmakelists.patch +++ b/ports/onnx-optimizer/fix-cmakelists.patch @@ -42,36 +42,6 @@ index 0063385..f1522bc 100644 target_include_directories(onnx_optimizer PUBLIC $ $ -@@ -70,7 +77,7 @@ if(BUILD_ONNX_PYTHON) - set(PY_EXT_SUFFIX ".so") - endif() - endif() -- find_package(Python COMPONENTS Interpreter REQUIRED) -+ find_package(Python3 COMPONENTS Development REQUIRED) - - onnxopt_add_library(onnx_opt_cpp2py_export MODULE "onnxoptimizer/cpp2py_export.cc") - set_target_properties(onnx_opt_cpp2py_export PROPERTIES PREFIX "") -@@ -84,7 +91,7 @@ if(BUILD_ONNX_PYTHON) - $ - ${Python_INCLUDE_DIR}) - # 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_opt_cpp2py_export PUBLIC - ${pybind11_INCLUDE_DIRS}) -@@ -121,9 +128,9 @@ if(BUILD_ONNX_PYTHON) - - target_link_libraries(onnx_opt_cpp2py_export PRIVATE onnx_optimizer) - -+ target_link_directories(onnx_opt_cpp2py_export PRIVATE ${Python3_LIBRARY_DIRS}) -+ target_link_libraries(onnx_opt_cpp2py_export PRIVATE ${Python3_LIBRARIES}) - if(MSVC) -- find_package(Python COMPONENTS Interpreter Development REQUIRED) -- target_link_libraries(onnx_opt_cpp2py_export PRIVATE ${Python_LIBRARIES}) - target_compile_options(onnx_opt_cpp2py_export - PRIVATE /MP - /WX diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 6cca9f3..9d79f1a 100644 --- a/cmake/utils.cmake @@ -91,8 +61,8 @@ index 72dcc88..c5639c8 100644 # as well as ONNX Optimizer targets for other cmake libraries to use. +include(CMakeFindDependencyMacro) -+find_dependency(onnx CONFIG) -+ ++find_dependency(protobuf CONFIG) ++find_dependency(ONNX CONFIG) # library version information set(ONNX_OPTIMIZER_VERSION "@ONNX_OPTIMIZER_VERSION@") diff --git a/ports/onnx-optimizer/portfile.cmake b/ports/onnx-optimizer/portfile.cmake index 10e8d7fe78ea60..ce07fb395ff9af 100644 --- a/ports/onnx-optimizer/portfile.cmake +++ b/ports/onnx-optimizer/portfile.cmake @@ -12,30 +12,15 @@ vcpkg_from_github( string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" USE_STATIC_RUNTIME) -vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - FEATURES - pybind11 BUILD_ONNX_PYTHON -) -if("pybind11" IN_LIST FEATURES) - vcpkg_find_acquire_program(PYTHON3) - list(APPEND FEATURE_OPTIONS - -DPython3_EXECUTABLE=${PYTHON3} - -DONNX_USE_PROTOBUF_SHARED_LIBS=ON # /wd4251 - ) -endif() vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS ${FEATURE_OPTIONS} + -DONNX_OPT_USE_SYSTEM_PROTOBUF=ON -DONNX_USE_MSVC_STATIC_RUNTIME=${USE_STATIC_RUNTIME} ) -if("pybind11" IN_LIST FEATURES) - # This target is not in install/export - vcpkg_cmake_build(TARGET onnx_opt_cpp2py_export) -endif() vcpkg_cmake_install() -vcpkg_copy_pdbs() vcpkg_cmake_config_fixup(PACKAGE_NAME ONNXOptimizer CONFIG_PATH lib/cmake/ONNXOptimizer) vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/onnx-optimizer/vcpkg.json b/ports/onnx-optimizer/vcpkg.json index 9ca4a5e77a2a0f..33eeb618d3ec98 100644 --- a/ports/onnx-optimizer/vcpkg.json +++ b/ports/onnx-optimizer/vcpkg.json @@ -1,6 +1,7 @@ { "name": "onnx-optimizer", "version-semver": "0.3.19", + "port-version": 1, "description": "Actively maintained ONNX Optimizer", "homepage": "https://github.com/onnx/optimizer", "license": "Apache-2.0", @@ -14,18 +15,5 @@ "name": "vcpkg-cmake-config", "host": true } - ], - "features": { - "pybind11": { - "description": "Build Python binaries", - "dependencies": [ - { - "name": "onnx", - "features": [ - "pybind11" - ] - } - ] - } - } + ] } diff --git a/ports/onnx/fix-cmakelists.patch b/ports/onnx/fix-cmakelists.patch index f8d300103ab205..2f5e79c95aff5a 100644 --- a/ports/onnx/fix-cmakelists.patch +++ b/ports/onnx/fix-cmakelists.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4dd56b6..2ff3e29 100644 +index b666eec..66c234d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -65,6 +65,27 @@ endif() +@@ -63,6 +63,16 @@ endif() include(GNUInstallDirs) @@ -15,22 +15,11 @@ index 4dd56b6..2ff3e29 100644 + ${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() +@@ -104,7 +114,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) @@ -40,28 +29,3 @@ index 4dd56b6..2ff3e29 100644 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 - $ - $ -- $) -+ ${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") diff --git a/ports/onnx/portfile.cmake b/ports/onnx/portfile.cmake index 31332aafa36046..f741ca064c3996 100644 --- a/ports/onnx/portfile.cmake +++ b/ports/onnx/portfile.cmake @@ -13,6 +13,9 @@ vcpkg_from_github( string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" USE_STATIC_RUNTIME) +# ONNX_CUSTOM_PROTOC_EXECUTABLE +find_program(PROTOC NAMES protoc PATHS "${CURRENT_HOST_INSTALLED_DIR}/tools/protobuf" REQUIRED NO_DEFAULT_PATH NO_CMAKE_PATH) + # 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) @@ -22,32 +25,16 @@ else() set(USE_PROTOBUF_SHARED OFF) endif() -vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - FEATURES - pybind11 BUILD_ONNX_PYTHON -) - -# 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}") - -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} - -DPython3_EXECUTABLE=${PYTHON3} + "-DPython3_EXECUTABLE:FILEPATH=${PYTHON3}" + "-DONNX_CUSTOM_PROTOC_EXECUTABLE:FILEPATH=${PROTOC}" + "-DProtobuf_PROTOC_EXECUTABLE:FILEPATH=${PROTOC}" -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} @@ -56,13 +43,8 @@ vcpkg_cmake_configure( MAYBE_UNUSED_VARIABLES ONNX_USE_MSVC_STATIC_RUNTIME ) - -if("pybind11" IN_LIST FEATURES) - # This target is not in install/export - vcpkg_cmake_build(TARGET onnx_cpp2py_export) -endif() vcpkg_cmake_install() -vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ONNX) +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ONNX PACKAGE_NAME ONNX) vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/onnx/vcpkg.json b/ports/onnx/vcpkg.json index 47c4952b482540..8c3cd291e80b1c 100644 --- a/ports/onnx/vcpkg.json +++ b/ports/onnx/vcpkg.json @@ -1,20 +1,16 @@ { "name": "onnx", "version-semver": "1.17.0", + "port-version": 1, "description": "Open standard for machine learning interoperability", "homepage": "https://onnx.ai", "license": "Apache-2.0", - "supports": "!uwp", "dependencies": [ "protobuf", { "name": "protobuf", "host": true }, - { - "name": "python3", - "host": true - }, { "name": "vcpkg-cmake", "host": true @@ -23,13 +19,5 @@ "name": "vcpkg-cmake-config", "host": true } - ], - "features": { - "pybind11": { - "description": "Build Python binaries", - "dependencies": [ - "pybind11" - ] - } - } + ] } diff --git a/versions/baseline.json b/versions/baseline.json index b579be09bff22a..e9f7f50d98abb0 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6610,11 +6610,11 @@ }, "onnx": { "baseline": "1.17.0", - "port-version": 0 + "port-version": 1 }, "onnx-optimizer": { "baseline": "0.3.19", - "port-version": 0 + "port-version": 1 }, "onnxruntime-gpu": { "baseline": "1.19.2", diff --git a/versions/o-/onnx-optimizer.json b/versions/o-/onnx-optimizer.json index 21ff564b1714cc..4612549bc9b754 100644 --- a/versions/o-/onnx-optimizer.json +++ b/versions/o-/onnx-optimizer.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "df755dc18bda1d4c02a54db6cef63e46021ce872", + "version-semver": "0.3.19", + "port-version": 1 + }, { "git-tree": "126bfc519dc0c50fc52ed0b19a0bd88663bae87f", "version-semver": "0.3.19", diff --git a/versions/o-/onnx.json b/versions/o-/onnx.json index b3a1b486919351..48edbd4ddcbec6 100644 --- a/versions/o-/onnx.json +++ b/versions/o-/onnx.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "1ae91479c59de528eae6e6db5235b8ff0460e222", + "version-semver": "1.17.0", + "port-version": 1 + }, { "git-tree": "9849fadc0639a430cf9c49434b60cbeb08989112", "version-semver": "1.17.0",