xmake.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package("aws-c-io")
  2. set_homepage("https://github.com/awslabs/aws-c-io")
  3. set_description("This is a module for the AWS SDK for C. It handles all IO and TLS work for application protocols. ")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/awslabs/aws-c-io/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/awslabs/aws-c-io.git")
  7. add_versions("v0.13.32", "2a6b18c544d014ca4f55cb96002dbbc1e52a2120541c809fa974cb0838ea72cc")
  8. add_configs("asan", {description = "Enable Address Sanitize.", default = false, type = "boolean"})
  9. if is_plat("windows") then
  10. add_syslinks("advapi32", "crypt32", "secur32", "ncrypt")
  11. elseif is_plat("linux", "bsd", "cross") then
  12. add_deps("s2n-tls")
  13. elseif is_plat("macosx") then
  14. add_frameworks("Security")
  15. end
  16. add_deps("cmake", "aws-c-common", "aws-c-cal")
  17. on_install("windows|x64", "windows|x86", "linux", "macosx", "bsd", "msys", "cross", function (package)
  18. local cmakedir = package:dep("aws-c-common"):installdir("lib", "cmake")
  19. if package:is_plat("windows") then
  20. cmakedir = cmakedir:gsub("\\", "/")
  21. end
  22. local configs = {"-DBUILD_TESTING=OFF", "-DCMAKE_MODULE_PATH=" .. cmakedir}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  25. table.insert(configs, "-DENABLE_SANITIZERS=" .. (package:config("asan") and "ON" or "OFF"))
  26. if package:is_plat("windows") then
  27. table.insert(configs, "-DAWS_STATIC_MSVC_RUNTIME_LIBRARY=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  28. end
  29. import("package.tools.cmake").install(package, configs)
  30. end)
  31. on_test(function (package)
  32. assert(package:has_cfuncs("aws_io_library_init", {includes = "aws/io/io.h"}))
  33. end)