xmake.lua 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("aws-crt-cpp")
  2. set_homepage("https://github.com/awslabs/aws-crt-cpp")
  3. set_description("C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/awslabs/aws-crt-cpp/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/awslabs/aws-crt-cpp.git")
  7. add_versions("v0.27.2", "e17c82d7cc3b5e6e4300bc7e4794306e292b5281d212ead536000a8b5f5f1be4")
  8. add_versions("v0.26.11", "23acb2b14019182dd73fe6779ec266ee4d8937f19a99803da6407937fa22db7d")
  9. add_versions("v0.26.9", "5b5760d34fbbfcc971f561296e828de4c788750472fd9bd3ac20068a083620f2")
  10. add_versions("v0.26.8", "36ced4fb54c8eb7325b4576134e01f93bfaca2709565b5ad036d198d703e4c8f")
  11. add_versions("v0.26.4", "486113a556614b7b824e1aefec365a2261154fe06321b85601aefe2f65bd0706")
  12. add_versions("v0.23.1", "8f7029fea12907564b80260cbea4a2b268ca678e7427def3e0c46871e9b42d16")
  13. add_configs("openssl", {description = "Set this if you want to use your system's OpenSSL 1.0.2/1.1.1 compatible libcrypto", default = false, type = "boolean"})
  14. add_deps("cmake", "aws-c-common", "aws-c-io", "aws-checksums", "aws-c-event-stream",
  15. "aws-c-http", "aws-c-mqtt", "aws-c-auth", "aws-c-s3")
  16. on_install("windows|x64", "windows|x86", "linux", "macosx", "bsd", "msys", function (package)
  17. local cmakedir = package:dep("aws-c-common"):installdir("lib", "cmake")
  18. if package:is_plat("windows") then
  19. cmakedir = cmakedir:gsub("\\", "/")
  20. end
  21. local configs = {"-DBUILD_TESTING=OFF", "-DCMAKE_MODULE_PATH=" .. cmakedir, "-DBUILD_DEPS=OFF"}
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  24. table.insert(configs, "-DENABLE_SANITIZERS=" .. (package:config("asan") and "ON" or "OFF"))
  25. if package:is_plat("windows") then
  26. table.insert(configs, "-DAWS_STATIC_MSVC_RUNTIME_LIBRARY=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  27. io.replace("include/aws/crt/Exports.h", "WIN32", "_WIN32", {plain = true})
  28. if package:config("shared") then
  29. package:add("defines", "AWS_CRT_CPP_USE_IMPORT_EXPORT")
  30. end
  31. end
  32. table.insert(configs, "-DUSE_OPENSSL=" .. (package:config("openssl") and "ON" or "OFF"))
  33. import("package.tools.cmake").install(package, configs)
  34. end)
  35. on_test(function (package)
  36. assert(package:check_cxxsnippets({test = [[
  37. #include <aws/crt/Api.h>
  38. void test() {
  39. Aws::Crt::ApiHandle apiHandle;
  40. }
  41. ]]}, {configs = {languages = "c++11"}}))
  42. end)