xmake.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package("hookmanager")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/cngege/HookManager")
  4. set_description("A header_only HookManager lib for C++.")
  5. set_license("MIT")
  6. add_urls("https://github.com/cngege/HookManager/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/cngege/HookManager.git")
  8. add_versions("v0.4.1", "51eff9fe2fbff64ddd97e12f8860bb71c194f58a18ef4ebbcfe634bebc632bae")
  9. add_versions("v0.3.3", "8a4ebc17def15c93a09125466211e8ed700c05c4197a8eb0d6aa4a7ed9a4b9a1")
  10. add_versions("v0.3.2", "35f4e658182bfe8d70eaab6af15fee6b182367e0cc7a7163c49ddb1c64024183")
  11. add_configs("lighthook", {description = "Use lighthook as the underlying hook executor.", default = false, type = "boolean"})
  12. add_configs("minhook", {description = "Use minhook as the underlying hook executor.", default = true, type = "boolean"})
  13. add_configs("detours", {description = "Use detours as the underlying hook executor.", default = false, type = "boolean"})
  14. if on_check then
  15. on_check(function (package)
  16. assert(not package:is_arch("arm64"),"package(hookmanager) The arm64 architecture is not currently supported.")
  17. assert(not (package:is_arch("x86") and package:config("lighthook")),"package(hookmanager) LightHook does not support the X86 architecture.")
  18. end)
  19. end
  20. on_load(function (package)
  21. if package:config("lighthook") then
  22. package:add("deps", "lighthook")
  23. package:add("defines", "USE_LIGHTHOOK")
  24. elseif package:config("minhook") then
  25. package:add("deps", "minhook")
  26. package:add("defines", "USE_MINHOOK")
  27. elseif package:config("detours") then
  28. package:add("deps", "microsoft-detours")
  29. package:add("defines", "USE_DETOURS")
  30. end
  31. end)
  32. on_install("windows", function (package)
  33. os.cp("include/HookManager/HookManager.hpp", package:installdir("include/HookManager"))
  34. end)
  35. on_test(function (package)
  36. assert(package:check_cxxsnippets({test = [[
  37. #include "HookManager/HookManager.hpp"
  38. void test() {
  39. auto* h = HookManager::getInstance();
  40. }
  41. ]]}, {configs = {languages = "c++20"}}))
  42. end)