diff --git a/ports/onnx/portfile.cmake b/ports/onnx/portfile.cmake index 305ff3f5..2ceb9ad7 100644 --- a/ports/onnx/portfile.cmake +++ b/ports/onnx/portfile.cmake @@ -7,6 +7,7 @@ vcpkg_from_github( SHA512 b46a4ab70af88053318eba45251c1f71528f15e45a33042877570e8d857febd3ec66e2e811fcda2105a4f17b84c9a1c6a0aaa22756c3287321b3ea29e83127fd PATCHES fix-cmakelists.patch + support-test.patch ) string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" USE_STATIC_RUNTIME) @@ -27,10 +28,12 @@ message(STATUS "Using protoc: ${PROTOC}") vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES - python BUILD_ONNX_PYTHON - protobuf-lite ONNX_USE_LITE_PROTO - disable-exception ONNX_DISABLE_EXCEPTIONS - disable-static-generation ONNX_DISABLE_STATIC_REGISTRATION + python BUILD_ONNX_PYTHON + protobuf-lite ONNX_USE_LITE_PROTO + test ONNX_BUILD_TESTS + INVERTED_FEATURES + exception ONNX_DISABLE_EXCEPTIONS + static-registration ONNX_DISABLE_STATIC_REGISTRATION ) if("python" IN_LIST FEATURES) @@ -69,7 +72,6 @@ vcpkg_cmake_configure( -DONNX_GEN_PB_TYPE_STUBS=ON -DONNX_USE_PROTOBUF_SHARED_LIBS=${USE_PROTOBUF_SHARED} -DONNX_USE_MSVC_STATIC_RUNTIME=${USE_STATIC_RUNTIME} - -DONNX_BUILD_TESTS=OFF -DONNX_BUILD_BENCHMARKS=OFF MAYBE_UNUSED_VARIABLES ONNX_USE_MSVC_STATIC_RUNTIME @@ -78,6 +80,9 @@ vcpkg_cmake_configure( vcpkg_cmake_install() vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ONNX PACKAGE_NAME ONNX) +if("test" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES onnx_gtests AUTO_CLEAN) +endif() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" diff --git a/ports/onnx/support-test.patch b/ports/onnx/support-test.patch new file mode 100644 index 00000000..132b3b44 --- /dev/null +++ b/ports/onnx/support-test.patch @@ -0,0 +1,54 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dd9fba2..651cb4e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -125,8 +125,7 @@ if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + endif() + + if(ONNX_BUILD_TESTS) +- list(APPEND CMAKE_MODULE_PATH ${ONNX_ROOT}/cmake/external) +- include(googletest) ++ find_package(GTest CONFIG REQUIRED) + endif() + + if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf)) +diff --git a/cmake/unittest.cmake b/cmake/unittest.cmake +index e71b92a..afccacf 100644 +--- a/cmake/unittest.cmake ++++ b/cmake/unittest.cmake +@@ -22,7 +22,7 @@ function(AddTest) + list(REMOVE_DUPLICATES _UT_SOURCES) + + add_executable(${_UT_TARGET} ${_UT_SOURCES}) +- add_dependencies(${_UT_TARGET} onnx onnx_proto googletest) ++ add_dependencies(${_UT_TARGET} onnx onnx_proto) + + target_include_directories(${_UT_TARGET} + PUBLIC ${googletest_INCLUDE_DIRS} +@@ -30,7 +30,7 @@ function(AddTest) + ${PROTOBUF_INCLUDE_DIRS} + ${ONNX_ROOT} + ${CMAKE_CURRENT_BINARY_DIR}) +- target_link_libraries(${_UT_TARGET} ${_UT_LIBS} ${CMAKE_THREAD_LIBS_INIT}) ++ target_link_libraries(${_UT_TARGET} ${_UT_LIBS} ${CMAKE_THREAD_LIBS_INIT} GTest::gtest) + if(TARGET protobuf::libprotobuf) + target_link_libraries(${_UT_TARGET} protobuf::libprotobuf) + else() +@@ -84,3 +84,4 @@ function(AddTest) + endfunction(AddTest) + + addtest(TARGET ${UT_NAME} SOURCES ${${UT_NAME}_src} LIBS ${${UT_NAME}_libs}) ++install(TARGETS ${UT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) +diff --git a/onnx/test/cpp/test_main.cc b/onnx/test/cpp/test_main.cc +index cee5e79..d77d2f2 100644 +--- a/onnx/test/cpp/test_main.cc ++++ b/onnx/test/cpp/test_main.cc +@@ -8,7 +8,7 @@ + + #include "gtest/gtest.h" + +-GTEST_API_ int main(int argc, char** argv) { ++int main(int argc, char** argv) { + std::cout << "Running main() from test_main.cc" << std::endl; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); diff --git a/ports/onnx/vcpkg.json b/ports/onnx/vcpkg.json index 450ce52d..44aaf3a3 100644 --- a/ports/onnx/vcpkg.json +++ b/ports/onnx/vcpkg.json @@ -1,6 +1,7 @@ { "name": "onnx", "version-semver": "1.15.0", + "port-version": 1, "description": "Open standard for machine learning interoperability", "homepage": "https://onnx.ai", "license": "Apache-2.0", @@ -19,12 +20,12 @@ "host": true } ], + "default-features": [ + "exception" + ], "features": { - "disable-exception": { - "description": "Disable exception handling" - }, - "disable-static-generation": { - "description": "Disable static registration for onnx operator schemas" + "exception": { + "description": "Enable exception handling" }, "python": { "description": "Build Python binaries", @@ -35,6 +36,15 @@ "host": true } ] + }, + "static-registration": { + "description": "Enable static registration for onnx operator schemas" + }, + "test": { + "description": "Enable exception handling", + "dependencies": [ + "gtest" + ] } } } diff --git a/test/self-hosted-cuda.json b/test/self-hosted-cuda.json index e4943a73..9eb9fc46 100644 --- a/test/self-hosted-cuda.json +++ b/test/self-hosted-cuda.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "test", - "version-date": "2024-05-13", + "version-date": "2024-05-25", "description": "vcpkg registry maintained by @luncliff", "homepage": "https://github.com/luncliff/vcpkg-registry", "supports": "windows", @@ -13,19 +13,26 @@ ], "platform": "x64 & windows" }, - { - "name": "onnxruntime", - "features": [ - "cuda" - ], - "platform": "x64 & windows" - }, "nvidia-cnmem", "nvidia-cutlass", "nvidia-nvbench", "nvidia-tools-extension-sdk", + "nvidia-triton-client", "nvidia-triton-common", "nvidia-triton-core", - "nvidia-triton-client" + { + "name": "onnx", + "features": [ + "static-registration", + "test" + ] + }, + { + "name": "onnxruntime", + "features": [ + "cuda" + ], + "platform": "x64 & windows" + } ] -} \ No newline at end of file +} diff --git a/test/self-hosted.json b/test/self-hosted.json index 76f43b22..d4c5c633 100644 --- a/test/self-hosted.json +++ b/test/self-hosted.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "test", - "version-date": "2024-05-18", + "version-date": "2024-05-25", "description": "vcpkg registry maintained by @luncliff", "homepage": "https://github.com/luncliff/vcpkg-registry", "supports": "windows", @@ -14,6 +14,13 @@ "platform": "x64 & windows" }, "liblzma", + { + "name": "onnx", + "features": [ + "static-registration", + "test" + ] + }, { "name": "onnxruntime", "features": [ diff --git a/test/vcpkg.json b/test/vcpkg.json index 6b100c85..30c0cd4b 100644 --- a/test/vcpkg.json +++ b/test/vcpkg.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "test", - "version-date": "2024-05-18", + "version-date": "2024-05-25", "description": "vcpkg registry maintained by @luncliff", "homepage": "https://github.com/luncliff/vcpkg-registry", "supports": "windows | linux | osx | ios", @@ -54,6 +54,13 @@ "platform": "osx | ios" }, "miniaudio", + { + "name": "onnx", + "features": [ + "static-registration", + "test" + ] + }, { "name": "onnxruntime", "features": [ diff --git a/versions/baseline.json b/versions/baseline.json index 38bd882c..25f4756c 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -130,7 +130,7 @@ }, "onnx": { "baseline": "1.15.0", - "port-version": 0 + "port-version": 1 }, "onnxruntime": { "baseline": "1.17.3", diff --git a/versions/o-/onnx.json b/versions/o-/onnx.json index a8ab9128..0ea46893 100644 --- a/versions/o-/onnx.json +++ b/versions/o-/onnx.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "fd1d8cd2b64f75ba7c9d34f1d4364ba3d038ac73", + "version-semver": "1.15.0", + "port-version": 1 + }, { "git-tree": "18fa90d742ae729066d99e418a07a4a8f00e34be", "version-semver": "1.15.0",