xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("robotstxt")
  2. set_homepage("https://github.com/google/robotstxt")
  3. set_description("The repository contains Google's robots.txt parser and matcher as a C++ librar.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/google/robotstxt.git")
  6. add_versions("2021.11.24", "02bc6cdfa32db50d42563180c42aeb47042b4f0c")
  7. add_deps("abseil")
  8. on_install(function (package)
  9. io.writefile("xmake.lua", [[
  10. add_rules("mode.debug", "mode.release")
  11. add_requires("abseil")
  12. target("librobotstxt")
  13. set_kind("$(kind)")
  14. add_files("robots.cc")
  15. add_packages("abseil")
  16. add_headerfiles("robots.h")
  17. set_languages("c99", "c++17")
  18. if is_plat("windows") and is_kind("shared") then
  19. add_rules("utils.symbols.export_all", {export_classes = true})
  20. end
  21. ]])
  22. import("package.tools.xmake").install(package, {buildir = "xmake_build"})
  23. end)
  24. on_test(function (package)
  25. assert(package:check_cxxsnippets({test = [[
  26. void test() {
  27. googlebot::RobotsMatcher matcher;
  28. std::vector<std::string> user_agents(1, "Chrome");
  29. bool allowed = matcher.AllowedByRobots("robots_content", &user_agents, "url");
  30. }
  31. ]]}, {configs = {languages = "c++17"}, includes = "robots.h"}))
  32. end)