xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930
  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.2.0", "fa9aac3611d11ef4c0196d74bfbf5d12b87814b62d70c101e8eb74fb65c636c9")
  8. add_deps("cmake")
  9. on_install(function (package)
  10. io.replace("CMakeLists.txt", "add_subdirectory(singleheader)", "", {plain = true})
  11. local configs = {"-DBUILD_TESTING=OFF", "-DADA_IDNA_BENCHMARKS=OFF"}
  12. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  13. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  14. import("package.tools.cmake").install(package, configs)
  15. end)
  16. on_test(function (package)
  17. assert(package:check_cxxsnippets({test = [[
  18. #include <ada/idna/to_ascii.h>
  19. void test() {
  20. std::string_view input = u8"meßagefactory.ca";
  21. std::string idna_ascii = ada::idna::to_ascii(input);
  22. }
  23. ]]}, {configs = {languages = "c++17"}}))
  24. end)