xmake.lua 3.2 KB

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