Skip to content

Commit ecb26fb

Browse files
authored
Integration with ONNX 1.19 (#25678)
### Description <!-- Describe your changes. --> Update ONNX to v1.19.0 The major updates of ONNX: https://github.com/onnx/onnx/wiki/Logistics-for-ONNX-Release-1.19.0 ### Remaining Issues 1. Additional inputs `nonpad_kv_seqlen` to op.Attentnio since opset24 2. Attention implementation bugs in CPU: `test_attention_4d_with_past_and_present_qk_matmul_bias_3d_mask_causal` and `test_attention_4d_with_past_and_present_qk_matmul_bias_4d_mask_causal` 3. New op `TensorScatter` 4. New op `Swish` 5. `ml_dtypes` replaces `custom_element_types` in ONNX onnx/onnx#7089
1 parent 8570298 commit ecb26fb

File tree

55 files changed

+1065
-835
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1065
-835
lines changed

cmake/deps.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ microsoft_gsl;https://github.com/microsoft/GSL/archive/refs/tags/v4.0.0.zip;cf36
3434
microsoft_wil;https://github.com/microsoft/wil/archive/refs/tags/v1.0.230629.1.zip;e4a542a323c070376f7c2d1973d0f7ddbc1d2fa5
3535
mimalloc;https://github.com/microsoft/mimalloc/archive/refs/tags/v2.1.1.zip;d5ee7d34223d0567892db5179849939c8769dc41
3636
mp11;https://github.com/boostorg/mp11/archive/refs/tags/boost-1.82.0.zip;9bc9e01dffb64d9e0773b2e44d2f22c51aace063
37-
onnx;https://github.com/onnx/onnx/archive/refs/tags/v1.18.0.zip;f156d032a3af91b66d554e11158b33ca77bbb1f2
37+
onnx;https://github.com/onnx/onnx/archive/refs/tags/v1.19.0.zip;4c798b73e131438c196e6dcb9f3393968a8936f1
3838
# Use the latest commit of 10.9-GA
3939
onnx_tensorrt;https://github.com/onnx/onnx-tensorrt/archive/d5dce67db7c2e64b07e055571f5ec06f7f254de2.zip;01114d3b67650857281fa50faa2e412130a63b69
4040
protobuf;https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.12.zip;7cf2733949036c7d52fda017badcab093fe73bfa

cmake/external/onnx

Submodule onnx updated 1946 files

cmake/patches/onnx/onnx.patch

Lines changed: 34 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
diff --git a/CMakeLists.txt b/CMakeLists.txt
2-
index 8b5af303..8593fe4a 100644
2+
index 47995579..6cc439f6 100644
33
--- a/CMakeLists.txt
44
+++ b/CMakeLists.txt
5-
@@ -40,6 +40,7 @@ option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
5+
@@ -57,6 +57,7 @@ option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
66
option(ONNX_DISABLE_EXCEPTIONS "Disable exception handling." OFF)
77
option(ONNX_DISABLE_STATIC_REGISTRATION "Disable static registration for ONNX operator schemas." OFF)
88
option(ONNX_USE_UNITY_BUILD "Enable Unity (Jumbo) build for" OFF)
99
+option(ONNX_MINIMAL_BUILD "Build only essential ONNX components" OFF)
1010
if(WIN32)
1111
option(ONNX_USE_MSVC_STATIC_RUNTIME "Build with MSVC static runtime" OFF)
1212
endif()
13-
@@ -461,14 +462,28 @@ relative_protobuf_generate_cpp(gen_onnx_data_proto
14-
list(APPEND ONNX_PROTO_SRCS ${__tmp_srcs})
15-
list(APPEND ONNX_PROTO_HDRS ${__tmp_hdrs})
13+
@@ -411,14 +412,28 @@ relative_protobuf_generate_cpp(ONNX_PROTO_SRCS
14+
15+
add_library(onnx_proto ${ONNX_PROTO_SRCS})
1616

1717
-file(GLOB_RECURSE __tmp_srcs "${ONNX_ROOT}/onnx/*.h" "${ONNX_ROOT}/onnx/*.cc")
1818
-file(GLOB_RECURSE onnx_gtests_src "${ONNX_ROOT}/onnx/test/cpp/*.h"
@@ -45,115 +45,50 @@ index 8b5af303..8593fe4a 100644
4545
+ list(APPEND ONNX_SRCS ${__tmp_srcs})
4646
+endif()
4747

48-
add_library(onnx_proto ${ONNX_PROTO_SRCS} ${ONNX_PROTO_HDRS})
49-
add_dependencies(onnx_proto gen_onnx_operators_proto gen_onnx_data_proto)
50-
@@ -595,13 +610,6 @@ if(ONNX_BUILD_PYTHON)
51-
target_link_libraries(onnx_cpp2py_export PRIVATE ${Python3_LIBRARIES})
52-
target_compile_options(onnx_cpp2py_export
53-
PRIVATE /MP
54-
- /wd4146 # unary minus operator applied to unsigned type,
55-
- # result still unsigned
56-
- /wd4244 # 'argument': conversion from 'google::
57-
- # protobuf::uint64' to 'int', possible
58-
- # loss of data
59-
- /wd4267 # Conversion from 'size_t' to 'int',
60-
- # possible loss of data
61-
${EXTRA_FLAGS})
62-
add_msvc_runtime_flag(onnx_cpp2py_export)
63-
add_onnx_global_defines(onnx_cpp2py_export)
64-
@@ -618,23 +626,9 @@ endif()
65-
if(MSVC)
66-
target_compile_options(onnx_proto
67-
PRIVATE /MP
68-
- /wd4146 # unary minus operator applied to unsigned type,
69-
- # result still unsigned
70-
- /wd4244 #'argument': conversion from 'google::
71-
- #protobuf::uint64' to 'int', possible
72-
- # loss of data
73-
- /wd4267 # Conversion from 'size_t' to 'int',
74-
- # possible loss of data
75-
${EXTRA_FLAGS})
76-
target_compile_options(onnx
77-
PRIVATE /MP
78-
- /wd4146 # unary minus operator applied to unsigned type,
79-
- # result still unsigned
80-
- /wd4244 # 'argument': conversion from 'google::
81-
- # protobuf::uint64' to 'int', possible
82-
- # loss of data
83-
- /wd4267 # Conversion from 'size_t' to 'int',
84-
- # possible loss of data
85-
${EXTRA_FLAGS})
86-
add_msvc_runtime_flag(onnx_proto)
87-
add_msvc_runtime_flag(onnx)
88-
diff --git a/onnx/defs/nn/defs.cc b/onnx/defs/nn/defs.cc
89-
index 64366270..4aed9027 100644
90-
--- a/onnx/defs/nn/defs.cc
91-
+++ b/onnx/defs/nn/defs.cc
92-
@@ -36,7 +36,7 @@ static const char* conv_transpose_auto_pad_doc =
93-
"on whether it is even or odd). In case the padding is an odd number, the extra "
94-
"padding is added at the end for SAME_UPPER and at the beginning for SAME_LOWER.";
95-
96-
-static void convPoolShapeInference(
97-
+void convPoolShapeInference(
98-
InferenceContext& ctx,
99-
bool use_dilation,
100-
bool require_kernel_shape,
101-
@@ -1102,7 +1102,7 @@ ONNX_OPERATOR_SET_SCHEMA(
102-
convPoolShapeInference(ctx, true, false, 0, 1);
103-
}));
104-
105-
-static void convTransposeShapeInference(InferenceContext& ctx) {
106-
+void convTransposeShapeInference(InferenceContext& ctx) {
107-
propagateElemTypeFromInputToOutput(ctx, 0, 0);
108-
109-
// we need at least two inputs to have a shape for this inference.
110-
@@ -1462,7 +1462,7 @@ ONNX_OPERATOR_SET_SCHEMA(
111-
}));
48+
# Hide all symbols we don't need
49+
set_target_properties(onnx_proto PROPERTIES CXX_VISIBILITY_PRESET hidden)
50+
@@ -440,19 +455,6 @@ add_onnx_global_defines(onnx_proto)
51+
target_include_directories(onnx_proto PUBLIC
52+
$<BUILD_INTERFACE:${ONNX_ROOT}>
53+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
54+
-if(MSVC)
55+
- # For disabling Protobuf related warnings
56+
- target_compile_options(onnx_proto PUBLIC
57+
- /wd4146 # unary minus operator applied to unsigned type,
58+
- # result still unsigned
59+
- /wd4244 # 'argument': conversion from 'google::
60+
- # protobuf::uint64' to 'int', possible
61+
- # loss of data
62+
- /wd4267 # Conversion from 'size_t' to 'int',
63+
- # possible loss of data
64+
- /wd4141 # 'inline': used more than once
65+
- )
66+
-endif()
11267

113-
// For GlobalPool operations.
114-
-static void globalPoolTypeShapeInference(InferenceContext& ctx) {
115-
+void globalPoolTypeShapeInference(InferenceContext& ctx) {
116-
propagateElemTypeFromInputToOutput(ctx, 0, 0);
117-
118-
// needs at least one input with shape.
68+
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
69+
# whole-archive linker option not available on AIX.
11970
diff --git a/onnx/defs/nn/old.cc b/onnx/defs/nn/old.cc
120-
index d8ca9a46..1eda4c70 100644
71+
index 40635f97..44770774 100644
12172
--- a/onnx/defs/nn/old.cc
12273
+++ b/onnx/defs/nn/old.cc
123-
@@ -4023,7 +4023,6 @@ ONNX_OPERATOR_SET_SCHEMA(
74+
@@ -4090,7 +4090,6 @@ ONNX_OPERATOR_SET_SCHEMA(
12475
GroupNormalization,
12576
18,
12677
OpSchema()
12778
- .Deprecate()
12879
.SetDoc(GroupNormalization_ver18_doc)
12980
.Attr("epsilon", "The epsilon value to use to avoid division by zero.", AttributeProto::FLOAT, 1e-5f)
13081
.Attr(
131-
diff --git a/onnx/defs/rnn/defs.cc b/onnx/defs/rnn/defs.cc
132-
index c0ed3a39..6c8e2909 100644
133-
--- a/onnx/defs/rnn/defs.cc
134-
+++ b/onnx/defs/rnn/defs.cc
135-
@@ -5,7 +5,7 @@
136-
#include "onnx/defs/schema.h"
137-
138-
namespace ONNX_NAMESPACE {
139-
-static void RNNShapeInference(InferenceContext& ctx) {
140-
+void RNNShapeInference(InferenceContext& ctx) {
141-
TensorShapeProto::Dimension num_directions, seq_length, batch_size, hidden_size;
142-
143-
auto direction = getAttribute(ctx, "direction", "forward");
14482
diff --git a/onnx/defs/schema.h b/onnx/defs/schema.h
145-
index acf3aac7..5bef6e72 100644
83+
index ddd95454..34647987 100644
14684
--- a/onnx/defs/schema.h
14785
+++ b/onnx/defs/schema.h
148-
@@ -980,10 +980,7 @@ class OpSchemaRegistry final : public ISchemaRegistry {
86+
@@ -999,7 +999,7 @@ class OpSchemaRegistry final : public ISchemaRegistry {
14987
class OpSchemaRegisterOnce final {
15088
public:
15189
// Export to cpp custom register macro
15290
- explicit OpSchemaRegisterOnce(
153-
- OpSchema op_schema,
154-
- int opset_version_to_load = 0,
155-
- bool fail_duplicate_schema = true) {
156-
+ OpSchemaRegisterOnce(OpSchema op_schema, int opset_version_to_load = 0, bool fail_duplicate_schema = true) {
157-
OpSchemaRegisterNoExcept(std::move(op_schema), opset_version_to_load, fail_duplicate_schema);
158-
}
159-
static void
91+
+ OpSchemaRegisterOnce(
92+
OpSchema op_schema,
93+
int opset_version_to_load = 0,
94+
bool fail_duplicate_schema = true) {
Lines changed: 34 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
diff --git a/CMakeLists.txt b/CMakeLists.txt
2-
index 8b5af303..8593fe4a 100644
2+
index 47995579..6cc439f6 100644
33
--- a/CMakeLists.txt
44
+++ b/CMakeLists.txt
5-
@@ -40,6 +40,7 @@ option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
5+
@@ -57,6 +57,7 @@ option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
66
option(ONNX_DISABLE_EXCEPTIONS "Disable exception handling." OFF)
77
option(ONNX_DISABLE_STATIC_REGISTRATION "Disable static registration for ONNX operator schemas." OFF)
88
option(ONNX_USE_UNITY_BUILD "Enable Unity (Jumbo) build for" OFF)
99
+option(ONNX_MINIMAL_BUILD "Build only essential ONNX components" OFF)
1010
if(WIN32)
1111
option(ONNX_USE_MSVC_STATIC_RUNTIME "Build with MSVC static runtime" OFF)
1212
endif()
13-
@@ -461,14 +462,28 @@ relative_protobuf_generate_cpp(gen_onnx_data_proto
14-
list(APPEND ONNX_PROTO_SRCS ${__tmp_srcs})
15-
list(APPEND ONNX_PROTO_HDRS ${__tmp_hdrs})
13+
@@ -411,14 +412,28 @@ relative_protobuf_generate_cpp(ONNX_PROTO_SRCS
14+
15+
add_library(onnx_proto ${ONNX_PROTO_SRCS})
1616

1717
-file(GLOB_RECURSE __tmp_srcs "${ONNX_ROOT}/onnx/*.h" "${ONNX_ROOT}/onnx/*.cc")
1818
-file(GLOB_RECURSE onnx_gtests_src "${ONNX_ROOT}/onnx/test/cpp/*.h"
@@ -45,115 +45,50 @@ index 8b5af303..8593fe4a 100644
4545
+ list(APPEND ONNX_SRCS ${__tmp_srcs})
4646
+endif()
4747

48-
add_library(onnx_proto ${ONNX_PROTO_SRCS} ${ONNX_PROTO_HDRS})
49-
add_dependencies(onnx_proto gen_onnx_operators_proto gen_onnx_data_proto)
50-
@@ -595,13 +610,6 @@ if(ONNX_BUILD_PYTHON)
51-
target_link_libraries(onnx_cpp2py_export PRIVATE ${Python3_LIBRARIES})
52-
target_compile_options(onnx_cpp2py_export
53-
PRIVATE /MP
54-
- /wd4146 # unary minus operator applied to unsigned type,
55-
- # result still unsigned
56-
- /wd4244 # 'argument': conversion from 'google::
57-
- # protobuf::uint64' to 'int', possible
58-
- # loss of data
59-
- /wd4267 # Conversion from 'size_t' to 'int',
60-
- # possible loss of data
61-
${EXTRA_FLAGS})
62-
add_msvc_runtime_flag(onnx_cpp2py_export)
63-
add_onnx_global_defines(onnx_cpp2py_export)
64-
@@ -618,23 +626,9 @@ endif()
65-
if(MSVC)
66-
target_compile_options(onnx_proto
67-
PRIVATE /MP
68-
- /wd4146 # unary minus operator applied to unsigned type,
69-
- # result still unsigned
70-
- /wd4244 #'argument': conversion from 'google::
71-
- #protobuf::uint64' to 'int', possible
72-
- # loss of data
73-
- /wd4267 # Conversion from 'size_t' to 'int',
74-
- # possible loss of data
75-
${EXTRA_FLAGS})
76-
target_compile_options(onnx
77-
PRIVATE /MP
78-
- /wd4146 # unary minus operator applied to unsigned type,
79-
- # result still unsigned
80-
- /wd4244 # 'argument': conversion from 'google::
81-
- # protobuf::uint64' to 'int', possible
82-
- # loss of data
83-
- /wd4267 # Conversion from 'size_t' to 'int',
84-
- # possible loss of data
85-
${EXTRA_FLAGS})
86-
add_msvc_runtime_flag(onnx_proto)
87-
add_msvc_runtime_flag(onnx)
88-
diff --git a/onnx/defs/nn/defs.cc b/onnx/defs/nn/defs.cc
89-
index 64366270..4aed9027 100644
90-
--- a/onnx/defs/nn/defs.cc
91-
+++ b/onnx/defs/nn/defs.cc
92-
@@ -36,7 +36,7 @@ static const char* conv_transpose_auto_pad_doc =
93-
"on whether it is even or odd). In case the padding is an odd number, the extra "
94-
"padding is added at the end for SAME_UPPER and at the beginning for SAME_LOWER.";
95-
96-
-static void convPoolShapeInference(
97-
+void convPoolShapeInference(
98-
InferenceContext& ctx,
99-
bool use_dilation,
100-
bool require_kernel_shape,
101-
@@ -1102,7 +1102,7 @@ ONNX_OPERATOR_SET_SCHEMA(
102-
convPoolShapeInference(ctx, true, false, 0, 1);
103-
}));
104-
105-
-static void convTransposeShapeInference(InferenceContext& ctx) {
106-
+void convTransposeShapeInference(InferenceContext& ctx) {
107-
propagateElemTypeFromInputToOutput(ctx, 0, 0);
108-
109-
// we need at least two inputs to have a shape for this inference.
110-
@@ -1462,7 +1462,7 @@ ONNX_OPERATOR_SET_SCHEMA(
111-
}));
48+
# Hide all symbols we don't need
49+
set_target_properties(onnx_proto PROPERTIES CXX_VISIBILITY_PRESET hidden)
50+
@@ -440,19 +455,6 @@ add_onnx_global_defines(onnx_proto)
51+
target_include_directories(onnx_proto PUBLIC
52+
$<BUILD_INTERFACE:${ONNX_ROOT}>
53+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
54+
-if(MSVC)
55+
- # For disabling Protobuf related warnings
56+
- target_compile_options(onnx_proto PUBLIC
57+
- /wd4146 # unary minus operator applied to unsigned type,
58+
- # result still unsigned
59+
- /wd4244 # 'argument': conversion from 'google::
60+
- # protobuf::uint64' to 'int', possible
61+
- # loss of data
62+
- /wd4267 # Conversion from 'size_t' to 'int',
63+
- # possible loss of data
64+
- /wd4141 # 'inline': used more than once
65+
- )
66+
-endif()
11267

113-
// For GlobalPool operations.
114-
-static void globalPoolTypeShapeInference(InferenceContext& ctx) {
115-
+void globalPoolTypeShapeInference(InferenceContext& ctx) {
116-
propagateElemTypeFromInputToOutput(ctx, 0, 0);
117-
118-
// needs at least one input with shape.
68+
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
69+
# whole-archive linker option not available on AIX.
11970
diff --git a/onnx/defs/nn/old.cc b/onnx/defs/nn/old.cc
120-
index d8ca9a46..1eda4c70 100644
71+
index 40635f97..44770774 100644
12172
--- a/onnx/defs/nn/old.cc
12273
+++ b/onnx/defs/nn/old.cc
123-
@@ -4023,7 +4023,6 @@ ONNX_OPERATOR_SET_SCHEMA(
74+
@@ -4090,7 +4090,6 @@ ONNX_OPERATOR_SET_SCHEMA(
12475
GroupNormalization,
12576
18,
12677
OpSchema()
12778
- .Deprecate()
12879
.SetDoc(GroupNormalization_ver18_doc)
12980
.Attr("epsilon", "The epsilon value to use to avoid division by zero.", AttributeProto::FLOAT, 1e-5f)
13081
.Attr(
131-
diff --git a/onnx/defs/rnn/defs.cc b/onnx/defs/rnn/defs.cc
132-
index c0ed3a39..6c8e2909 100644
133-
--- a/onnx/defs/rnn/defs.cc
134-
+++ b/onnx/defs/rnn/defs.cc
135-
@@ -5,7 +5,7 @@
136-
#include "onnx/defs/schema.h"
137-
138-
namespace ONNX_NAMESPACE {
139-
-static void RNNShapeInference(InferenceContext& ctx) {
140-
+void RNNShapeInference(InferenceContext& ctx) {
141-
TensorShapeProto::Dimension num_directions, seq_length, batch_size, hidden_size;
142-
143-
auto direction = getAttribute(ctx, "direction", "forward");
14482
diff --git a/onnx/defs/schema.h b/onnx/defs/schema.h
145-
index acf3aac7..5bef6e72 100644
83+
index ddd95454..34647987 100644
14684
--- a/onnx/defs/schema.h
14785
+++ b/onnx/defs/schema.h
148-
@@ -980,10 +980,7 @@ class OpSchemaRegistry final : public ISchemaRegistry {
86+
@@ -999,7 +999,7 @@ class OpSchemaRegistry final : public ISchemaRegistry {
14987
class OpSchemaRegisterOnce final {
15088
public:
15189
// Export to cpp custom register macro
15290
- explicit OpSchemaRegisterOnce(
153-
- OpSchema op_schema,
154-
- int opset_version_to_load = 0,
155-
- bool fail_duplicate_schema = true) {
156-
+ OpSchemaRegisterOnce(OpSchema op_schema, int opset_version_to_load = 0, bool fail_duplicate_schema = true) {
157-
OpSchemaRegisterNoExcept(std::move(op_schema), opset_version_to_load, fail_duplicate_schema);
158-
}
159-
static void
91+
+ OpSchemaRegisterOnce(
92+
OpSchema op_schema,
93+
int opset_version_to_load = 0,
94+
bool fail_duplicate_schema = true) {

cmake/vcpkg-ports/onnx/fix-cmakelists.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/CMakeLists.txt b/CMakeLists.txt
2-
index 6fe5c96e..633debb6 100644
2+
index 47995579..70feae97 100644
33
--- a/CMakeLists.txt
44
+++ b/CMakeLists.txt
5-
@@ -70,6 +70,16 @@ endif()
5+
@@ -91,6 +91,16 @@ endif()
66

77
include(GNUInstallDirs)
88

cmake/vcpkg-ports/onnx/fix-dependency-protobuf.patch

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
diff --git a/CMakeLists.txt b/CMakeLists.txt
2-
index 6fe5c96e..ae828752 100644
2+
index 47995579..1542b11f 100644
33
--- a/CMakeLists.txt
44
+++ b/CMakeLists.txt
5-
@@ -141,6 +141,7 @@ if(ONNX_BUILD_TESTS)
6-
set(googletest_STATIC_LIBRARIES GTest::gtest)
5+
@@ -169,6 +169,7 @@ if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
6+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
77
endif()
88

99
+find_package(protobuf CONFIG REQUIRED)
10+
list(APPEND CMAKE_MODULE_PATH ${ONNX_ROOT}/cmake/external)
1011
if(NOT ONNX_BUILD_CUSTOM_PROTOBUF)
11-
if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf))
12-
# Sometimes we need to use protoc compiled for host architecture while linking
12+
if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf))
1313
diff --git a/cmake/ONNXConfig.cmake.in b/cmake/ONNXConfig.cmake.in
14-
index d588f8ae..dbd43986 100644
14+
index a5129bfd..d450b51e 100644
1515
--- a/cmake/ONNXConfig.cmake.in
1616
+++ b/cmake/ONNXConfig.cmake.in
17-
@@ -6,9 +6,8 @@
17+
@@ -4,9 +4,8 @@
1818
# library version information
1919
set(ONNX_VERSION "@ONNX_VERSION@")
2020

21-
-list(APPEND CMAKE_PREFIX_PATH "@PROTOBUF_DIR@")
22-
-set(Protobuf_INCLUDE_DIR "@PROTOBUF_INCLUDE_DIR@")
23-
-find_package(Protobuf REQUIRED)
21+
-if((NOT @@ONNX_USE_PROTOBUF_SHARED_LIBS@@) AND @@Build_Protobuf@@)
22+
- find_package(Protobuf REQUIRED CONFIG)
23+
-endif()
2424
+include(CMakeFindDependencyMacro)
2525
+find_dependency(protobuf CONFIG)
2626

0 commit comments

Comments
 (0)