xmake.lua 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package("libmem")
  2. set_homepage("https://github.com/rdbo/libmem")
  3. set_description("Cross-platform game hacking library for C, C++, Rust, and Python, supporting process/memory hacking, hooking, detouring, and DLL/SO injection.")
  4. set_license("AGPL-3.0")
  5. add_urls("https://github.com/rdbo/libmem/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/rdbo/libmem.git", {submodules = false})
  7. add_versions("5.0.5", "9693d38b17b000b06cd9fbaff72f4e0873d3cf219a6e99a20bb90cf98a7b562d")
  8. add_versions("5.0.4", "32b968fb2bd1e33ae854db3bd3fc9ce4374bd9e61ff420f365c52d5f7bbd85dd")
  9. add_versions("5.0.3", "75a190d1195c641c7d5d2c37ac79d8d1b5f18e43268d023454765a566d6f0d88")
  10. add_versions("5.0.2", "99adea3e86bd3b83985dce9076adda16968646ebd9d9316c9f57e6854aeeab9c")
  11. add_patches("5.0.5", "patches/5.0.5/fix-mingw.diff", "7239f459204975ce2efcf63529dcb09273028c4dc166d7cbacb5f5f0e70f93a9")
  12. add_deps("capstone", "keystone")
  13. if is_plat("windows", "mingw") then
  14. add_syslinks("user32", "psapi", "ntdll", "shell32", "ole32")
  15. if is_plat("mingw") then
  16. add_syslinks("uuid")
  17. end
  18. elseif is_plat("linux") then
  19. add_syslinks("dl", "m")
  20. elseif is_plat("bsd") then
  21. add_syslinks("dl", "kvm", "procstat", "elf", "m")
  22. end
  23. on_load(function(package)
  24. if package:is_plat("windows") or package:config("shared") then
  25. package:add("defines", "LM_EXPORT")
  26. end
  27. end)
  28. on_install("windows", "linux|!arm64", "bsd", "mingw", "msys", function (package)
  29. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  30. import("package.tools.xmake").install(package)
  31. end)
  32. on_test(function (package)
  33. assert(package:check_csnippets({test = [[
  34. #include <libmem/libmem.h>
  35. void test() {
  36. lm_thread_t resultThread;
  37. lm_bool_t result = LM_GetThread(&resultThread);
  38. }
  39. ]]}, {configs = {languages = "c11"}}))
  40. assert(package:check_cxxsnippets({test = [[
  41. #include <libmem/libmem.hpp>
  42. #include <vector>
  43. #include <optional>
  44. using namespace libmem;
  45. void test() {
  46. std::optional<Thread> currentThread = GetThread();
  47. std::optional<std::vector<Thread>> threads = EnumThreads();
  48. }
  49. ]]}, {configs = {languages = "c++17"}}))
  50. end)