xmake.lua 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package("breakpad")
  2. set_homepage("https://chromium.googlesource.com/breakpad/breakpad")
  3. set_description("Mirror of Google Breakpad project")
  4. add_urls("https://github.com/google/breakpad/archive/refs/tags/$(version).tar.gz",
  5. "https://github.com/google/breakpad.git",
  6. "https://chromium.googlesource.com/breakpad/breakpad.git")
  7. add_versions("v2023.01.27", "f187e8c203bd506689ce4b32596ba821e1e2f034a83b8e07c2c635db4de3cc0b")
  8. if is_plat("windows") then
  9. add_configs("shared", {description = "Build shared binaries.", default = false, type = "boolean", readonly = true})
  10. end
  11. if is_plat("mingw") and is_subhost("msys") then
  12. add_extsources("pacman::breakpad")
  13. end
  14. if is_plat("windows") then
  15. add_syslinks("wininet", "dbghelp", "imagehlp")
  16. elseif is_plat("linux") then
  17. add_syslinks("pthread")
  18. elseif is_plat("macosx") then
  19. add_frameworks("CoreFoundation")
  20. end
  21. add_deps("libdisasm")
  22. on_install("windows|x64", "windows|x86", function (package)
  23. io.replace("src/processor/disassembler_x86.h", "third_party/", "", {plain = true})
  24. io.replace("src/processor/exploitability_win.cc", "third_party/", "", {plain = true})
  25. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  26. import("package.tools.xmake").install(package, configs)
  27. end)
  28. on_test(function (package)
  29. local plat
  30. local snippets
  31. if package:is_plat("windows") then
  32. plat = "windows"
  33. snippets = [[
  34. void test() {
  35. std::wstring dump_path;
  36. google_breakpad::ExceptionHandler handler(dump_path, nullptr, nullptr, nullptr, 0);
  37. }
  38. ]]
  39. elseif package:is_plat("macosx") then
  40. plat = "mac"
  41. snippets = [[
  42. void test() {
  43. std::string dump_path;
  44. google_breakpad::ExceptionHandler handler(
  45. dump_path, nullptr, nullptr, nullptr, false, nullptr);
  46. }
  47. ]]
  48. else
  49. plat = "linux"
  50. snippets = [[
  51. void test() {
  52. google_breakpad::MinidumpDescriptor descriptor("/tmp");
  53. }
  54. ]]
  55. end
  56. local header = "client/" .. plat .. "/handler/exception_handler.h"
  57. assert(package:check_cxxsnippets({test = snippets}, {configs = {languages = "c++11"}, includes = header}))
  58. end)