xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930
  1. package("termcolor")
  2. set_kind("library", { headeronly = true })
  3. set_homepage("https://github.com/ikalnytskyi/termcolor")
  4. set_description("Termcolor is a header-only C++ library for printing colored messages to the terminal. Written just for fun with a help of the Force.")
  5. set_license("BSD-3-Clause")
  6. add_urls("https://github.com/ikalnytskyi/termcolor/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/ikalnytskyi/termcolor.git")
  8. add_versions("v2.1.0", "435994c32557674469404cb1527c283fdcf45746f7df75fd2996bb200d6a759f")
  9. add_deps("cmake")
  10. on_install(function (package)
  11. io.replace("include/termcolor/termcolor.hpp", "#define TERMCOLOR_HPP_", "#define TERMCOLOR_HPP_\n#include <cstdint>", {plain = true})
  12. local configs = {"-DCMAKE_POLICY_DEFAULT_CMP0057=NEW"}
  13. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  14. import("package.tools.cmake").install(package, configs)
  15. end)
  16. on_test(function(package)
  17. assert(package:check_cxxsnippets({ test = [[
  18. void test() {
  19. std::cout << termcolor::red
  20. << "Hello World!"
  21. << termcolor::reset;
  22. }
  23. ]] }, { includes = "termcolor/termcolor.hpp" }))
  24. end)