Bläddra i källkod

add toml++ (#682)

* add toml++

* improve the code

* use .tar.gz

* fix style

Co-authored-by: ruki <[email protected]>
马曜峥行 3 år sedan
förälder
incheckning
eb4711f89f
1 ändrade filer med 35 tillägg och 0 borttagningar
  1. 35 0
      packages/t/toml++/xmake.lua

+ 35 - 0
packages/t/toml++/xmake.lua

@@ -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 <[email protected]>"]
+                    cpp = 17
+                )"sv;
+
+                toml::table tbl = toml::parse(some_toml);
+                std::cout << tbl << "\n";
+            }
+        ]]}, {configs = {languages = "c++17"}, includes = "toml++/toml.h"}))
+    end)