Add sentry-native (#219)

* Add sentry-native

* Fix package url

* Fix sentry-native

* -_-

* I copy-pasted too much code

* Sentry-native: Fix test

* Patch sentry-native for Windows

Why do these libs always have to be patched?
https://github.com/getsentry/sentry-native/issues/415

* Add syslinks for windows linux and android

* Reduce supported platforms list

* Fix typo

* Improve dependencies

* Try to fix compilation for macOS

https://stackoverflow.com/questions/61346222/integrating-crashpad-with-macos-qt-application

* Try to fix windows compilation

* Fix sentry in static mode on Windows

* Fix SENTRY_BUILD_RUNTIMESTATIC

* Try to fix linking on Windows
pull/225/head
Jérôme Leclercq 4 years ago committed by GitHub
parent 893203fdc4
commit fb481440f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      packages/s/sentry-native/patches/0.4.4/zlib_fix.patch
  2. 62
      packages/s/sentry-native/xmake.lua

@ -0,0 +1,12 @@
diff --git a/external/crashpad/third_party/zlib/CMakeLists.txt b/external/crashpad/third_party/zlib/CMakeLists.txt
index 7ed2f58..4514331 100644
--- a/external/crashpad/third_party/zlib/CMakeLists.txt
+++ b/external/crashpad/third_party/zlib/CMakeLists.txt
@@ -73,6 +73,7 @@ else()
"/wd4267" # conversion from 'size_t' to 't', possible loss of data
"/wd4324" # structure was padded due to alignment specifier
"/wd4702" # unreachable code
+ "/wd5105" # see https://github.com/getsentry/sentry-native/issues/415
)
endif()
endif()

@ -0,0 +1,62 @@
package("sentry-native")
set_homepage("https://sentry.io")
set_description("Sentry SDK for C, C++ and native applications.")
set_urls("https://github.com/getsentry/sentry-native/releases/download/$(version)/sentry-native.zip",
"https://github.com/getsentry/sentry-native.git")
add_versions("0.4.4", "fe6c711d42861e66e53bfd7ee0b2b226027c64446857f0d1bbb239ca824a3d8d")
add_patches("0.4.4", path.join(os.scriptdir(), "patches", "0.4.4", "zlib_fix.patch"), "1a6ac711b7824112a9062ec1716a316facce5055498d1f87090d2cad031b865b")
add_deps("cmake")
if is_plat("windows") then
add_syslinks("dbghelp", "winhttp", "shlwapi", "advapi32")
elseif is_plat("linux") then
add_deps("libcurl")
add_syslinks("dl", "pthread", "rt")
elseif is_plat("android") then
add_syslinks("dl", "log")
elseif is_plat("macosx") then
add_deps("libcurl")
add_frameworks("CoreText", "CoreGraphics", "CoreFoundation", "Foundation")
add_syslinks("bsm")
end
on_load("windows", function (package)
if not package:config("shared") then
package:add("defines", "SENTRY_BUILD_STATIC")
end
end)
on_install("windows", "linux", "macosx", "android", function (package)
local opt = {}
local configs = {}
table.insert(configs, "-DSENTRY_BUILD_EXAMPLES=OFF")
table.insert(configs, "-DSENTRY_BUILD_TESTS=OFF")
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
if package:config("shared") then
table.insert(configs, "-DBUILD_SHARED_LIBS=ON")
table.insert(configs, "-DSENTRY_BUILD_SHARED_LIBS=ON")
else
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
table.insert(configs, "-DSENTRY_BUILD_SHARED_LIBS=OFF")
end
if package:is_plat("windows") then
opt.cxflags = { "/experimental:preprocessor-" } -- fixes <Windows SDK>\um\oaidl.h(487): error C2059: syntax error: '/'
local vs_runtime = package:config("vs_runtime")
table.insert(configs, "-DSENTRY_BUILD_RUNTIMESTATIC=" .. ((vs_runtime == "MT" or vs_runtime == "MTd") and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs, opt)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test(int args, char** argv) {
sentry_options_t* options = sentry_options_new();
sentry_init(options);
sentry_shutdown();
}
]]}, {includes = {"sentry.h"}}))
end)
Loading…
Cancel
Save