xmake.lua 1.2 KB

12345678910111213141516171819202122232425
  1. package("crc32c")
  2. set_homepage("https://github.com/google/crc32c")
  3. set_description("CRC32C implementation with support for CPU-specific acceleration instructions")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/google/crc32c/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/google/crc32c.git")
  7. add_versions("1.1.2", "ac07840513072b7fcebda6e821068aa04889018f24e10e46181068fb214d7e56")
  8. add_deps("cmake")
  9. on_install(function (package)
  10. local configs = {"-DCRC32C_BUILD_TESTS=OFF", "-DCRC32C_BUILD_BENCHMARKS=OFF", "-DCRC32C_USE_GLOG=OFF", "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW"}
  11. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  12. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  13. if package:is_plat("windows") and package:config("shared") then
  14. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  15. end
  16. import("package.tools.cmake").install(package, configs)
  17. end)
  18. on_test(function (package)
  19. assert(package:has_cfuncs("crc32c_value", {includes = "crc32c/crc32c.h"}))
  20. end)