xmake.lua 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package("aws-c-common")
  2. set_homepage("https://github.com/awslabs/aws-c-common")
  3. set_description("Core c99 package for AWS SDK for C")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/awslabs/aws-c-common/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/awslabs/aws-c-common.git")
  7. add_versions("v0.9.14", "70b10ebbf40e3b6c1b36d81d5e4b63fe430414a81f76293a65e42dfa5def571e")
  8. add_versions("v0.9.13", "6d2044fc58e5d7611610976602f3fc2173676726b00eed026526962c599ece1d")
  9. add_versions("v0.9.3", "389eaac7f64d7d5a91ca3decad6810429eb5a65bbba54798b9beffcb4d1d1ed6")
  10. add_configs("asan", {description = "Enable Address Sanitize.", default = false, type = "boolean"})
  11. if is_plat("wasm") then
  12. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  13. end
  14. if is_plat("windows", "mingw") then
  15. add_syslinks("bcrypt", "ws2_32", "shlwapi")
  16. elseif is_plat("linux", "bsd") then
  17. add_syslinks("dl", "m", "pthread", "rt")
  18. elseif is_plat("macosx") then
  19. add_frameworks("CoreFoundation")
  20. end
  21. add_deps("cmake")
  22. on_install("windows|x64", "windows|x86", "linux", "macosx", "bsd", "msys", "android", "iphoneos", "cross", "wasm", function (package)
  23. local configs = {"-DBUILD_TESTING=OFF"}
  24. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  25. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  26. table.insert(configs, "-DENABLE_SANITIZERS=" .. (package:config("asan") and "ON" or "OFF"))
  27. if package:is_plat("windows") then
  28. table.insert(configs, "-DAWS_STATIC_MSVC_RUNTIME_LIBRARY=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  29. end
  30. import("package.tools.cmake").install(package, configs)
  31. end)
  32. on_test(function (package)
  33. assert(package:has_cfuncs("aws_common_library_init", {includes = "aws/common/common.h"}))
  34. assert(package:has_cfuncs("aws_common_library_clean_up", {includes = "aws/common/common.h"}))
  35. assert(package:has_cfuncs("aws_ring_buffer_init", {includes = "aws/common/ring_buffer.h"}))
  36. assert(package:has_cfuncs("aws_uuid_init", {includes = "aws/common/uuid.h"}))
  37. end)