xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("ada")
  2. set_homepage("https://www.ada-url.com")
  3. set_description("WHATWG-compliant and fast URL parser written in modern C++")
  4. set_license("Apache-2.0")
  5. set_urls("https://github.com/ada-url/ada/archive/refs/tags/v$(version).tar.gz",
  6. "https://github.com/ada-url/ada.git")
  7. add_versions("2.7.8", "8de067b7cb3da1808bf5439279aee6048d761ba246bf8a854c2af73b16b41c75")
  8. add_versions("2.7.7", "7116d86a80b79886efbc9d946d3919801815060ae62daf78de68c508552af554")
  9. add_versions("2.7.6", "e2822783913c50b9f5c0f20b5259130a7bdc36e87aba1cc38a5de461fe45288f")
  10. add_versions("2.3.1", "298992ec0958979090566c7835ea60c14f5330d6372ee092ef6eee1d2e6ac079")
  11. add_versions("2.4.0", "14624f1dfd966fee85272688064714172ff70e6e304a1e1850f352a07e4c6dc7")
  12. add_versions("2.4.1", "e9359937e7aeb8e5889515c0a9e22cd5da50e9b053038eb092135a0e64888fe7")
  13. add_deps("cmake")
  14. if is_plat("macosx") then
  15. add_extsources("brew::ada-url")
  16. end
  17. on_install("windows", "linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", "cross", function (package)
  18. local configs = {"-DBUILD_TESTING=OFF"}
  19. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  20. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  21. io.replace("CMakeLists.txt", "add_subdirectory(singleheader)", "", {plain = true})
  22. io.replace("CMakeLists.txt", "add_subdirectory(tools)", "", {plain = true})
  23. import("package.tools.cmake").install(package, configs)
  24. end)
  25. on_test(function (package)
  26. assert(package:check_cxxsnippets({test = [[
  27. #include <ada.h>
  28. void test() {
  29. auto url = ada::parse<ada::url_aggregator>("https://xmake.io");
  30. }
  31. ]]}, {configs = {languages = "c++17"}}))
  32. end)