Repository navigation
feat: Add pkg-config support #1411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ae9f697
feat: Add pkg-config support
nmandelblit df263d9
feat(pkgconfig): Expose the installed binary directory
jpnurmi e652e39
copy what inproc_stress_test does
jpnurmi ce2f0d4
Merge remote-tracking branch 'origin/v1' into add-pc-pkgconfig
jpnurmi 153b17c
Merge branch 'v1' into add-pc-pkgconfig
jpnurmi 758b723
fix(pkgconfig): Install sentry.pc only for shared builds
jpnurmi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| prefix=@PREFIX@ | ||
| exec_prefix=${prefix} | ||
| libdir=@PKGCONFIG_LIBDIR@ | ||
| includedir=@PKGCONFIG_INCLUDEDIR@ | ||
| bindir=@PKGCONFIG_BINDIR@ | ||
|
|
||
| Name: sentry | ||
| Description: Sentry SDK for C, C++ and native applications | ||
| Version: @PKGCONFIG_VERSION@ | ||
| URL: https://sentry.io/ | ||
| Libs: -L${libdir} -lsentry | ||
| Cflags: -I${includedir} | ||
|
cursor[bot] marked this conversation as resolved.
Resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| cmake_minimum_required(VERSION 3.10) | ||
| project(sentry_pkgconfig C) | ||
|
|
||
| # Options that match the main sentry-native build | ||
| option(SENTRY_BUILD_FORCE32 "Force a 32bit compile on a 64bit host" OFF) | ||
| option(WITH_ASAN_OPTION "Build with address sanitizer" OFF) | ||
| option(WITH_TSAN_OPTION "Build with thread sanitizer" OFF) | ||
|
|
||
| find_package(PkgConfig REQUIRED) | ||
| pkg_check_modules(SENTRY REQUIRED IMPORTED_TARGET sentry) | ||
|
|
||
| pkg_get_variable(SENTRY_BINDIR sentry bindir) | ||
| find_program(SENTRY_HANDLER_PATH sentry-crash | ||
| PATHS "${SENTRY_BINDIR}" | ||
| NO_DEFAULT_PATH ONLY_CMAKE_FIND_ROOT_PATH) | ||
|
|
||
| add_executable(sentry_test_pkgconfig main.c) | ||
| target_link_libraries(sentry_test_pkgconfig PRIVATE PkgConfig::SENTRY) | ||
| target_compile_definitions(sentry_test_pkgconfig PRIVATE | ||
| SENTRY_HANDLER_PATH=\"${SENTRY_HANDLER_PATH}\") | ||
|
|
||
| if(NOT MSVC) | ||
| if(SENTRY_BUILD_FORCE32) | ||
| target_compile_options(sentry_test_pkgconfig PRIVATE -m32) | ||
| target_link_libraries(sentry_test_pkgconfig PRIVATE -m32) | ||
| endif() | ||
|
|
||
| if(WITH_ASAN_OPTION) | ||
| target_compile_options(sentry_test_pkgconfig PRIVATE -fsanitize=address) | ||
| target_link_libraries(sentry_test_pkgconfig PRIVATE -fsanitize=address) | ||
| endif() | ||
|
|
||
| if(WITH_TSAN_OPTION) | ||
| target_compile_options(sentry_test_pkgconfig PRIVATE -fsanitize=thread) | ||
| target_link_libraries(sentry_test_pkgconfig PRIVATE -fsanitize=thread) | ||
| endif() | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #include <sentry.h> | ||
| #include <stdlib.h> | ||
|
|
||
| int | ||
| main(void) | ||
| { | ||
| const char *database = getenv("SENTRY_DATABASE_PATH"); | ||
| if (!database) { | ||
| return 1; | ||
| } | ||
|
|
||
| sentry_options_t *options = sentry_options_new(); | ||
| sentry_options_set_handler_path(options, SENTRY_HANDLER_PATH); | ||
| sentry_options_set_database_path(options, database); | ||
| if (sentry_init(options) != 0) { | ||
| return 1; | ||
| } | ||
| sentry_close(); | ||
| return 0; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.