Skip to content

[feature] Add option to consume unvendored libunwind #1714

@uilianries

Description

@uilianries

Greetings!

As the project Sentry native is packaged in Conan Center already, and during our last review conan-io/conan-center-index#29690 was spotted a room for improvement, I'm sending this feature request / suggestion.

As Conan and other package managers can provide not only Sentry native, but also other dependencies, it would be great if we could manage libunwind as well, so consumers would not need to build that dependency from source too, when needed to use Sentry native.

As a suggestion, you could add a CMake option like WITH_EXTERNAL_LIBUNWIND, then use a logic like:

https://github.com/getsentry/sentry-native/blob/master/CMakeLists.txt#L648

if(SENTRY_WITH_LIBUNWIND AND LINUX)
	if(WITH_EXTERNAL_LIBUNWIND)
        find_package(libunwind REQUIRED)
        target_link_libraries(sentry PRIVATE libunwind::libunwind)
    else()
		# Use vendored libunwind
		add_subdirectory(vendor/libunwind)
		target_link_libraries(sentry PRIVATE unwind)
		if(NOT SENTRY_BUILD_SHARED_LIBS)
			sentry_install(TARGETS unwind EXPORT sentry
				LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
				ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
			)
		endif()
	endif()
endif()

As a result, it would be possible to combine libunwind from the system, or the package manager. It's true libunwind does not provide an official CMake config file, but it could be easily wrapped by the consumer or the package manager (Conan provides one automatically).

Regards!

Metadata

Metadata

Assignees

Labels

No fields configured for issues without a type.

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions