瀏覽代碼

add sonic-cpp (#2191)

* add sonic-cpp

* Update xmake.lua

* Update xmake.lua

---------

Co-authored-by: cat <[email protected]>
xpxz 2 年之前
父節點
當前提交
7e0d09b88d
共有 1 個文件被更改,包括 34 次插入0 次删除
  1. 34 0
      packages/s/sonic-cpp/xmake.lua

+ 34 - 0
packages/s/sonic-cpp/xmake.lua

@@ -0,0 +1,34 @@
+package("sonic-cpp")
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/bytedance/sonic-cpp")
+    set_description("A fast JSON serializing & deserializing library, accelerated by SIMD.")
+    set_license("Apache-2.0")
+
+    add_urls("https://github.com/bytedance/sonic-cpp/archive/refs/tags/v$(version).zip")
+    add_versions("1.0.0", "409441bfc8b8b9fea8641dc0a0cdfaeed784246066a5c49fc7d6e74c39999f7b")
+
+    add_cxxflags("-march=haswell")
+
+    on_install("linux", function (package)
+        os.cp("include", package:installdir())
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include "sonic/sonic.h"
+            #include <string>
+
+            void test()
+            {
+                std::string json = R"(
+                    {
+                    "a": 1,
+                    "b": 2
+                    }
+                )";
+
+                sonic_json::Document doc;
+                doc.Parse(json);
+            }
+        ]]}, {configs = {languages = "c++11"}}))
+    end)