xmake.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package("minhook")
  2. set_homepage("https://github.com/TsudaKageyu/minhook")
  3. set_description("The Minimalistic x86/x64 API Hooking Library for Windows.")
  4. set_license("BSD-2-Clause")
  5. set_urls("https://github.com/TsudaKageyu/minhook/archive/$(version).tar.gz",
  6. "https://github.com/TsudaKageyu/minhook.git")
  7. add_versions("v1.3.4", "1aebeae4ca898330c507860acc2fca2eb335fe446a3a2b8444c3bf8b2660a14e")
  8. add_versions("v1.3.3", "5bec16358ec9086d4593124bf558635e89135abea2c76e5761ecaf09f4546b19")
  9. on_install("windows|!arm*", "mingw|!arm*", function (package)
  10. io.writefile("xmake.lua", [[
  11. add_rules("mode.debug", "mode.release")
  12. target("minhook")
  13. set_kind("$(kind)")
  14. add_includedirs("src/", "src/hde/")
  15. add_files("src/*.c", is_arch("x64", "x86_64") and "src/hde/hde64.c" or "src/hde/hde32.c")
  16. if is_kind("shared") then
  17. add_files("dll_resources/MinHook.rc")
  18. if is_plat("windows") then
  19. add_shflags("/def:dll_resources/MinHook.def")
  20. end
  21. end
  22. add_headerfiles("include/MinHook.h")
  23. ]])
  24. local configs = {}
  25. if package:config("shared") then
  26. configs.kind = "shared"
  27. end
  28. import("package.tools.xmake").install(package, configs)
  29. end)
  30. on_test(function (package)
  31. assert(package:has_cfuncs("MH_Initialize", {includes = "MinHook.h"}))
  32. end)