Sfoglia il codice sorgente

tomlc99: add package (#2730)

* tomlc99: add package

* fix build
star9029 1 anno fa
parent
commit
75759c6ab7
2 ha cambiato i file con 60 aggiunte e 0 eliminazioni
  1. 25 0
      packages/t/tomlc99/xmake.lua
  2. 35 0
      packages/t/tomlcpp/xmake.lua

+ 25 - 0
packages/t/tomlc99/xmake.lua

@@ -0,0 +1,25 @@
+package("tomlc99")
+    set_homepage("https://github.com/cktan/tomlc99")
+    set_description("TOML C library")
+    set_license("MIT")
+
+    add_urls("https://github.com/cktan/tomlc99.git")
+    add_versions("2023.09.30", "5221b3d3d66c25a1dc6f0372b4f824f1202fe398")
+
+    on_install(function (package)
+        io.writefile("xmake.lua", [[
+            add_rules("mode.release", "mode.debug")
+            target("tomlc99")
+                set_kind("$(kind)")
+                add_files("toml.c")
+                add_headerfiles("toml.h")
+                if is_plat("windows") and is_kind("shared") then
+                    add_rules("utils.symbols.export_all")
+                end
+        ]])
+        import("package.tools.xmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("toml_parse", {includes = "toml.h"}))
+    end)

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

@@ -0,0 +1,35 @@
+package("tomlcpp")
+    set_homepage("https://github.com/cktan/tomlcpp")
+    set_description("No fanfare TOML C++ Library")
+    set_license("MIT")
+
+    add_urls("https://github.com/cktan/tomlcpp.git")
+    add_versions("2022.06.25", "4212f1fccf530e276a2e1b63d3f99fbfb84e86a4")
+
+    add_deps("tomlc99")
+
+    on_install(function (package)
+        io.writefile("xmake.lua", [[
+            add_requires("tomlc99")
+            set_languages("c++14")
+            add_rules("mode.release", "mode.debug")
+            target("tomlcpp")
+                set_kind("$(kind)")
+                add_files("tomlcpp.cpp")
+                add_headerfiles("tomlcpp.hpp")
+                if is_plat("windows") and is_kind("shared") then
+                    add_rules("utils.symbols.export_all", {export_classes = true})
+                end
+                add_packages("tomlc99")
+        ]])
+        import("package.tools.xmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <tomlcpp.hpp>
+            void test() {
+                auto res = toml::parseFile("sample.toml");
+            }
+        ]]}, {configs = {languages = "c++14"}}))
+    end)