xmake.lua 2.2 KB

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