xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("simdutf")
  2. set_homepage("https://simdutf.github.io/simdutf/")
  3. set_description("Unicode routines (UTF8, UTF16, UTF32): billions of characters per second using SSE2, AVX2, NEON, AVX-512. Part of Node.js.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/simdutf/simdutf/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/simdutf/simdutf.git")
  7. add_versions("v3.2.17", "c24e3eec1e08522a09b33e603352e574f26d367a7701bf069a65881f64acd519")
  8. add_configs("iconv", {description = "Whether to use iconv as part of the CMake build if available.", default = false, type = "boolean"})
  9. add_deps("cmake")
  10. on_load(function (package)
  11. if package:config("iconv") then
  12. package:add("deps", "libiconv")
  13. end
  14. end)
  15. on_install(function (package)
  16. local configs = {"-DSIMDUTF_TESTS=OFF", "-DSIMDUTF_BENCHMARKS=OFF", "-DSIMDUTF_TOOLS=OFF", }
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  19. table.insert(configs, "-DSIMDUTF_ICONV=" .. (package:config("iconv") and "ON" or "OFF"))
  20. io.replace("CMakeLists.txt", "add_subdirectory(singleheader)", "", {plain = true})
  21. import("package.tools.cmake").install(package, configs)
  22. end)
  23. on_test(function (package)
  24. assert(package:check_cxxsnippets({test = [[
  25. #include <simdutf.h>
  26. void test() {
  27. bool validutf8 = simdutf::validate_utf8("1234", 4);
  28. }
  29. ]]}, {configs = {languages = "c++11"}}))
  30. end)