xmake.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package("restinio")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/Stiffstream/restinio")
  4. set_description("Cross-platform, efficient, customizable, and robust asynchronous HTTP/WebSocket server C++14 library with the right balance between performance and ease of use")
  5. set_license("BSD-3-Clause")
  6. add_urls("https://github.com/Stiffstream/restinio/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/Stiffstream/restinio.git", {version = function (version) return "v." .. tostring(version) end})
  8. add_versions("0.6.17", "0140b23f50bb964f6917d1f99205476eba92203dc586673bdf2ea48d7406f2c4")
  9. add_versions("0.6.18", "16fa041f4603746c6cd0f29ab126d02d220034535e7019c6ca1b8b9f58bfeee0")
  10. add_versions("0.6.19", "5a739cac8f3148e7e94f05bb08f5cf569dd31f6f3ea2b893eddfffb0a155eb52")
  11. if is_plat("mingw") then
  12. add_syslinks("ws2_32", "mswsock")
  13. elseif is_plat("linux", "bsd") then
  14. add_syslinks("pthread")
  15. end
  16. add_deps("cmake",
  17. "asio",
  18. "http_parser",
  19. "fmt",
  20. "expected-lite",
  21. "optional-lite",
  22. "string-view-lite",
  23. "variant-lite")
  24. add_defines("RESTINIO_EXTERNAL_EXPECTED_LITE",
  25. "RESTINIO_EXTERNAL_OPTIONAL_LITE",
  26. "RESTINIO_EXTERNAL_STRING_VIEW_LITE",
  27. "RESTINIO_EXTERNAL_VARIANT_LITE")
  28. on_install("windows", "linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", "cross", function (package)
  29. os.cd("dev/restinio")
  30. local configs =
  31. {
  32. "-DRESTINIO_INSTALL=ON",
  33. "-DRESTINIO_USE_EXTERNAL_EXPECTED_LITE=ON",
  34. "-DRESTINIO_USE_EXTERNAL_OPTIONAL_LITE=ON",
  35. "-DRESTINIO_USE_EXTERNAL_STRING_VIEW_LITE=ON",
  36. "-DRESTINIO_USE_EXTERNAL_VARIANT_LITE=ON",
  37. }
  38. import("package.tools.cmake").install(package, configs)
  39. end)
  40. on_test(function (package)
  41. assert(package:check_cxxsnippets({test = [[
  42. #include <restinio/all.hpp>
  43. void test() {
  44. restinio::run(
  45. restinio::on_this_thread()
  46. .port(8080)
  47. .address("localhost")
  48. .request_handler([](auto req) {
  49. return req->create_response().set_body("Hello, World!").done();
  50. }));
  51. }
  52. ]]}, {configs = {languages = "c++14"}}))
  53. end)