xmake.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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.23.1", "8f7029fea12907564b80260cbea4a2b268ca678e7427def3e0c46871e9b42d16")
  8. 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"})
  9. add_deps("cmake", "aws-c-common", "aws-c-io", "aws-checksums", "aws-c-event-stream",
  10. "aws-c-http", "aws-c-mqtt", "aws-c-auth", "aws-c-s3")
  11. on_install("windows|x64", "windows|x86", "linux", "macosx", "bsd", "msys", 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, "-DBUILD_DEPS=OFF"}
  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. table.insert(configs, "-DUSE_OPENSSL=" .. (package:config("openssl") and "ON" or "OFF"))
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. #include <aws/crt/Api.h>
  29. void test() {
  30. Aws::Crt::ApiHandle apiHandle;
  31. }
  32. ]]}, {configs = {languages = "c++11"}}))
  33. end)