xmake.lua 1.4 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.3", "5bec16358ec9086d4593124bf558635e89135abea2c76e5761ecaf09f4546b19")
  8. on_install("windows", "mingw", function (package)
  9. io.writefile("xmake.lua", [[
  10. add_rules("mode.debug", "mode.release")
  11. target("minhook")
  12. set_kind("$(kind)")
  13. add_includedirs("src/", "src/hde/")
  14. add_files("src/*.c", is_arch("x64", "x86_64") and "src/hde/hde64.c" or "src/hde/hde32.c")
  15. if is_kind("shared") then
  16. add_files("dll_resources/MinHook.rc")
  17. if is_plat("windows") then
  18. add_shflags("/def:dll_resources/MinHook.def")
  19. end
  20. end
  21. add_headerfiles("include/MinHook.h")
  22. ]])
  23. local configs = {}
  24. if package:config("shared") then
  25. configs.kind = "shared"
  26. end
  27. import("package.tools.xmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:has_cfuncs("MH_Initialize", {includes = "MinHook.h"}))
  31. end)