Skip to content

Commit e719687

Browse files
authored
[build] set ONNX_USE_LITE_PROTO=ON only for wasm when using vcpkg (#26485)
### Description Before this change, ONNX_USE_LITE_PROTO is always set to OFF for all vcpkg builds, including web assembly build. This PR modifies the behavior to use lite proto when building targetting wasm. No change to non-vcpkg build.
1 parent 75d3547 commit e719687

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

cmake/vcpkg-ports/onnx/portfile.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ vcpkg_cmake_configure(
3636
"-DProtobuf_PROTOC_EXECUTABLE:FILEPATH=${PROTOC}"
3737
-DONNX_ML=ON
3838
-DONNX_USE_PROTOBUF_SHARED_LIBS=${USE_PROTOBUF_SHARED}
39-
-DONNX_USE_LITE_PROTO=OFF
4039
-DONNX_USE_MSVC_STATIC_RUNTIME=${USE_STATIC_RUNTIME}
4140
-DONNX_BUILD_TESTS=OFF
4241
-DONNX_BUILD_BENCHMARKS=OFF

tools/python/util/vcpkg_helpers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ def add_port_configs(f, has_exception: bool, is_emscripten: bool, enable_minimal
7474
)"""
7575
)
7676

77+
if is_emscripten:
78+
# Uses ONNX_USE_LITE_PROTO=ON for WebAssembly build.
79+
f.write(
80+
r"""
81+
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS
82+
"-DONNX_USE_LITE_PROTO=ON"
83+
)"""
84+
)
85+
7786
f.write(r"""
7887
endif() # End ONNX-specific block
7988
""")

0 commit comments

Comments
 (0)