Skip to content

Commit

Permalink
Fix declared dependencies for pkg-config (#12518)
Browse files Browse the repository at this point in the history
Closes #12439

Closes #12518

PiperOrigin-RevId: 526689125
  • Loading branch information
mkruskal-google authored and copybara-github committed Apr 24, 2023
1 parent 0ecb729 commit f79e35c
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 2 deletions.
9 changes: 9 additions & 0 deletions cmake/install.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
include(GNUInstallDirs)

foreach(_target IN LISTS protobuf_ABSL_USED_TARGETS)
string(REPLACE :: _ _modified_target ${_target})
list(APPEND _pc_targets ${_modified_target})
endforeach()
list(APPEND _pc_targets "utf8_range")

string(JOIN " " _pc_target_list ${_pc_targets})
set(_protobuf_PC_REQUIRES ${_pc_target_list})

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf-lite.pc.cmake
Expand Down
1 change: 1 addition & 0 deletions cmake/protobuf-lite.pc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: Protocol Buffers
Description: Google's Data Interchange Format
Version: @protobuf_VERSION@
Requires: @_protobuf_PC_REQUIRES@
Libs: -L${libdir} -lprotobuf-lite @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir}
Conflicts: protobuf
1 change: 1 addition & 0 deletions cmake/protobuf.pc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: Protocol Buffers
Description: Google's Data Interchange Format
Version: @protobuf_VERSION@
Requires: @_protobuf_PC_REQUIRES@
Libs: -L${libdir} -lprotobuf @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir}
Conflicts: protobuf-lite
9 changes: 8 additions & 1 deletion third_party/utf8_range/.github/workflows/bazel_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Setup Bazel
run: |
echo "BAZEL=bazel" >> $GITHUB_ENV
echo "USE_BAZEL_VERSION=5.1.1" >> $GITHUB_ENV
- name: Setup Bazel (macOS)
if: runner.os == 'macOS'
run: echo "BAZEL=bazelisk" >> $GITHUB_ENV
- name: Install dependencies
run: sudo apt update && sudo apt install -y ${{ matrix.install }}
if: matrix.install != ''
- name: Run tests
run: cd ${{ github.workspace }} && CC=${{ matrix.CC }} bazel test --test_output=errors ... ${{ matrix.flags }}
run: cd ${{ github.workspace }} && CC=${{ matrix.CC }} ${{ env.BAZEL }} test --test_output=errors ... ${{ matrix.flags }}
5 changes: 5 additions & 0 deletions third_party/utf8_range/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ if (utf8_range_ENABLE_INSTALL)
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/utf8_range.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/utf8_range.pc @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/utf8_range.pc
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

# Install public headers explicitly.
install(FILES utf8_range.h utf8_validity.h
Expand Down
12 changes: 12 additions & 0 deletions third_party/utf8_range/cmake/utf8_range.pc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@

Name: UTF8 Range
Description: Google's UTF8 Library
Version: 1.0
Requires: absl_strings
Libs: -L${libdir} -lprotobuf-lite @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir}
Conflicts: protobuf
2 changes: 1 addition & 1 deletion update_subtrees.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash -eux
#!/bin/bash -eux

set -eux

Expand Down

0 comments on commit f79e35c

Please sign in to comment.