xmake.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. add_configs("log", {description = "Enable log", default = true, type = "boolean"})
  10. if is_plat("windows") then
  11. add_syslinks("user32", "advapi32", "shell32", "ws2_32", "ole32")
  12. elseif is_plat("mingw") then
  13. add_syslinks("ws2_32")
  14. elseif is_plat("linux") then
  15. add_syslinks("pthread", "dl")
  16. end
  17. on_install("windows", "linux", "macosx", "mingw|x86_64", "msys", "android", "cross", function (package)
  18. if package:is_plat("android") and package:is_arch("armeabi-v7a") then
  19. import("core.tool.toolchain")
  20. local ndk = toolchain.load("ndk", {plat = package:plat(), arch = package:arch()})
  21. local ndk_sdkver = ndk:config("ndk_sdkver")
  22. if tonumber(ndk_sdkver) < 24 then
  23. -- https://github.com/marzer/tomlplusplus/pull/205
  24. io.replace("src/civetweb/civetweb.c", "ftello", "ftell", {plain = true})
  25. io.replace("src/civetweb/civetweb.c", "fseeko", "fseek", {plain = true})
  26. end
  27. end
  28. local configs = {
  29. log = package:config("log"),
  30. }
  31. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  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. ]]}, {configs = {languages = "c++17"}}))
  43. end)