xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("subhook")
  2. set_homepage("https://github.com/Dasharo/subhook")
  3. set_description("Simple hooking library for C/C++ (x86 only, 32/64-bit, no dependencies). Re-upload of Zeex/subhook.")
  4. set_license("BSD-2-Clause")
  5. add_urls("https://github.com/Dasharo/subhook.git",
  6. "https://github.com/xmake-mirror/subhook.git")
  7. add_versions("2023.02.10", "e935959d2f9cc642bcbb5e7759b2b1e7196b0947")
  8. on_install("windows|!arm64", "linux|x86_64", "macosx|x86_64", "bsd", "mingw", "msys", function (package)
  9. if (not package:config("shared")) and package:is_plat("windows", "mingw") then
  10. package:add("defines", "SUBHOOK_STATIC")
  11. end
  12. io.writefile("xmake.lua", [[
  13. add_rules("mode.debug", "mode.release")
  14. target("subhook")
  15. set_kind("$(kind)")
  16. add_files("subhook.c")
  17. add_headerfiles("subhook.h")
  18. if is_kind("static") then
  19. if is_plat("windows", "mingw") then
  20. add_defines("SUBHOOK_STATIC")
  21. end
  22. else
  23. add_defines("SUBHOOK_IMPLEMENTATION")
  24. end
  25. ]])
  26. import("package.tools.xmake").install(package)
  27. wprint("The original repository Zeex/subhook is no longer public. You are using a mirror of this repository.")
  28. end)
  29. on_test(function (package)
  30. assert(package:has_cfuncs("subhook_new", {includes = "subhook.h"}))
  31. end)