Skip to content

Commit

Permalink
[onnx] provide ONNX_USE_PROTOBUF_SHARED_LIBS
Browse files Browse the repository at this point in the history
  • Loading branch information
luncliff committed Nov 25, 2024
1 parent 362bb61 commit 171c310
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ports/onnx/fix-cmake-protobuf.patch
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ index a815ac1..bdc787f 100644
set(PROTOBUF_INCLUDE_DIR "${_PROTOBUF_INSTALL_PREFIX}/include")
set(Build_Protobuf OFF)
- if ("${Protobuf_VERSION}" VERSION_GREATER_EQUAL "4.22.0")
+ if (FALSE)
+ if ("${Protobuf_VERSION}" VERSION_GREATER_EQUAL "4.22.0") # requires linkage
# There are extra dependencies for protobuf.
find_package(absl REQUIRED)
find_package(utf8_range REQUIRED)
12 changes: 12 additions & 0 deletions ports/onnx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ find_program(PROTOC NAMES protoc
)
message(STATUS "Using protoc: ${PROTOC}")

find_file(PROTOBUF_BIN NAMES ${CMAKE_SHARED_LIBRARY_PREFIX}protobuf${CMAKE_SHARED_LIBRARY_SUFFIX} libprotobuf${CMAKE_SHARED_LIBRARY_SUFFIX}
PATHS "${CURRENT_INSTALLED_DIR}/bin" "${CURRENT_INSTALLED_DIR}/lib"
NO_DEFAULT_PATH NO_CMAKE_PATH
)
if(PROTOBUF_BIN)
message(STATUS "Using protobuf(shared): ${PROTOBUF_BIN}")
set(PROTOBUF_SHARED_LIBS ON)
else()
set(PROTOBUF_SHARED_LIBS OFF)
endif()

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
test ONNX_BUILD_TESTS
Expand Down Expand Up @@ -48,6 +59,7 @@ vcpkg_cmake_configure(
"-D_PROTOBUF_INSTALL_PREFIX=${CURRENT_INSTALLED_DIR}"
"-DProtobuf_PROTOC_EXECUTABLE:FILEPATH=${PROTOC}"
"-DONNX_CUSTOM_PROTOC_EXECUTABLE=${PROTOC}"
-DONNX_USE_PROTOBUF_SHARED_LIBS=${PROTOBUF_SHARED_LIBS}
-DONNX_VERIFY_PROTO3=ON # --protoc_path for gen_proto.py
-DONNX_ML=ON
-DONNX_GEN_PB_TYPE_STUBS=ON
Expand Down
2 changes: 1 addition & 1 deletion ports/onnx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "onnx",
"version-semver": "1.16.2",
"port-version": 1,
"port-version": 2,
"description": "Open standard for machine learning interoperability",
"homepage": "https://onnx.ai",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
},
"onnx": {
"baseline": "1.16.2",
"port-version": 1
"port-version": 2
},
"onnx-optimizer": {
"baseline": "0.3.19",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/onnx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "4589c532dcbf9a6aa344e2e0001ff730d7f8ac4f",
"version-semver": "1.16.2",
"port-version": 2
},
{
"git-tree": "801e9d2fecd40f26b85b845c940a342510b83713",
"version-semver": "1.16.2",
Expand Down

0 comments on commit 171c310

Please sign in to comment.