xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.3", "5afa8194d7a2c5b78e4aa716d386e3a550c785efdd9478c04b7b91d57c945c80")
  8. add_versions("0.3.2", "3fffd81d11d5dea6ea0dd5bcd9fa6e9faa6d766ead3e1936229ec47997b90ec9")
  9. add_versions("0.2.0", "fa9aac3611d11ef4c0196d74bfbf5d12b87814b62d70c101e8eb74fb65c636c9")
  10. add_deps("cmake")
  11. if on_check then
  12. on_check(function (package)
  13. assert(package:check_cxxsnippets({test = [[
  14. #include <ranges>
  15. void test() {}
  16. ]]}, {configs = {languages = "c++20"}}), "package(idna) require at least C++20.")
  17. end)
  18. end
  19. on_install(function (package)
  20. io.replace("CMakeLists.txt", "add_subdirectory(singleheader)", "", {plain = true})
  21. local configs = {"-DBUILD_TESTING=OFF", "-DADA_IDNA_BENCHMARKS=OFF"}
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. #include <ada/idna/to_ascii.h>
  29. void test() {
  30. std::string_view input = u8"meßagefactory.ca";
  31. std::string idna_ascii = ada::idna::to_ascii(input);
  32. }
  33. ]]}, {configs = {languages = "c++17"}}))
  34. end)