xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.3.3", "8a4ebc17def15c93a09125466211e8ed700c05c4197a8eb0d6aa4a7ed9a4b9a1")
  9. add_versions("v0.3.2", "35f4e658182bfe8d70eaab6af15fee6b182367e0cc7a7163c49ddb1c64024183")
  10. add_configs("lighthook", {description = "Use lighthook as the underlying hook executor.", default = true, type = "boolean"})
  11. add_configs("minhook", {description = "Use minhook as the underlying hook executor.", default = false, type = "boolean"})
  12. add_configs("detours", {description = "Use detours as the underlying hook executor.", default = false, type = "boolean"})
  13. on_load("windows|x64", function (package)
  14. if package:config("lighthook") then
  15. package:add("deps", "lighthook")
  16. package:add("defines", "USE_LIGHTHOOK")
  17. elseif package:config("minhook") then
  18. package:add("deps", "minhook")
  19. package:add("defines", "USE_MINHOOK")
  20. elseif package:config("detours") then
  21. package:add("deps", "microsoft-detours")
  22. package:add("defines", "USE_DETOURS")
  23. end
  24. end)
  25. on_install("windows|x64", function (package)
  26. os.cp("include/HookManager/HookManager.hpp", package:installdir("include/HookManager"))
  27. end)
  28. on_test(function (package)
  29. assert(package:check_cxxsnippets({test = [[
  30. #include "HookManager/HookManager.hpp"
  31. void test() {
  32. auto* h = HookManager::getInstance();
  33. }
  34. ]]}, {configs = {languages = "c++20"}}))
  35. end)