xmake.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  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.4.0", "1438a5037ed424ae98b1d9e60cf506d32eaf2d709f373f004b80d98278e044ea")
  9. add_versions("v0.3.0", "2ed94c4ed0b8ee5cb512cc95417725a8b37cf1071ee46b4eac4591db27ec9fd3")
  10. add_versions("v0.2.0", "1c2ab7c2be317f95e34bdbe6c753293495b6743828ec4115b5f3c383c8c95adc")
  11. add_deps("cmake")
  12. add_deps("boost", {configs = {cmake = false}})
  13. add_deps("nghttp2", "openssl")
  14. on_install("linux", "cross", "bsd", function (package)
  15. import("package.tools.cmake").install(package)
  16. end)
  17. on_test(function (package)
  18. assert(package:check_cxxsnippets({test = [[
  19. simple_http::Config cfg{.ip = "0.0.0.0",
  20. .port = 6666,
  21. .worker_num = 4,
  22. .concurrent_streams = 200};
  23. void test() {
  24. simple_http::HttpServer hs(cfg);
  25. hs.setHttpHandler(
  26. "/hello", [](auto req, auto writer) -> boost::asio::awaitable<void> {
  27. });
  28. return;
  29. }
  30. ]]}, {configs = {languages = "c++20"}, includes = {"simple_http.h"}}))
  31. end)