xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("simple_http")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/fantasy-peak/simple_http")
  4. set_description("A header-only HTTP library that supports both HTTP/2 and HTTP/1, based on Beast, nghttp2, and Asio.")
  5. set_license("MIT")
  6. add_urls("https://github.com/fantasy-peak/simple_http/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/fantasy-peak/simple_http.git")
  8. add_versions("v0.3.0", "2ed94c4ed0b8ee5cb512cc95417725a8b37cf1071ee46b4eac4591db27ec9fd3")
  9. add_versions("v0.2.0", "1c2ab7c2be317f95e34bdbe6c753293495b6743828ec4115b5f3c383c8c95adc")
  10. add_deps("cmake")
  11. add_deps("boost", {configs = {cmake = false}})
  12. add_deps("nghttp2", "openssl")
  13. on_install("linux", "cross", "bsd", function (package)
  14. import("package.tools.cmake").install(package)
  15. end)
  16. on_test(function (package)
  17. assert(package:check_cxxsnippets({test = [[
  18. simple_http::Config cfg{.ip = "0.0.0.0",
  19. .port = 6666,
  20. .worker_num = 4,
  21. .concurrent_streams = 200};
  22. void test() {
  23. simple_http::HttpServer hs(cfg);
  24. hs.setHttpHandler(
  25. "/hello", [](auto req, auto writer) -> boost::asio::awaitable<void> {
  26. });
  27. return;
  28. }
  29. ]]}, {configs = {languages = "c++20"}, includes = {"simple_http.h"}}))
  30. end)