xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("inja")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://pantor.github.io/inja/")
  4. set_description("A Template Engine for Modern C++")
  5. set_license("MIT")
  6. add_urls("https://github.com/pantor/inja/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/pantor/inja.git")
  8. add_versions("v3.4.0", "7155f944553ca6064b26e88e6cae8b71f8be764832c9c7c6d5998e0d5fd60c55")
  9. add_versions("v2.1.0", "038ecde8f6dbad5d3cedb6ceb0853fd0e488d5dc57593a869633ecb30b0dfa6e")
  10. add_deps("cmake")
  11. add_deps("nlohmann_json", {configs = {cmake = true}})
  12. on_install(function (package)
  13. import("package.tools.cmake").install(package, {
  14. "-DINJA_INSTALL=ON",
  15. "-DINJA_USE_EMBEDDED_JSON=OFF",
  16. "-DBUILD_TESTING=OFF",
  17. "-DBUILD_BENCHMARK=OFF"
  18. })
  19. end)
  20. on_test(function (package)
  21. local cxx_std = "c++17"
  22. if package:version() and package:version():lt("3.4.0") then
  23. cxx_std = "c++11"
  24. end
  25. assert(package:check_cxxsnippets({test = [[
  26. using namespace inja;
  27. using json = nlohmann::json;
  28. void test() {
  29. inja::Environment env;
  30. json data;
  31. data["name"] = "world";
  32. env.render("Hello {{ name }}!", data);
  33. }
  34. ]]}, {configs = {languages = cxx_std}, includes = {"inja/inja.hpp"}}))
  35. end)