Skip to content

Commit

Permalink
[protobuf] fix pc library reference (#38822)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankXie05 authored May 25, 2024
1 parent 05dd7eb commit 248380e
Showing 4 changed files with 30 additions and 7 deletions.
28 changes: 23 additions & 5 deletions ports/protobuf/portfile.cmake
Original file line number Diff line number Diff line change
@@ -121,14 +121,32 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
endif()

vcpkg_copy_pdbs()
set(packages protobuf protobuf-lite)
foreach(_package IN LISTS packages)
set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${_package}.pc")
if(EXISTS "${_file}")
vcpkg_replace_string(${_file} "-l${_package}" "-l${_package}d")

function(replace_package_string package)
set(debug_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${package}.pc")
set(release_file "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${package}.pc")

if(EXISTS "${release_file}")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_replace_string(${release_file} "-l${package}" "-llib${package}")
endif()
endif()

if(EXISTS "${debug_file}")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_replace_string(${debug_file} "-l${package}" "-llib${package}d")
else()
vcpkg_replace_string(${debug_file} "-l${package}" "-l${package}d")
endif()
endif()
endfunction()

set(packages protobuf protobuf-lite)
foreach(package IN LISTS packages)
replace_package_string(${package})
endforeach()


vcpkg_fixup_pkgconfig()

if(NOT protobuf_BUILD_PROTOC_BINARIES)
2 changes: 1 addition & 1 deletion ports/protobuf/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "protobuf",
"version": "3.21.12",
"port-version": 2,
"port-version": 3,
"description": "Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.",
"homepage": "https://github.com/protocolbuffers/protobuf",
"license": "BSD-3-Clause",
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
@@ -6994,7 +6994,7 @@
},
"protobuf": {
"baseline": "3.21.12",
"port-version": 2
"port-version": 3
},
"protobuf-c": {
"baseline": "1.4.1",
5 changes: 5 additions & 0 deletions versions/p-/protobuf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "528c56d9b29635d840b284f3e2109a370556bd89",
"version": "3.21.12",
"port-version": 3
},
{
"git-tree": "e189106689c1983cd5e19363fa48f35d3d3f419b",
"version": "3.21.12",

0 comments on commit 248380e

Please sign in to comment.