[protobuf] Don't emulate module for find_package(protobuf) (#45959)

This commit is contained in:
Kai Pastor 2025-06-13 18:32:17 +02:00 committed by GitHub
parent 22881dbfab
commit ef7dbf94b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 16 additions and 25 deletions

View File

@ -77,7 +77,7 @@ endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-config.cmake"
"if(protobuf_MODULE_COMPATIBLE)"
"if(1)"
"if(protobuf_MODULE_COMPATIBLE OR CMAKE_FIND_PACKAGE_NAME STREQUAL \"Protobuf\")"
)
if(NOT protobuf_BUILD_LIBPROTOC)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-module.cmake"

View File

@ -1,6 +1,7 @@
{
"name": "protobuf",
"version": "5.29.3",
"port-version": 1,
"description": "Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.",
"homepage": "https://github.com/protocolbuffers/protobuf",
"license": "BSD-3-Clause",

View File

@ -12,7 +12,6 @@ vcpkg_from_github(
abseil.diff
cxxflags.diff
linkage.diff
protobuf.diff
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SPM_ENABLE_SHARED)
@ -24,6 +23,7 @@ vcpkg_cmake_configure(
-DSPM_ENABLE_TCMALLOC=OFF
-DSPM_ABSL_PROVIDER=package
-DSPM_PROTOBUF_PROVIDER=package
-DPROTOBUF_LITE_LIBRARY=protobuf::libprotobuf-lite
)
vcpkg_cmake_install()

View File

@ -1,19 +0,0 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6ef8aa9..d983089 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -70,12 +70,11 @@ if (SPM_PROTOBUF_PROVIDER STREQUAL "internal")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../third_party/protobuf-lite)
include_directories(builtin_pb)
elseif (SPM_PROTOBUF_PROVIDER STREQUAL "package")
- find_package(Protobuf REQUIRED)
- include_directories(${Protobuf_INCLUDE_DIRS})
+ find_package(protobuf CONFIG REQUIRED)
+ set(PROTOBUF_LITE_LIBRARY protobuf::libprotobuf-lite)
protobuf_generate_cpp(SPM_PROTO_SRCS SPM_PROTO_HDRS sentencepiece.proto)
protobuf_generate_cpp(SPM_MODEL_PROTO_SRCS SPM_MODEL_PROTO_HDRS sentencepiece_model.proto)
set(PROTOBUF_LITE_SRCS "")
- include_directories(${PROTOBUF_INCLUDE_DIR})
if (MSVC)
add_definitions("/D_USE_EXTERNAL_PROTOBUF")
else()

View File

@ -1,7 +1,7 @@
{
"name": "sentencepiece",
"version": "0.2.0",
"port-version": 1,
"port-version": 2,
"description": "SentencePiece is an unsupervised text tokenizer and detokenizer mainly for Neural Network-based text generation systems where the vocabulary size is predetermined prior to the neural model training",
"homepage": "https://github.com/google/sentencepiece",
"license": "Apache-2.0",

View File

@ -457,7 +457,6 @@ sdformat9:x64-uwp=fail
sdformat9:x64-windows-static-md=fail
sdl2-mixer:arm-uwp=fail
sdl2-net:arm-uwp=fail
sentencepiece:x64-windows-static-md=fail
septag-sx:arm-uwp=fail
septag-sx:arm64-windows=fail
septag-sx:x64-uwp=fail

View File

@ -7494,7 +7494,7 @@
},
"protobuf": {
"baseline": "5.29.3",
"port-version": 0
"port-version": 1
},
"protobuf-c": {
"baseline": "1.5.2",
@ -8602,7 +8602,7 @@
},
"sentencepiece": {
"baseline": "0.2.0",
"port-version": 1
"port-version": 2
},
"sentry-native": {
"baseline": "0.9.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1020e6e87d6a63311c6ebf7f7ec5124b9bf7be74",
"version": "5.29.3",
"port-version": 1
},
{
"git-tree": "53c97b927087d1919f2a7ef6c34e4caf1a00cdf9",
"version": "5.29.3",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "4c4e0d438d3d86d651ccf3ac963c546dad41a769",
"version": "0.2.0",
"port-version": 2
},
{
"git-tree": "626e5f5d9e302b9095128148ff4ccd046486c13e",
"version": "0.2.0",