Skip to content

feat: Add pkg-config support - #1411

Open
nmandelblit wants to merge 4 commits into
getsentry:v1from
nmandelblit:add-pc-pkgconfig
Open

nmandelblit wants to merge 4 commits into
getsentry:v1from
nmandelblit:add-pc-pkgconfig

Conversation

@nmandelblit

@nmandelblit nmandelblit commented Oct 10, 2025 •

Copy link
Copy Markdown

Summary

  • Added support for generating and installing a .pc file for pkg-config
  • Controlled by the SENTRY_INSTALL_PKGCONFIG CMake option
  • Honors CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_INCLUDEDIR, and CMAKE_INSTALL_BINDIR in the generated metadata
  • Exposes bindir so consumers can locate the installed crash handler; the native handler installation also honors CMAKE_INSTALL_BINDIR
  • Installs the generated file to the standard pkg-config directory (${CMAKE_INSTALL_LIBDIR}/pkgconfig)

Benefits

This allows downstream projects to easily discover and link against sentry-native using pkg-config:

pkg-config --cflags --libs sentry

And for backends with out-of-process handlers, the path for sentry_options_set_handler_path() can be resolved by querying bindir:

pkg-config --variable=bindir sentry

Test plan

  • Build with SENTRY_INSTALL_PKGCONFIG enabled
  • Verify sentry.pc file is generated in build directory
  • Verify sentry.pc file is installed to correct location
  • Verify the installed version and library path
  • Build and run a standalone pkg-config consumer that initializes the default backend using the installed crash handler

cursor[bot]

This comment was marked as outdated.

Comment thread sentry.pc.in Outdated
cursor[bot]

This comment was marked as outdated.

@nmandelblit
nmandelblit force-pushed the add-pc-pkgconfig branch 3 times, most recently from c4b2054 to 7582025 Compare October 10, 2025 13:44
- Added support for generating and installing a .pc file for pkg-config
- Controlled by the SENTRY_INSTALL_PKGCONFIG CMake option
- Uses CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR to support non-standard layouts (e.g., lib64)
- Installs the generated file to the standard pkg-config directory
@jpnurmi
jpnurmi changed the base branch from master to v1 October 16, 2026 07:30
@jpnurmi jpnurmi added the v1 Targets 1.0 (v1 branch) label Oct 16, 2026
@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.49%. Comparing base (4cef180) to head (ce2f0d4).

Additional details and impacted files
@@            Coverage Diff             @@
##               v1    #1411      +/-   ##
==========================================
+ Coverage   75.47%   75.49%   +0.01%     
==========================================
  Files         104      104              
  Lines       29637    29637              
  Branches     5481     5481              
==========================================
+ Hits        22369    22374       +5     
+ Misses       5844     5838       -6     
- Partials     1424     1425       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Export `bindir` in `sentry.pc` so consumers can locate the installed
crash handler. Honor `CMAKE_INSTALL_BINDIR` when installing the native
handler and its Windows companion so the metadata matches the layout.

Add a standalone consumer that links through pkg-config and initializes
the default backend using the installed handler and a writable database
directory.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 Targets 1.0 (v1 branch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants