xmake.lua 2.0 KB

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