소스 검색

add picojson, mio and hashmap (#692)

* add picojson

* add picojson

* add mio

* Update xmake.lua

* improve mio

* fix tests

* Update xmake.lua
ruki 3 년 전
부모
커밋
1999e48a37
3개의 변경된 파일96개의 추가작업 그리고 0개의 파일을 삭제
  1. 29 0
      packages/m/mio/xmake.lua
  2. 38 0
      packages/p/parallel-hashmap/xmake.lua
  3. 29 0
      packages/p/picojson/xmake.lua

+ 29 - 0
packages/m/mio/xmake.lua

@@ -0,0 +1,29 @@
+package("mio")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/mandreyel/mio")
+    set_description("Cross-platform C++11 header-only library for memory mapped file IO")
+    set_license("MIT")
+
+    add_urls("https://github.com/mandreyel/mio.git")
+    add_versions("2021.9.21", "3f86a95c0784d73ce6815237ec33ed25f233b643")
+
+    add_deps("cmake")
+    on_install("linux", "macosx", "bsd", "iphoneos", "android", function (package)
+        import("package.tools.cmake").install(package, {"-Dmio.tests=OFF"})
+    end)
+
+    on_test(function(package)
+        assert(package:check_cxxsnippets({
+            test = [[
+              #include <string>
+              #include <vector>
+              #include <algorithm>
+              #include <mio/mmap.hpp>
+
+              static void test() {
+                mio::mmap_source mmap(0, 0, mio::map_entire_file);
+              }
+            ]]
+        }, {configs = {languages = "c++11"}}))
+    end)

+ 38 - 0
packages/p/parallel-hashmap/xmake.lua

@@ -0,0 +1,38 @@
+package("parallel-hashmap")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://greg7mdp.github.io/parallel-hashmap/")
+    set_description("A family of header-only, very fast and memory-friendly hashmap and btree containers.")
+    set_license("Apache-2.0")
+
+    add_urls("https://github.com/greg7mdp/parallel-hashmap/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/greg7mdp/parallel-hashmap.git")
+    add_versions("1.33", "f6e4d0508c4d935fa25dcbaec63fbe0d7503435797e275ec109e8a3f1462a4cd")
+
+    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 <string>
+              #include <parallel_hashmap/phmap.h>
+
+              using phmap::flat_hash_map;
+              static void test() {
+                flat_hash_map<std::string, std::string> email = {
+                    { "tom",  "[email protected]"},
+                    { "jeff", "[email protected]"},
+                    { "jim",  "[email protected]"}
+                };
+                for (const auto& n : email)
+                    std::cout << n.first << "'s email is: " << n.second << "\n";
+                email["bill"] = "[email protected]";
+                std::cout << "bill's email is: " << email["bill"] << "\n";
+              }
+            ]]
+        }, {configs = {languages = "c++11"}}))
+    end)

+ 29 - 0
packages/p/picojson/xmake.lua

@@ -0,0 +1,29 @@
+package("picojson")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://pocoproject.org/")
+    set_description("A header-file-only, JSON parser serializer in C++")
+    set_license("BSD-2-Clause")
+
+    add_urls("https://github.com/kazuho/picojson/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/kazuho/picojson.git")
+    add_versions("v1.3.0", "056805ca2691798f5545935a14bb477f2e1d827c9fb862e6e449dbea22801c7d")
+
+    on_install(function (package)
+        os.cp("picojson.h", package:installdir("include"))
+    end)
+
+    on_test(function(package)
+        assert(package:check_cxxsnippets({
+            test = [[
+              static void test() {
+                std::string json = "[ \"hello JSON\" ]";
+                picojson::value v;
+                std::string err = picojson::parse(v, json);
+                if (! err.empty()) {
+                  std::cerr << err << std::endl;
+                }
+              }
+            ]]
+        }, {configs = {languages = "c++11"}, includes = {"picojson.h"}}))
+    end)