Skip to content

Commit

Permalink
minja: add package (#6258)
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing authored Jan 31, 2025
1 parent 40df0b2 commit 754963f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/m/minja/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package("minja")
set_kind("library", {headeronly = true})
set_homepage("https://github.com/google/minja")
set_description("A minimalistic C++ Jinja templating engine for LLM chat templates")
set_license("MIT")

add_urls("https://github.com/google/minja.git")
add_versions("2025.01.31", "76f0d01779aa00b0c68f2117f6cb2c9afc3a0ca8")

add_deps("nlohmann_json")

on_install(function (package)
io.replace("include/minja/minja.hpp", "#include <json.hpp>", "#include <nlohmann/json.hpp>", {plain = true})

os.cp("include", package:installdir())
end)

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
using json = nlohmann::ordered_json;
void test() {
auto tmpl = minja::Parser::parse("Hello, {{ location }}!", /* options= */ {});
auto context = minja::Context::make(minja::Value(json {
{"location", "World"},
}));
auto result = tmpl->render(context);
}
]]}, {configs = {languages = "c++17"}, includes = "minja/minja.hpp"}))
end)

0 comments on commit 754963f

Please sign in to comment.