xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("cppli")
  2. set_homepage("https://cppli.bearodactyl.dev")
  3. set_description("an intuitive CLI framework for C++")
  4. add_urls("https://github.com/TheBearodactyl/cppli.git")
  5. add_versions("2025.10.22", "98c8c2e8ee65d7a5a6b160cf0b85ba1be39ffb05")
  6. add_patches("2025.10.22", "patches/2025.10.22/fix-clang.patch", "7d7c1363774e4279636455b7cfe4806138a272a03d10f6bfce6dda00b3b17d0d")
  7. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  8. add_deps("cmake")
  9. on_check(function (package)
  10. assert(package:check_cxxsnippets({test = [[
  11. #if !__has_include(<source_location>)
  12. # error source_location is not supported by compiler
  13. #endif
  14. ]]}, {configs = {languages = "c++20"}}), "package(cppli): need std::source_location from <source_location> header.")
  15. end)
  16. on_install(function (package)
  17. local configs = {}
  18. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  19. table.insert(configs, "-DCPPLI_BUILD_TESTS=OFF")
  20. import("package.tools.cmake").install(package, configs)
  21. end)
  22. on_test(function (package)
  23. assert(package:check_cxxsnippets({test = [[
  24. void test() {
  25. cli::Parser parser("myapp", "A test application");
  26. std::string help = parser.generate_help();
  27. }
  28. ]]}, {configs = {languages = "c++20"}, includes = "cppli.hpp"}))
  29. end)