Browse Source

taocpp-json: add new package (#7365)

* taocpp-json: new package

* `, {submodules = false})`

* re

* re

* re

* re
Saikari 1 tháng trước cách đây
mục cha
commit
3ab2ae3b85
1 tập tin đã thay đổi với 37 bổ sung0 xóa
  1. 37 0
      packages/t/taocpp-json/xmake.lua

+ 37 - 0
packages/t/taocpp-json/xmake.lua

@@ -0,0 +1,37 @@
+package("taocpp-json")
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/taocpp/json")
+    set_description("C++ header-only JSON library")
+    set_license("MIT")
+
+    add_urls("https://github.com/taocpp/json.git", {submodules = false})
+    add_versions("2025.03.11", "11a31e12eda35c1322f9cf6ebb4cca0653d579dc")
+
+    add_deps("cmake")
+    add_deps("pkgconf")
+    add_deps("pegtl 54a2e32bf4593ed86782b4882702286cc8d621f9")
+
+    on_install(function (package)
+        io.replace("CMakeLists.txt",
+            [[find_package(pegtl ${TAOCPP_JSON_PEGTL_MIN_VERSION} QUIET CONFIG)]], [[include(FindPkgConfig)
+pkg_check_modules(pegtl REQUIRED pegtl)]], {plain = true})
+        io.replace("CMakeLists.txt",
+            [[target_link_libraries(taocpp-json INTERFACE taocpp::pegtl)]],
+            [[target_include_directories(taocpp-json INTERFACE ${pegtl_INCLUDE_DIRS})]], {plain = true})
+        local configs = {
+            "-DTAOCPP_JSON_BUILD_TESTS=OFF",
+            "-DTAOCPP_JSON_BUILD_EXAMPLES=OFF",
+            "-DTAOCPP_JSON_BUILD_PERFORMANCE=OFF",
+            "-DTAOCPP_JSON_INSTALL=ON"
+        }
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <tao/json.hpp>
+            void test() {
+                const tao::json::value v = tao::json::from_file( "filename.json" );
+            }
+        ]]}, {configs = {languages = "c++17"}}))
+    end)