xmake.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  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.3.1", "298992ec0958979090566c7835ea60c14f5330d6372ee092ef6eee1d2e6ac079")
  8. add_versions("2.4.0", "14624f1dfd966fee85272688064714172ff70e6e304a1e1850f352a07e4c6dc7")
  9. add_versions("2.4.1", "e9359937e7aeb8e5889515c0a9e22cd5da50e9b053038eb092135a0e64888fe7")
  10. add_deps("cmake")
  11. if is_plat("macosx") then
  12. add_extsources("brew::ada-url")
  13. end
  14. on_install("windows", "linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", "cross", function (package)
  15. local configs = {"-DBUILD_TESTING=OFF"}
  16. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  17. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  18. io.replace("CMakeLists.txt", " add_subdirectory(singleheader)", "", {plain = true})
  19. io.replace("CMakeLists.txt", " add_subdirectory(tools)", "", {plain = true})
  20. import("package.tools.cmake").install(package, configs)
  21. end)
  22. on_test(function (package)
  23. assert(package:check_cxxsnippets({test = [[
  24. #include <ada.h>
  25. void test() {
  26. auto url = ada::parse<ada::url_aggregator>("https://xmake.io");
  27. }
  28. ]]}, {configs = {languages = "c++17"}}))
  29. end)