Skip to content

Commit cb15ed5

Browse files
ffacsdongjoon-hyun
authored andcommitted
ORC-1662: [C++] Upgrade protobuf to 3.21.12
### What changes were proposed in this pull request? Upgrade protobuf to 3.21.12 ### Why are the changes needed? To fix compilation failure on vs2022 ### How was this patch tested? UT passed ### Was this patch authored or co-authored using generative AI tooling? NO Closes #1857 from ffacs/bump_protobuf_version. Authored-by: ffacs <ffacs520@gmail.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
1 parent 3a8d8fb commit cb15ed5

2 files changed

Lines changed: 34 additions & 10 deletions

File tree

cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ set(LZ4_VERSION "1.10.0")
2626
set(SNAPPY_VERSION "1.2.2")
2727
set(ZLIB_VERSION "1.3.1")
2828
set(GTEST_VERSION "1.17.0")
29-
set(PROTOBUF_VERSION "3.5.1")
29+
set(PROTOBUF_VERSION "3.21.12")
3030
set(ZSTD_VERSION "1.5.7")
3131
set(SPARSEHASH_VERSION "2.11.1")
3232

@@ -219,8 +219,24 @@ else ()
219219
if(protobuf_SOURCE_DIR)
220220
message(STATUS "Using vendored Protobuf")
221221

222-
add_library(protobuf::libprotobuf ALIAS libprotobuf)
223-
add_executable(protobuf::protoc ALIAS protoc)
222+
# Protobuf >= 3.21 exports protobuf::libprotobuf/protobuf::protoc itself.
223+
# Guard alias creation to avoid duplicate target errors.
224+
if(TARGET libprotobuf AND NOT TARGET protobuf::libprotobuf)
225+
add_library(protobuf::libprotobuf ALIAS libprotobuf)
226+
endif()
227+
if(TARGET protoc AND NOT TARGET protobuf::protoc)
228+
add_executable(protobuf::protoc ALIAS protoc)
229+
endif()
230+
231+
# Avoid exporting build/source paths in install interface.
232+
# Mark as SYSTEM so compiler suppresses warnings from protobuf headers
233+
# (e.g. -Wunused-parameter) without affecting ORC's own code.
234+
if(TARGET libprotobuf)
235+
set_property(TARGET libprotobuf PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
236+
target_include_directories(libprotobuf SYSTEM INTERFACE
237+
"$<BUILD_INTERFACE:${protobuf_SOURCE_DIR}/src>"
238+
"$<BUILD_INTERFACE:${protobuf_BINARY_DIR}>")
239+
endif()
224240

225241
if(BUILD_POSITION_INDEPENDENT_LIB)
226242
set_target_properties(libprotobuf PROPERTIES POSITION_INDEPENDENT_CODE ON)

subprojects/protobuf.wrap

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@
1616
# under the License.
1717

1818
[wrap-file]
19-
directory = protobuf-3.5.1
20-
source_url = https://github.com/google/protobuf/releases/download/v3.5.1/protobuf-all-3.5.1.tar.gz
21-
source_filename = protobuf-all-3.5.1.tar.gz
22-
source_hash = 72d43863f58567a9ea2054671fdb667867f9cf7865df623c7be630978ff97dff
23-
patch_url = https://wrapdb.mesonbuild.com/v2/protobuf_3.5.1-3/get_patch
24-
patch_filename = protobuf-3.5.1-3-wrap.zip
25-
patch_hash = 9316ee29244a590545d8175136fd916149ca81e3f33f20d3cffc5bd3e6812e67
19+
directory = protobuf-3.21.12
20+
source_url = https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.21.12.tar.gz
21+
source_filename = protobuf-3.21.12.tar.gz
22+
source_hash = 930c2c3b5ecc6c9c12615cf5ad93f1cd6e12d0aba862b572e076259970ac3a53
23+
patch_filename = protobuf_3.21.12-5_patch.zip
24+
patch_url = https://wrapdb.mesonbuild.com/v2/protobuf_3.21.12-5/get_patch
25+
patch_hash = 8ae4d39ca9748a6edf7e028e15f5c7499b1c6ce687454a5709711d47cfd4e293
26+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/protobuf_3.21.12-5/protobuf-3.21.12.tar.gz
27+
wrapdb_version = 3.21.12-5
28+
29+
[provide]
30+
protobuf = protobuf_dep
31+
protobuf-lite = protobuf_lite_dep
32+
protoc = protoc_dep
33+
program_names = protoc

0 commit comments

Comments
 (0)