xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("libdivsufsort")
  2. set_homepage("https://android.googlesource.com/platform/external/libdivsufsort/")
  3. set_description("A lightweight suffix array sorting library")
  4. add_urls("https://android.googlesource.com/platform/external/libdivsufsort.git")
  5. add_versions("2021.2.18", "d6031097d39aabfff1372e9a1601eed3fbd5fd9b")
  6. if is_plat("linux") then
  7. add_extsources("apt::libdivsufsort-dev", "paru::libdivsufsort")
  8. end
  9. add_deps("cmake")
  10. add_configs("use_64", {description = "Build 64bit suffxi array sorting APIs", default = false, type = "boolean"})
  11. on_install(function (package)
  12. import("package.tools.cmake")
  13. local configs = {}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  15. if package:config("shared") then
  16. table.insert(configs, "-DBUILD_SHARED_LIBS=on")
  17. else
  18. table.insert(configs, "-DBUILD_SHARED_LIBS=off")
  19. end
  20. if package:config("use_64") then
  21. table.insert(configs, "-DBUILD_DIVSUFSORT64=on")
  22. end
  23. cmake.install(package, configs)
  24. end)
  25. on_test(function (package)
  26. if package:config("use_64") then
  27. assert(package:has_cfuncs("sa_search64", {includes = "divsufsort64.h"}))
  28. else
  29. assert(package:has_cfuncs("sa_search", {includes = "divsufsort.h"}))
  30. end
  31. end)