Skip to content

Commit d8deb18

Browse files
authored
Add libunwind support to cpptrace (#8341)
1 parent 2cf8ba5 commit d8deb18

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/c/cpptrace/xmake.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ package("cpptrace")
3131

3232
add_patches("0.5.2", "https://github.com/jeremy-rifkin/cpptrace/commit/599d6abd6cc74e80e8429fc309247be5f7edd5d7.patch", "977e6c17400ff2f85362ca1d6959038fdb5d9e5b402cfdd705b422c566e8e87a")
3333

34+
add_configs("libunwind", {description = "Enable libunwind for stack unwinding", default = false, type = "boolean"})
35+
3436
if is_plat("windows", "mingw") then
3537
add_syslinks("dbghelp")
3638
elseif is_plat("linux", "cross") then
@@ -42,6 +44,12 @@ package("cpptrace")
4244
add_deps("libdwarf")
4345
end
4446

47+
on_load(function (package)
48+
if package:config("libunwind") then
49+
package:add("deps", "libunwind")
50+
end
51+
end)
52+
4553
on_install("linux", "macosx", "windows", "mingw", "cross", function (package)
4654
if not package:config("shared") then
4755
package:add("defines", "CPPTRACE_STATIC_DEFINE")
@@ -55,6 +63,7 @@ package("cpptrace")
5563
"-DCPPTRACE_USE_EXTERNAL_ZSTD=ON",
5664
"-DCPPTRACE_VCPKG=ON",
5765
}
66+
table.insert(configs, "-DCPPTRACE_UNWIND_WITH_LIBUNWIND=" .. (package:config("libunwind") and "ON" or "OFF"))
5867
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
5968
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
6069
import("package.tools.cmake").install(package, configs)

0 commit comments

Comments
 (0)