xmake.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package("seasocks")
  2. set_homepage("https://github.com/mattgodbolt/seasocks")
  3. set_description("Simple, small, C++ embeddable webserver with WebSockets support")
  4. set_license("BSD-2-Clause")
  5. add_urls("https://github.com/mattgodbolt/seasocks/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/mattgodbolt/seasocks.git")
  7. add_versions("v1.4.6", "fc69636ce1205d338d4c02784333b04cd774fa368843fcf9f4fe6f8530a2cd67")
  8. add_configs("deflate", {description = "Include support for deflate (requires zlib).", default = false, type = "boolean"})
  9. if is_plat("windows") then
  10. add_syslinks("ws2_32")
  11. elseif is_plat("linux", "bsd") then
  12. add_syslinks("pthread")
  13. end
  14. add_deps("cmake")
  15. add_deps("python", {kind = "binary"})
  16. on_load(function (package)
  17. if package:config("deflate") then
  18. package:add("deps", "zlib")
  19. end
  20. end)
  21. on_install("windows", "linux", "bsd", function (package)
  22. local configs = {"-DUNITTESTS=OFF", "-DSEASOCKS_EXAMPLE_APP=OFF"}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DSEASOCKS_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  25. table.insert(configs, "-DDEFLATE_SUPPORT=" .. (package:config("deflate") and "ON" or "OFF"))
  26. if package:is_plat("windows") and package:config("shared") then
  27. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  28. end
  29. import("package.tools.cmake").install(package, configs)
  30. end)
  31. on_test(function (package)
  32. assert(package:check_cxxsnippets({test = [[
  33. #include <seasocks/StringUtil.h>
  34. void test() {
  35. std::string dir = seasocks::getWorkingDir();
  36. }
  37. ]]}, {configs = {languages = "c++17"}}))
  38. end)