2
0

xmake.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("easywsclient")
  2. set_homepage("https://github.com/dhbaird/easywsclient")
  3. set_description("A short and sweet WebSocket client for C++")
  4. set_license("MIT")
  5. add_urls("https://github.com/dhbaird/easywsclient.git")
  6. add_versions("2021.01.12", "afc1d8cfc584e0f1f4a77e8c0ce3e979d9fe7ce2")
  7. add_patches("2021.01.12", path.join(os.scriptdir(), "patches", "2021.01.12", "add_cstdint.patch"), "babddf02e9eae42cc11e5458478f207837a402c425b31dafd2ef63a29b7d6744")
  8. add_patches("2021.01.12", path.join(os.scriptdir(), "patches", "2021.01.12", "move_import.patch"), "9265412268390cbfcb799f40324c3e255ae6fc01c292e749c131f1c3c19e32bd")
  9. if is_plat("mingw") then
  10. add_syslinks("ws2_32")
  11. end
  12. on_install(function (package)
  13. local configs = {}
  14. io.writefile("xmake.lua", [[
  15. add_rules("mode.release", "mode.debug")
  16. target("easywsclient")
  17. set_kind("$(kind)")
  18. set_languages("cxx11")
  19. add_files("easywsclient.cpp")
  20. add_headerfiles("(easywsclient.hpp)")
  21. if is_plat("windows") then
  22. add_defines("_WIN32")
  23. end
  24. if is_plat("mingw") then
  25. add_syslinks("ws2_32")
  26. end
  27. ]])
  28. import("package.tools.xmake").install(package, configs)
  29. end)
  30. on_test(function (package)
  31. assert(package:check_cxxsnippets({test = [[
  32. #include <memory>
  33. #include "easywsclient.hpp"
  34. void test() {
  35. std::unique_ptr<easywsclient::WebSocket> ws(easywsclient::WebSocket::from_url("ws://echo.websocket.org"));
  36. ws->send("Hello World!");
  37. }
  38. ]]}), {configs = {languages = "cxx11"}})
  39. end)