xmake.lua 1.3 KB

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