xmake.lua 2.5 KB

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