xmake.lua 3.3 KB

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