xmake.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.4.2", "c51967bbab472655d04e28ce1668ee4adda1f320e05f98c14f071b2cdf61228b")
  8. add_versions("2.3.0", "14be57405b12cf434daade2310178534240866e3169c7213a6fa0e4a6c6f9f27")
  9. if is_plat("windows") then
  10. add_syslinks("user32", "advapi32", "shell32")
  11. elseif is_plat("mingw") then
  12. add_syslinks("ws2_32")
  13. elseif is_plat("linux") then
  14. add_syslinks("pthread", "dl")
  15. end
  16. on_install("windows", "linux", "macosx", "mingw|x86_64", "msys", "android", "cross", function (package)
  17. if package:is_plat("android") and package:is_arch("armeabi-v7a") then
  18. import("core.tool.toolchain")
  19. local ndk = toolchain.load("ndk", {plat = package:plat(), arch = package:arch()})
  20. local ndk_sdkver = ndk:config("ndk_sdkver")
  21. if tonumber(ndk_sdkver) < 24 then
  22. -- https://github.com/marzer/tomlplusplus/pull/205
  23. io.replace("src/civetweb/civetweb.c", "ftello", "ftell", {plain = true})
  24. io.replace("src/civetweb/civetweb.c", "fseeko", "fseek", {plain = true})
  25. end
  26. end
  27. io.writefile("xmake.lua", [[
  28. add_rules("mode.debug", "mode.release")
  29. target("webui")
  30. set_kind("$(kind)")
  31. add_files("src/civetweb/civetweb.c", {defines = {"NO_CACHING", "NO_CGI", "NO_SSL", "USE_WEBSOCKET"}})
  32. add_files("src/webui.c", {defines = "WEBUI_LOG"})
  33. add_headerfiles("include/webui.h", "include/webui.hpp")
  34. add_includedirs("include", "src/civetweb")
  35. if is_plat("windows") then
  36. add_syslinks("user32", "advapi32", "shell32")
  37. elseif is_plat("mingw") then
  38. add_syslinks("ws2_32")
  39. elseif is_plat("linux") then
  40. add_syslinks("pthread", "dl")
  41. end
  42. ]])
  43. import("package.tools.xmake").install(package)
  44. end)
  45. on_test(function (package)
  46. assert(package:check_cxxsnippets({test = [[
  47. #include <webui.hpp>
  48. void test() {
  49. size_t my_window = webui_new_window();
  50. webui_show(my_window, "<html>Hello</html>");
  51. webui_wait();
  52. }
  53. ]]}, {configs = {languages = "c++17"}}))
  54. end)