Skip to content

Commit ecf7f2e

Browse files
sanqideshiSanQiwaruqistar-hengxing
authored
Add Linux support to Crashpad. (#4157)
* 1. Compile binary files. 2. Modify crashpad/xmake.lua. 3. Add Linux support. * format crashpad xmake.lua * 1. add on_test check function 2. modify link sort 3. move add_includedirs position when platform is windows * - add crashpad's license(Apache-2.0) * Update xmake.lua * Update xmake.lua * - modify build type,now build from source - windows is testing * - passed build in linux * - scope include and libs for linux * - moidfy /include to include * - add libcurl depedency * - scope linux deps * Update xmake.lua delete libcurl * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua - add cmake options - change verify platforms bin * Update xmake.lua --------- Co-authored-by: SanQi <[email protected]> Co-authored-by: ruki <[email protected]> Co-authored-by: star9029 <[email protected]>
1 parent d6ed3d0 commit ecf7f2e

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

packages/c/crashpad/xmake.lua

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
package("crashpad")
22
set_homepage("https://chromium.googlesource.com/crashpad/crashpad/+/refs/heads/main/README.md")
33
set_description("Crashpad is a crash-reporting system.")
4+
set_license("Apache-2.0")
45

5-
if is_host("windows") then
6-
7-
local map = {
8-
["2021.8.1"] = "stable",
9-
["2022.4.16"] = "latest"
10-
}
11-
12-
function map_version(version)
13-
return map[tostring(version)]
14-
end
15-
16-
if is_arch("x64", "x86_64") then
17-
set_urls("http://get.backtrace.io/crashpad/builds/crashpad-release-x86-64-$(version).zip", {version = map_version})
18-
add_versions("2021.8.1", "b3facf8a802dfd12daf4d9fba416f4d4b5df0ae544afa14080662fa978aa18cb")
19-
add_versions("2022.4.16", "7705073dfff89c376303cacea3a6f8c63322f77566ad5cdbe37060cf3cef9f8b")
20-
else
21-
set_urls("http://get.backtrace.io/crashpad/builds/crashpad-release-x86-$(version).zip", {version = map_version})
22-
add_versions("2021.8.1", "699fdf741f39da1c68069820ce891b6eb8b48ef29ab399fc1bcf210b67ff8547")
23-
add_versions("2022.4.16", "c3bffb64d1087198946739dfb30d24b2355e49ddfe90d8e2a75ed373ed6e3377")
24-
end
25-
end
6+
add_urls("https://github.com/getsentry/crashpad.git")
7+
add_versions("2024.04.15", "96e301b7d6b81990a244d7de41a0d36eeb60899e")
8+
9+
add_includedirs("include/crashpad", "include/crashpad/mini_chromium")
10+
add_links("crashpad_client", "crashpad_util", "mini_chromium")
2611

27-
add_includedirs("include", "include/mini_chromium")
12+
add_deps("cmake")
13+
add_deps("libcurl")
2814

29-
on_install("windows", function (package)
30-
os.cp("include/*", package:installdir("include"))
31-
os.cp("bin/crashpad_handler.exe", package:installdir("bin"))
32-
if package:config("shared") then
33-
os.cp("lib_md/*", package:installdir("lib"))
34-
else
35-
os.cp("lib_mt/*", package:installdir("lib"))
15+
on_install("linux", "windows|x64", "windows|x86", function(package)
16+
local configs = {}
17+
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
18+
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
19+
import("package.tools.cmake").install(package, configs, {packagedeps = "libcurl"})
20+
package:addenv("PATH", "bin")
21+
end)
22+
23+
on_test(function(package)
24+
if not package:is_cross() then
25+
os.vrun("crashpad_handler --help")
3626
end
37-
end)
27+
28+
assert(package:check_cxxsnippets({test = [[
29+
#include "client/crashpad_client.h"
30+
using namespace crashpad;
31+
void test() {
32+
CrashpadClient *client = new CrashpadClient();
33+
}
34+
]]}, {configs = {languages = "cxx17"}}))
35+
end)

0 commit comments

Comments
 (0)