Browse Source

add toml11 (#798)

ruki 3 years ago
parent
commit
d036f536db
2 changed files with 24 additions and 1 deletions
  1. 22 0
      packages/t/toml11/xmake.lua
  2. 2 1
      scripts/new.lua

+ 22 - 0
packages/t/toml11/xmake.lua

@@ -0,0 +1,22 @@
+package("toml11")
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/ToruNiina/toml11")
+    set_description("TOML for Modern C++")
+    set_license("MIT")
+
+    add_urls("https://github.com/ToruNiina/toml11/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/ToruNiina/toml11.git")
+    add_versions("v3.7.0", "a0b6bec77c0e418eea7d270a4437510884f2fe8f61e7ab121729624f04c4b58e")
+
+    add_deps("cmake")
+
+    on_install(function (package)
+        local configs = {}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cxxfuncs("toml::parse(\"\")", {configs = {languages = "c++11"}, includes = "toml.hpp"}))
+    end)

+ 2 - 1
scripts/new.lua

@@ -44,7 +44,8 @@ function _generate_package_from_github(reponame)
             ["apache-2.0"] = "Apache-2.0",
             ["apache-2.0"] = "Apache-2.0",
             ["lgpl-2.0"] = "LGPL-2.0",
             ["lgpl-2.0"] = "LGPL-2.0",
             ["lgpl-2.1"] = "LGPL-2.1",
             ["lgpl-2.1"] = "LGPL-2.1",
-            ["zlib"] = "zlib"
+            zlib = "zlib",
+            mit = "MIT"
         }
         }
         local license = licenses[licensekey]
         local license = licenses[licensekey]
         if license then
         if license then