mirror of https://github.com/microsoft/vcpkg.git
[onnx] use 1.19.0 version with OpSchema patch (#48444)
This commit is contained in:
parent
618d6e413b
commit
85d2ce7a5a
|
|
@ -1,31 +1,15 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b666eec..66c234d 100644
|
||||
index 8b5af30..6836651 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -63,6 +63,16 @@ endif()
|
||||
@@ -668,6 +668,10 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/onnx
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
+install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/onnx DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
+ FILES_MATCHING PATTERN "*.proto")
|
||||
+install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/onnx DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
+ FILES_MATCHING PATTERN "*.proto3")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
+# 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
|
||||
+)
|
||||
+
|
||||
set(ONNX_ROOT ${PROJECT_SOURCE_DIR})
|
||||
|
||||
# Read ONNX version
|
||||
@@ -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)
|
||||
-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()
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/ONNXConfigVersion.cmake.in
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 55869f4..e8b20cb 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -524,6 +524,7 @@ else()
|
||||
set_target_properties(onnx_proto PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
|
||||
endif()
|
||||
target_compile_definitions(onnx_proto PRIVATE ${ONNX_API_DEFINE})
|
||||
+target_compile_features(onnx_proto PUBLIC cxx_std_${CMAKE_CXX_STANDARD})
|
||||
|
||||
if(ONNX_USE_LITE_PROTO)
|
||||
if(TARGET protobuf::libprotobuf-lite)
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index d81ac1d..9f97998 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -149,6 +149,7 @@ if(ONNX_BUILD_TESTS)
|
||||
set(googletest_STATIC_LIBRARIES GTest::gtest)
|
||||
endif()
|
||||
|
||||
+find_package(Protobuf CONFIG REQUIRED)
|
||||
if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf))
|
||||
# Sometimes we need to use protoc compiled for host architecture while linking
|
||||
# libprotobuf against target architecture. See https://github.com/caffe2/caffe
|
||||
diff --git a/cmake/ONNXConfig.cmake.in b/cmake/ONNXConfig.cmake.in
|
||||
index d588f8a..dbd4398 100644
|
||||
--- a/cmake/ONNXConfig.cmake.in
|
||||
+++ b/cmake/ONNXConfig.cmake.in
|
||||
@@ -6,9 +6,8 @@
|
||||
# library version information
|
||||
set(ONNX_VERSION "@ONNX_VERSION@")
|
||||
|
||||
-list(APPEND CMAKE_PREFIX_PATH "@PROTOBUF_DIR@")
|
||||
-set(Protobuf_INCLUDE_DIR "@PROTOBUF_INCLUDE_DIR@")
|
||||
-find_package(Protobuf REQUIRED)
|
||||
+include(CMakeFindDependencyMacro)
|
||||
+find_dependency(Protobuf CONFIG)
|
||||
|
||||
# import targets
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/ONNXTargets.cmake")
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
diff --git a/onnx/defs/schema.h b/onnx/defs/schema.h
|
||||
index acf3aac..adae2d5 100644
|
||||
--- a/onnx/defs/schema.h
|
||||
+++ b/onnx/defs/schema.h
|
||||
@@ -979,8 +979,10 @@ class OpSchemaRegistry final : public ISchemaRegistry {
|
||||
|
||||
class OpSchemaRegisterOnce final {
|
||||
public:
|
||||
- // Export to cpp custom register macro
|
||||
- explicit OpSchemaRegisterOnce(
|
||||
+ // Export to cpp custom register macro.
|
||||
+ // DO NOT decorate the constructor as "explicit" because that breaks the macro ONNX_OPERATOR_SCHEMA_UNIQ.
|
||||
+ // NOLINTNEXTLINE(google-explicit-constructor)
|
||||
+ OpSchemaRegisterOnce( // NOSONAR
|
||||
OpSchema op_schema,
|
||||
int opset_version_to_load = 0,
|
||||
bool fail_duplicate_schema = true) {
|
||||
@@ -1311,9 +1313,9 @@ size_t ReplaceAll(std::string& s, const char* from, const char* to);
|
||||
// Legacy macros to register schema at static initialization
|
||||
#define ONNX_OPERATOR_SCHEMA(name) ONNX_OPERATOR_SCHEMA_UNIQ_HELPER(__COUNTER__, name)
|
||||
#define ONNX_OPERATOR_SCHEMA_UNIQ_HELPER(Counter, name) ONNX_OPERATOR_SCHEMA_UNIQ(Counter, name)
|
||||
-#define ONNX_OPERATOR_SCHEMA_UNIQ(Counter, name) \
|
||||
- static ONNX_NAMESPACE::OpSchemaRegistry::OpSchemaRegisterOnce(op_schema_register_once##name##Counter) ONNX_UNUSED = \
|
||||
- OpSchema(#name, __FILE__, __LINE__)
|
||||
+#define ONNX_OPERATOR_SCHEMA_UNIQ(Counter, name) \
|
||||
+ static ONNX_NAMESPACE::OpSchemaRegistry::OpSchemaRegisterOnce op_schema_register_once##name##Counter ONNX_UNUSED = \
|
||||
+ ONNX_NAMESPACE::OpSchema(#name, __FILE__, __LINE__)
|
||||
|
||||
// Helper function
|
||||
size_t ReplaceAll(std::string& s, const char* from, const char* to);
|
||||
|
|
@ -4,16 +4,14 @@ vcpkg_from_github(
|
|||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO onnx/onnx
|
||||
REF "v${VERSION}"
|
||||
SHA512 5a18e2b19ec9c18c8b115fb7e12ed98eddaa581c95f15c4dd420cd6c86e7caa04f9a393da589e76b89cf9b3544abd3749a8c77c2446782f37502eb74e9b1f661
|
||||
SHA512 e6f7b5782a43a91783607549e4d0f0a9cbd46dfb67a602f81aaffc7bcdd8f450fe9c225f0bc314704f2923e396f0df5b03ea91af4a7887203c0b8372bc2749d0
|
||||
PATCHES
|
||||
fix-cmakelists.patch
|
||||
fix-dependency-protobuf.patch
|
||||
fix-cxx_standard.patch
|
||||
fix-pr-7390.patch # part of https://github.com/onnx/onnx PR 7390
|
||||
)
|
||||
|
||||
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
|
||||
|
|
@ -31,17 +29,19 @@ vcpkg_cmake_configure(
|
|||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
${FEATURE_OPTIONS}
|
||||
"-DPython_EXECUTABLE:FILEPATH=${PYTHON3}"
|
||||
"-DPython3_EXECUTABLE:FILEPATH=${PYTHON3}"
|
||||
"-DONNX_CUSTOM_PROTOC_EXECUTABLE:FILEPATH=${PROTOC}"
|
||||
"-DProtobuf_PROTOC_EXECUTABLE:FILEPATH=${PROTOC}"
|
||||
-DONNX_ML=ON
|
||||
-DONNX_USE_PROTOBUF_SHARED_LIBS=${USE_PROTOBUF_SHARED}
|
||||
-DONNX_USE_LITE_PROTO=OFF
|
||||
-DONNX_USE_MSVC_STATIC_RUNTIME=${USE_STATIC_RUNTIME}
|
||||
-DONNX_BUILD_TESTS=OFF
|
||||
-DONNX_BUILD_BENCHMARKS=OFF
|
||||
-DONNX_BUILD_CUSTOM_PROTOBUF=OFF
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
ONNX_USE_MSVC_STATIC_RUNTIME
|
||||
Python_EXECUTABLE
|
||||
Python3_EXECUTABLE
|
||||
)
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ONNX PACKAGE_NAME ONNX)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "onnx",
|
||||
"version-semver": "1.17.0",
|
||||
"port-version": 2,
|
||||
"version-semver": "1.19.0",
|
||||
"description": "Open standard for machine learning interoperability",
|
||||
"homepage": "https://onnx.ai",
|
||||
"license": "Apache-2.0",
|
||||
|
|
|
|||
|
|
@ -7097,8 +7097,8 @@
|
|||
"port-version": 0
|
||||
},
|
||||
"onnx": {
|
||||
"baseline": "1.17.0",
|
||||
"port-version": 2
|
||||
"baseline": "1.19.0",
|
||||
"port-version": 0
|
||||
},
|
||||
"onnx-optimizer": {
|
||||
"baseline": "0.3.19",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "84490e57e9b50a233ec36469c49f064cb3f90822",
|
||||
"version-semver": "1.19.0",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "5db9b37d64932bc2c245c5ce52daded31de03a9e",
|
||||
"version-semver": "1.17.0",
|
||||
|
|
|
|||
Loading…
Reference in New Issue