xmake.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package("webui")
  2. set_homepage("https://webui.me")
  3. set_description("Use any web browser as GUI, with your preferred language in the backend and HTML5 in the frontend, all in a lightweight portable lib.")
  4. set_license("MIT")
  5. set_urls("https://github.com/webui-dev/webui/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/webui-dev/webui.git")
  7. add_versions("2.3.0", "14be57405b12cf434daade2310178534240866e3169c7213a6fa0e4a6c6f9f27")
  8. if is_plat("windows") then
  9. add_syslinks("user32", "advapi32")
  10. elseif is_plat("mingw") then
  11. add_syslinks("ws2_32")
  12. end
  13. on_install("windows", "linux", "macosx", "mingw", "msys", "android", "cross", function (package)
  14. local configs = {}
  15. io.writefile("xmake.lua", [[
  16. add_rules("mode.debug", "mode.release")
  17. target("webui")
  18. set_kind("$(kind)")
  19. add_files("src/civetweb/civetweb.c", {defines = {"NO_CACHING", "NO_CGI", "NO_SSL", "USE_WEBSOCKET"}})
  20. add_files("src/webui.c", {defines = "WEBUI_LOG"})
  21. add_headerfiles("include/webui.h", "include/webui.hpp")
  22. add_includedirs("include", "src/civetweb")
  23. if is_plat("windows") then
  24. add_syslinks("user32", "advapi32")
  25. elseif is_plat("mingw") then
  26. add_syslinks("ws2_32")
  27. end
  28. ]])
  29. if package:config("shared") then
  30. configs.kind = "shared"
  31. end
  32. import("package.tools.xmake").install(package, configs)
  33. end)
  34. on_test(function (package)
  35. assert(package:check_cxxsnippets({test = [[
  36. #include <webui.hpp>
  37. void test() {
  38. size_t my_window = webui_new_window();
  39. webui_show(my_window, "<html>Hello</html>");
  40. webui_wait();
  41. }
  42. ]]}))
  43. end)