xmake.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("aws-c-sdkutils")
  2. set_homepage("https://github.com/awslabs/aws-c-sdkutils")
  3. set_description("C99 library implementing AWS SDK specific utilities. Includes utilities for ARN parsing, reading AWS profiles, etc...")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/awslabs/aws-c-sdkutils/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/awslabs/aws-c-sdkutils.git")
  7. add_versions("v0.1.12", "c876c3ce2918f1181c24829f599c8f06e29733f0bd6556d4c4fb523390561316")
  8. add_configs("asan", {description = "Enable Address Sanitize.", default = false, type = "boolean"})
  9. if is_plat("wasm") then
  10. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  11. end
  12. add_deps("cmake", "aws-c-common")
  13. on_install("windows|x64", "windows|x86", "linux", "macosx", "bsd", "msys", "android", "iphoneos", "cross", "wasm", function (package)
  14. local aws_cmakedir = package:dep("aws-c-common"):installdir("lib", "cmake")
  15. local aws_c_common_configdir = package:dep("aws-c-common"):installdir("lib", "aws-c-common", "cmake")
  16. if package:is_plat("windows") then
  17. aws_cmakedir = aws_cmakedir:gsub("\\", "/")
  18. aws_c_common_configdir = aws_c_common_configdir:gsub("\\", "/")
  19. end
  20. local configs =
  21. {
  22. "-DBUILD_TESTING=OFF",
  23. "-DCMAKE_MODULE_PATH=" .. aws_cmakedir,
  24. "-Daws-c-common_DIR=" .. aws_c_common_configdir
  25. }
  26. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  27. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  28. table.insert(configs, "-DENABLE_SANITIZERS=" .. (package:config("asan") and "ON" or "OFF"))
  29. if package:is_plat("windows") then
  30. table.insert(configs, "-DAWS_STATIC_MSVC_RUNTIME_LIBRARY=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  31. end
  32. import("package.tools.cmake").install(package, configs)
  33. end)
  34. on_test(function (package)
  35. assert(package:has_cfuncs("aws_sdkutils_library_init", {includes = "aws/sdkutils/sdkutils.h"}))
  36. end)