xmake.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("aws-c-http")
  2. set_homepage("https://github.com/awslabs/aws-c-http")
  3. set_description("C99 implementation of the HTTP/1.1 and HTTP/2 specifications")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/awslabs/aws-c-http/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/awslabs/aws-c-http.git")
  7. add_versions("v0.8.1", "83fb47e2d7956469bb328f16dea96663e96f8f20dc60dc4e9676b82804588530")
  8. add_versions("v0.7.12", "0f92f295c96e10aa9c1e66ac73c038ee9d9c61e1be7551e721ee0dab9c89fc6f")
  9. add_configs("asan", {description = "Enable Address Sanitize.", default = false, type = "boolean"})
  10. add_deps("cmake", "aws-c-cal", "aws-c-io", "aws-c-compression")
  11. on_install("windows|x64", "windows|x86", "linux", "macosx", "bsd", "msys", "cross", function (package)
  12. local cmakedir = package:dep("aws-c-common"):installdir("lib", "cmake")
  13. if package:is_plat("windows") then
  14. cmakedir = cmakedir:gsub("\\", "/")
  15. end
  16. local configs = {"-DBUILD_TESTING=OFF", "-DCMAKE_MODULE_PATH=" .. cmakedir}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  19. table.insert(configs, "-DENABLE_SANITIZERS=" .. (package:config("asan") and "ON" or "OFF"))
  20. if package:is_plat("windows") then
  21. table.insert(configs, "-DAWS_STATIC_MSVC_RUNTIME_LIBRARY=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  22. end
  23. import("package.tools.cmake").install(package, configs)
  24. end)
  25. on_test(function (package)
  26. assert(package:has_cfuncs("aws_http_message_new_request", {includes = "aws/http/request_response.h"}))
  27. end)