add toml++ (#682)
* add toml++ * improve the code * use .tar.gz * fix style Co-authored-by: ruki <waruqi@gmail.com>pull/683/head
parent
7b1e7e9982
commit
eb4711f89f
1 changed files with 35 additions and 0 deletions
@ -0,0 +1,35 @@ |
||||
package("toml++") |
||||
set_kind("library", {headeronly = true}) |
||||
set_homepage("https://marzer.github.io/tomlplusplus/") |
||||
set_description("toml++ is a header-only TOML config file parser and serializer for C++17 (and later!).") |
||||
|
||||
add_urls("https://github.com/marzer/tomlplusplus/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/marzer/tomlplusplus.git") |
||||
add_versions("v2.5.0", "2e246ee126cfb7bd68edd7285d5bb5c8c5296121ce809306ee71cfd6127c76a6") |
||||
|
||||
add_deps("cmake") |
||||
|
||||
on_install(function (package) |
||||
import("package.tools.cmake").install(package) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <iostream> |
||||
#include <sstream> |
||||
#include <toml++/toml.h> |
||||
using namespace std::string_view_literals; |
||||
|
||||
static void test() { |
||||
static constexpr std::string_view some_toml = R"( |
||||
[library] |
||||
name = "toml++" |
||||
authors = ["Mark Gillard <mark.gillard@outlook.com.au>"] |
||||
cpp = 17 |
||||
)"sv; |
||||
|
||||
toml::table tbl = toml::parse(some_toml); |
||||
std::cout << tbl << "\n"; |
||||
} |
||||
]]}, {configs = {languages = "c++17"}, includes = "toml++/toml.h"})) |
||||
end) |
Loading…
Reference in new issue