xmake.lua 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package("emmylua_debugger")
  2. set_kind("binary")
  3. set_homepage("https://github.com/EmmyLua/EmmyLuaDebugger")
  4. set_description("EmmyLua Debugger")
  5. add_urls("https://github.com/EmmyLua/EmmyLuaDebugger/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/EmmyLua/EmmyLuaDebugger.git")
  7. add_versions("1.8.4", "e94590ae2ad6ad3ec6d238d6e5991b4d2a7f5942fc329f8f627e1d24315bdb88")
  8. add_versions("1.8.3", "a2803b4eec21400ca61691824e9e7689c1f14735470081a3ef0c5234aa4e590f")
  9. add_versions("1.8.2", "2ce5adbfad4055072d39302dccf794ec45800e84a5f3ba4784b373078a9dff8c")
  10. add_versions("1.8.1", "0dbbfefe798425323bd1f531463675460fce3418d73ef29b495e7369f8c76475")
  11. add_versions("1.8.0", "21e5ba1c82e4386cd8ad4f8c76511d70319b899b414d29ecdaba35649325d2ee")
  12. add_versions("1.7.1", "8757d372c146d9995b6e506d42f511422bcb1dc8bacbc3ea1a5868ebfb30015f")
  13. add_versions("1.6.3", "4e10cf1c729fc58f72880895e63618cb91d186ff3b55f270cdaa089a2f8b20bc")
  14. add_configs("luasrc", {description = "Use lua source.", default = true, type = "boolean"})
  15. add_configs("luaver", {description = "Set lua version.", default = "5.4", type = "string"})
  16. if is_plat("windows") then
  17. add_configs("emmy_tool", {description = "Build emmy_tool", default = false, type = "boolean"})
  18. add_configs("emmy_hook", {description = "Build emmy_hook", default = false, type = "boolean"})
  19. end
  20. add_deps("cmake")
  21. on_load(function (package)
  22. local suffix
  23. if package:is_plat("macosx") then
  24. suffix = ".dylib"
  25. elseif package:is_plat("windows") then
  26. suffix = ".dll"
  27. else
  28. suffix = ".so"
  29. end
  30. package:addenv("EMMYLUA_DEBUGGER", "bin/emmy_core" .. suffix)
  31. package:mark_as_pathenv("EMMYLUA_DEBUGGER")
  32. end)
  33. on_install("macosx", "linux", "windows", function (package)
  34. import("core.base.semver")
  35. local configs = {}
  36. if package:config("luasrc") then
  37. table.insert(configs, "-DEMMY_USE_LUA_SOURCE=ON")
  38. end
  39. local luaver = package:config("luaver")
  40. if luaver then
  41. local version = semver.new(luaver)
  42. table.insert(configs, "-DEMMY_LUA_VERSION=" .. version:major() .. version:minor())
  43. end
  44. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  45. io.replace("CMakeLists.txt", "set(CMAKE_INSTALL_PREFIX install)", "", {plain = true})
  46. if package:is_plat("windows") then
  47. if not (package:config("emmy_tool") or package:config("emmy_hook")) then
  48. io.replace("CMakeLists.txt", "add_subdirectory(shared)", "", {plain = true})
  49. end
  50. if not package:config("emmy_tool") then
  51. io.replace("CMakeLists.txt", "add_subdirectory(emmy_tool)", "", {plain = true})
  52. end
  53. if not package:config("emmy_hook") then
  54. io.replace("CMakeLists.txt", "add_subdirectory(emmy_hook)", "", {plain = true})
  55. io.replace("CMakeLists.txt", "add_subdirectory(third-party/EasyHook)", "", {plain = true})
  56. end
  57. end
  58. import("package.tools.cmake").install(package, configs)
  59. end)
  60. on_test(function (package)
  61. assert(os.isfile(os.getenv("EMMYLUA_DEBUGGER")))
  62. end)