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

Build sentry-native with CXX 14 #6294

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion recipes/sentry-native/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,25 @@ patches:
"0.4.10":
- patch_file: "patches/0.4.10-0001-find-conan-qt.patch"
base_path: "source_subfolder"
- patch_file: "patches/0.4.10-0002-CXX-14.patch"
ericriff marked this conversation as resolved.
Show resolved Hide resolved
base_path: "source_subfolder"
"0.4.9":
- patch_file: "patches/0.4.9-0001-find-conan-qt.patch"
base_path: "source_subfolder"
- patch_file: "patches/0.4.9-0002-CXX-14.patch"
base_path: "source_subfolder"
"0.4.8":
- patch_file: "patches/0.4.8-0001-find-conan-qt.patch"
base_path: "source_subfolder"
- patch_file: "patches/0.4.8-0002-CXX-14.patch"
base_path: "source_subfolder"
"0.4.7":
- patch_file: "patches/0.4.7-0001-find-conan-qt.patch"
base_path: "source_subfolder"
- patch_file: "patches/0.4.7-0002-CXX-14.patch"
base_path: "source_subfolder"
"0.2.6":
- patch_file: "patches/0.2.6-0001-remove-sentry-handler-dependency.patch"
base_path: "source_subfolder"
- patch_file: "patches/0.2.6-0002-set-cmake-cxx-standard-11.patch"
- patch_file: "patches/0.2.6-0002-set-cmake-cxx-standard-14.patch"
base_path: "source_subfolder"
41 changes: 36 additions & 5 deletions recipes/sentry-native/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SentryNativeConan(ConanFile):
topics = ("conan", "breakpad", "crashpad",
"error-reporting", "crash-reporting")
exports_sources = ["CMakeLists.txt", "patches/*"]
generators = "cmake", "cmake_find_package"
generators = "cmake", "cmake_find_package", "pkg_config"
settings = "os", "arch", "compiler", "build_type"
ericriff marked this conversation as resolved.
Show resolved Hide resolved
options = {
"shared": [True, False],
Expand All @@ -25,6 +25,7 @@ class SentryNativeConan(ConanFile):
"transport": ["none", "curl", "winhttp"],
"qt": [True, False],
"with_crashpad": ["google", "sentry"],
"with_breakpad": ["google", "sentry"],
}
default_options = {
"shared": False,
Expand All @@ -33,6 +34,8 @@ class SentryNativeConan(ConanFile):
"transport": "curl", # overwritten in config_options
"qt": False,
"with_crashpad": "sentry",
"with_breakpad": "sentry",

}

_cmake = None
Expand All @@ -41,6 +44,15 @@ class SentryNativeConan(ConanFile):
def _source_subfolder(self):
return "source_subfolder"

@property
def _minimum_compilers_version(self):
return {
"Visual Studio": "15",
"gcc": "5",
"clang": "3.4",
"apple-clang": "5.1",
}

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
Expand All @@ -58,25 +70,40 @@ def config_options(self):
# FIXME: for self.version < 0.4: default backend is "breakpad" when building with MSVC for Windows xp; else: backend=none
self.options.backend = "crashpad"
elif self.settings.os in ("FreeBSD", "Linux"):
# FIXME: default backend on Linux is "breakpad"
self.options.backend = "inproc" # Should be "breakpad"
self.options.backend = "breakpad"
elif self.settings.os == "Android":
self.options.backend = "inproc"
else:
self.options.backend = "inproc"

def configure(self):
if self.options.shared:
del self.options.fPIC
if self.settings.compiler.cppstd:
tools.check_min_cppstd(self, 11)
tools.check_min_cppstd(self, 14)

minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False)
if not minimum_version:
self.output.warn("Compiler is unknown. Assuming it supports C++14.")
elif tools.Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration("Build requires support for C++14. Minimum version for {} is {}"
.format(str(self.settings.compiler), minimum_version))

if self.options.backend == "inproc" and self.settings.os == "Windows" and tools.Version(self.version) < "0.4":
raise ConanInvalidConfiguration("The in-process backend is not supported on Windows")
if self.options.backend != "crashpad":
del self.options.with_crashpad
if self.options.backend != "breakpad":
del self.options.with_breakpad
if self.options.transport == "winhttp" and self.settings.os != "Windows":
raise ConanInvalidConfiguration("The winhttp transport is only supported on Windows")
if tools.Version(self.version) >= "0.4.7" and self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) < "10.0":
raise ConanInvalidConfiguration("apple-clang < 10.0 not supported")

def build_requirements(self):
if self.options.backend == "breakpad":
self.build_requires("pkgconf/1.7.4")

def requirements(self):
if self.options.transport == "curl":
self.requires("libcurl/7.75.0")
Expand All @@ -86,7 +113,10 @@ def requirements(self):
if self.options.with_crashpad == "google":
self.requires("crashpad/cci.20210507")
elif self.options.backend == "breakpad":
raise ConanInvalidConfiguration("breakpad not available yet in CCI")
if self.options.with_breakpad == "sentry":
self.requires("sentry-breakpad/{}".format(self.version))
if self.options.with_breakpad == "google":
self.requires("breakpad/cci.20210521")
if self.options.qt:
self.requires("qt/5.15.2")
self.requires("openssl/1.1.1k")
Expand All @@ -102,6 +132,7 @@ def _configure_cmake(self):
self._cmake = CMake(self)
self._cmake.definitions["SENTRY_BACKEND"] = self.options.backend
self._cmake.definitions["SENTRY_CRASHPAD_SYSTEM"] = True
self._cmake.definitions["SENTRY_BREAKPAD_SYSTEM"] = True
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index c41d902..4793e9b 100644
endif()

+if(NOT CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD 14)
+endif()
+
include(GNUInstallDirs)
Expand Down
14 changes: 14 additions & 0 deletions recipes/sentry-native/all/patches/0.4.10-0002-CXX-14.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 696d270..006bf68 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,7 +30,7 @@
endif()

if(NOT CMAKE_CXX_STANDARD)
- set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD 14)
endif()

include(GNUInstallDirs)

14 changes: 14 additions & 0 deletions recipes/sentry-native/all/patches/0.4.7-0002-CXX-14.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 696d270..006bf68 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,7 +30,7 @@
endif()

if(NOT CMAKE_CXX_STANDARD)
- set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD 14)
endif()

include(GNUInstallDirs)

14 changes: 14 additions & 0 deletions recipes/sentry-native/all/patches/0.4.8-0002-CXX-14.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 696d270..006bf68 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,7 +30,7 @@
endif()

if(NOT CMAKE_CXX_STANDARD)
- set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD 14)
endif()

include(GNUInstallDirs)

14 changes: 14 additions & 0 deletions recipes/sentry-native/all/patches/0.4.9-0002-CXX-14.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 696d270..006bf68 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,7 +30,7 @@
endif()

if(NOT CMAKE_CXX_STANDARD)
- set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD 14)
endif()

include(GNUInstallDirs)

2 changes: 1 addition & 1 deletion recipes/sentry-native/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ find_package(sentry REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} sentry::sentry)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)