2
0

xmake.lua 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package("aws-sdk-cpp")
  2. set_homepage("https://github.com/aws/aws-sdk-cpp")
  3. set_description("AWS SDK for C++")
  4. add_urls("https://github.com/aws/aws-sdk-cpp.git")
  5. add_versions("1.9.362", "e9372218a2c8fab756ecaa6e4fefcdb33c3670c1")
  6. add_configs("build_only", {description = 'By default, all SDKS are built, if only AWS S3 is required, then set build_only="s3", with multiple SDKS separated by commas.'})
  7. add_configs("http_client", {description = 'If disabled, no platform-default http client will be included in the library.', default = true, type = "boolean"})
  8. add_configs("encryption", {description = 'If disabled, no platform-default encryption will be included in the library.', default = false, type = "boolean"})
  9. add_deps("zlib")
  10. add_deps("cmake")
  11. on_load(function (package)
  12. if package:config("http_client") then
  13. package:add("deps", "libcurl")
  14. if package:is_plat("macosx") then
  15. package:add("frameworks", "Foundation", "CoreFoundation", "Security", "SystemConfiguration")
  16. end
  17. end
  18. if package:config("encryption") then
  19. package:add("deps", "openssl")
  20. end
  21. end)
  22. on_install("linux", "macosx", function (package)
  23. io.replace("cmake/Findcrypto.cmake",
  24. "if (BUILD_SHARED_LIBS)\n set(crypto_LIBRARY ${crypto_SHARED_LIBRARY})",
  25. [[
  26. if (BUILD_SHARED_LIBS)
  27. if (crypto_SHARED_LIBRARY)
  28. set(crypto_LIBRARY ${crypto_SHARED_LIBRARY})
  29. else()
  30. set(crypto_LIBRARY ${crypto_STATIC_LIBRARY})
  31. endif()
  32. ]], {plain = true})
  33. local configs = {"-DENABLE_TESTING=OFF", "-DAUTORUN_UNIT_TESTS=OFF"}
  34. table.insert(configs, "-DMINIMIZE_SIZE=ON")
  35. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  36. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  37. table.insert(configs, "-DNO_HTTP_CLIENT=" .. (package:config("http_client") and "OFF" or "ON"))
  38. table.insert(configs, "-DNO_ENCRYPTION=" .. (package:config("encryption") and "OFF" or "ON"))
  39. if package:config("build_only") then
  40. table.insert(configs, "-DBUILD_ONLY=" .. package:config("build_only"))
  41. end
  42. if package:config("http_client") and package:is_plat("macosx") then
  43. local exflags = {"-framework", "CoreFoundation", "-framework", "Security", "-framework", "SystemConfiguration"}
  44. import("package.tools.cmake").install(package, configs, {shflags = exflags, ldflags = exflags})
  45. else
  46. import("package.tools.cmake").install(package, configs)
  47. end
  48. end)
  49. on_test(function (package)
  50. assert(package:check_cxxsnippets({
  51. test = [[
  52. #include <aws/core/Aws.h>
  53. static void test() {
  54. Aws::SDKOptions options;
  55. }
  56. ]]
  57. }, {configs = {languages = "c++11"}}))
  58. end)