Skip to content

Commit

Permalink
(#5440) Add Qt integration to sentry
Browse files Browse the repository at this point in the history
* Add Qt integration to sentry

* Update recipes/sentry-native/all/conanfile.py

Co-authored-by: ericLemanissier <ericLemanissier@users.noreply.github.com>

* Add qt requirement

* Set temporary qt to True

* Add openssl/1.1.1j requirement

* Find conan qt patch

* Remove qt requirement

* Restore qt requirement and simpler patch

* Handle older version

* Specific patch for 0.4.7

* Add missing patch

* Move patch to build()

* Bump openssl version to 1.1.1k

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* touch

Co-authored-by: ericLemanissier <ericLemanissier@users.noreply.github.com>
Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
  • Loading branch information
3 people committed May 25, 2021
1 parent 5788f3d commit 3768c7f
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 2 deletions.
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,
}

_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)

0 comments on commit 3768c7f

Please sign in to comment.