xmake.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("idna")
  2. set_homepage("https://github.com/ada-url/idna")
  3. set_description("C++ library implementing the to_ascii and to_unicode functions from the Unicode Technical Standard.")
  4. set_license("Apache-2.0")
  5. set_urls("https://github.com/ada-url/idna/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ada-url/idna.git")
  7. add_versions("0.3.2", "3fffd81d11d5dea6ea0dd5bcd9fa6e9faa6d766ead3e1936229ec47997b90ec9")
  8. add_versions("0.2.0", "fa9aac3611d11ef4c0196d74bfbf5d12b87814b62d70c101e8eb74fb65c636c9")
  9. add_deps("cmake")
  10. if on_check then
  11. on_check(function (package)
  12. assert(package:check_cxxsnippets({test = [[
  13. #include <ranges>
  14. void test() {}
  15. ]]}, {configs = {languages = "c++20"}}), "package(idna) require at least C++20.")
  16. end)
  17. end
  18. on_install(function (package)
  19. io.replace("CMakeLists.txt", "add_subdirectory(singleheader)", "", {plain = true})
  20. local configs = {"-DBUILD_TESTING=OFF", "-DADA_IDNA_BENCHMARKS=OFF"}
  21. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  22. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  23. import("package.tools.cmake").install(package, configs)
  24. end)
  25. on_test(function (package)
  26. assert(package:check_cxxsnippets({test = [[
  27. #include <ada/idna/to_ascii.h>
  28. void test() {
  29. std::string_view input = u8"meßagefactory.ca";
  30. std::string idna_ascii = ada::idna::to_ascii(input);
  31. }
  32. ]]}, {configs = {languages = "c++17"}}))
  33. end)