2
0

xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("cpp20-http-client")
  2. set_homepage("https://github.com/avocadoboi/cpp20-http-client")
  3. set_description("An HTTP(S) client library for C++20.")
  4. set_license("MIT")
  5. add_urls("https://github.com/avocadoboi/cpp20-http-client.git")
  6. add_versions("2023.08.11", "bb011a055a1813a4fb2a0b67db0ffa455221aaf8")
  7. if is_plat("windows") then
  8. add_syslinks("ws2_32", "crypt32")
  9. else
  10. add_deps("openssl")
  11. end
  12. on_install("windows", "linux", "macosx", "bsd", "android", "cross", function (package)
  13. io.writefile("xmake.lua", [[
  14. add_rules("mode.debug", "mode.release")
  15. if not is_plat("windows") then
  16. add_requires("openssl")
  17. end
  18. set_languages("c++20")
  19. target("cpp20-http-client")
  20. set_kind("$(kind)")
  21. add_files("source/**.cpp")
  22. add_includedirs("include")
  23. add_headerfiles("include/**.hpp")
  24. if is_plat("windows") then
  25. add_cxxflags("/utf-8")
  26. add_syslinks("ws2_32", "crypt32")
  27. if is_kind("shared") then
  28. add_rules("utils.symbols.export_all", {export_classes = true})
  29. end
  30. else
  31. add_packages("openssl")
  32. end
  33. ]])
  34. import("package.tools.xmake").install(package, configs)
  35. end)
  36. on_test(function (package)
  37. assert(package:check_cxxsnippets({test = [[
  38. #include <cpp20_http_client.hpp>
  39. void test() {
  40. auto const response = http_client::get("https://www.google.com")
  41. .add_header({.name="HeaderName", .value="header value"})
  42. .send();
  43. }
  44. ]]}, {configs = {languages = "c++20"}}))
  45. end)