xmake.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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")
  7. add_versions("5.0.4", "32b968fb2bd1e33ae854db3bd3fc9ce4374bd9e61ff420f365c52d5f7bbd85dd")
  8. add_versions("5.0.3", "75a190d1195c641c7d5d2c37ac79d8d1b5f18e43268d023454765a566d6f0d88")
  9. add_versions("5.0.2", "99adea3e86bd3b83985dce9076adda16968646ebd9d9316c9f57e6854aeeab9c")
  10. add_deps("capstone", "keystone")
  11. if is_plat("windows", "mingw") then
  12. add_syslinks("user32", "psapi", "ntdll", "shell32", "ole32")
  13. if is_plat("mingw") then
  14. add_syslinks("uuid")
  15. end
  16. elseif is_plat("linux") then
  17. add_syslinks("dl", "m")
  18. elseif is_plat("bsd") then
  19. add_syslinks("dl", "kvm", "procstat", "elf", "m")
  20. end
  21. on_load(function(package)
  22. if package:is_plat("windows") or package:config("shared") then
  23. package:add("defines", "LM_EXPORT")
  24. end
  25. end)
  26. on_install("windows", "linux", "bsd", function (package)
  27. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  28. import("package.tools.xmake").install(package)
  29. end)
  30. on_test(function (package)
  31. assert(package:check_csnippets({test = [[
  32. #include <libmem/libmem.h>
  33. void test() {
  34. lm_thread_t resultThread;
  35. lm_bool_t result = LM_GetThread(&resultThread);
  36. }
  37. ]]}, {configs = {languages = "c11"}}))
  38. assert(package:check_cxxsnippets({test = [[
  39. #include <libmem/libmem.hpp>
  40. #include <vector>
  41. #include <optional>
  42. using namespace libmem;
  43. void test() {
  44. std::optional<Thread> currentThread = GetThread();
  45. std::optional<std::vector<Thread>> threads = EnumThreads();
  46. }
  47. ]]}, {configs = {languages = "c++17"}}))
  48. end)