xmake.lua 1.2 KB

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