Skip to content
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

Add Qt integration to sentry #5440

Merged
merged 15 commits into from
May 25, 2021
10 changes: 10 additions & 0 deletions recipes/sentry-native/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ sources:
"0.2.6":
url: "https://github.com/getsentry/sentry-native/releases/download/0.2.6/sentry-native-0.2.6.zip"
sha256: "0d93bd77f70a64f3681d4928dfca6b327374218a84d33ee31489114d8e4716c0"
patches:
"0.4.9":
- patch_file: "patches/find-conan-qt-0.4.9.patch"
base_path: "source_subfolder"
"0.4.8":
- patch_file: "patches/find-conan-qt-0.4.8.patch"
base_path: "source_subfolder"
"0.4.7":
- patch_file: "patches/find-conan-qt-0.4.7.patch"
base_path: "source_subfolder"
14 changes: 12 additions & 2 deletions recipes/sentry-native/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@ class SentryNativeConan(ConanFile):
license = "MIT"
topics = ("conan", "breakpad", "crashpad",
"error-reporting", "crash-reporting")
exports_sources = ["CMakeLists.txt"]
exports_sources = ["CMakeLists.txt", "patches/*"]
generators = "cmake", "cmake_find_package"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"backend": ["none", "inproc", "crashpad", "breakpad"],
"transport": ["none", "curl", "winhttp"],
"qt": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"backend": "inproc",
"transport": "curl"
"transport": "curl",
"qt": False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is qt integration by default useful?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but at the expense of current users who do no require it

https://docs.sentry.io/platforms/native/guides/qt/#install

Looks off by default from upstream

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildroot has some kind of ci system where it builds random combinations to find regressions.
Something similar where non-default option combinations are built would be useful.

}

_cmake = None
Expand Down Expand Up @@ -62,6 +64,11 @@ def requirements(self):
self.requires("crashpad/cci.20210507")
elif self.options.backend == "breakpad":
raise ConanInvalidConfiguration("breakpad not available yet in CCI")
if self.options.qt:
self.requires("qt/5.15.2")
self.requires("openssl/1.1.1k")
if tools.Version(self.version) < "0.4.5":
raise ConanInvalidConfiguration("Qt integration available from version 0.4.5")

def source(self):
tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder)
Expand All @@ -75,10 +82,13 @@ def _configure_cmake(self):
self._cmake.definitions["SENTRY_ENABLE_INSTALL"] = True
self._cmake.definitions["SENTRY_TRANSPORT"] = self.options.transport
self._cmake.definitions["SENTRY_PIC"] = self.options.get_safe("fPIC", True)
self._cmake.definitions["SENTRY_INTEGRATION_QT"] = self.options.qt
self._cmake.configure()
return self._cmake

def build(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
cmake = self._configure_cmake()
cmake.build()

Expand Down
15 changes: 15 additions & 0 deletions recipes/sentry-native/all/patches/find-conan-qt-0.4.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e7d0f33..3fd4323 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -447,8 +447,8 @@ endif()

option(SENTRY_INTEGRATION_QT "Build Qt integration")
if(SENTRY_INTEGRATION_QT)
- find_package(Qt5 COMPONENTS Core REQUIRED)
- target_link_libraries(sentry PRIVATE Qt5::Core)
+ find_package(qt REQUIRED)
+ target_link_libraries(sentry PRIVATE qt::qt)
endif()

include(CMakePackageConfigHelpers)
15 changes: 15 additions & 0 deletions recipes/sentry-native/all/patches/find-conan-qt-0.4.8.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2407fca..89416c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -460,8 +460,8 @@ endif()

option(SENTRY_INTEGRATION_QT "Build Qt integration")
if(SENTRY_INTEGRATION_QT)
- find_package(Qt5 COMPONENTS Core REQUIRED)
- target_link_libraries(sentry PRIVATE Qt5::Core)
+ find_package(qt REQUIRED)
+ target_link_libraries(sentry PRIVATE qt::qt)
endif()

include(CMakePackageConfigHelpers)
24 changes: 24 additions & 0 deletions recipes/sentry-native/all/patches/find-conan-qt-0.4.9.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a74a93..1782a69 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -461,17 +461,8 @@ endif()

option(SENTRY_INTEGRATION_QT "Build Qt integration")
if(SENTRY_INTEGRATION_QT)
- if(QT_DEFAULT_MAJOR_VERSION)
- # Let user choose major version
- set(Qt_VERSION_MAJOR ${QT_DEFAULT_MAJOR_VERSION})
- else()
- # Find best match, prioritizing Qt 6 if available
- find_package(Qt NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
- endif()
- find_package(Qt${Qt_VERSION_MAJOR} COMPONENTS Core REQUIRED)
- message(STATUS "Found Qt: ${Qt${Qt_VERSION_MAJOR}_DIR} "
- "(found version \"${Qt${Qt_VERSION_MAJOR}_VERSION}\")")
- target_link_libraries(sentry PRIVATE Qt${Qt_VERSION_MAJOR}::Core)
+ find_package(qt REQUIRED)
+ target_link_libraries(sentry PRIVATE qt::qt)
endif()

include(CMakePackageConfigHelpers)