From 1999e48a373c99c87ae9e70696e9010416aee7d2 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 14 Nov 2021 16:12:14 +0800 Subject: [PATCH] add picojson, mio and hashmap (#692) * add picojson * add picojson * add mio * Update xmake.lua * improve mio * fix tests * Update xmake.lua --- packages/m/mio/xmake.lua | 29 ++++++++++++++++++++ packages/p/parallel-hashmap/xmake.lua | 38 +++++++++++++++++++++++++++ packages/p/picojson/xmake.lua | 29 ++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 packages/m/mio/xmake.lua create mode 100644 packages/p/parallel-hashmap/xmake.lua create mode 100644 packages/p/picojson/xmake.lua diff --git a/packages/m/mio/xmake.lua b/packages/m/mio/xmake.lua new file mode 100644 index 000000000..ed8c35295 --- /dev/null +++ b/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 + #include + #include + #include + + static void test() { + mio::mmap_source mmap(0, 0, mio::map_entire_file); + } + ]] + }, {configs = {languages = "c++11"}})) + end) diff --git a/packages/p/parallel-hashmap/xmake.lua b/packages/p/parallel-hashmap/xmake.lua new file mode 100644 index 000000000..c190e2037 --- /dev/null +++ b/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 + #include + #include + + using phmap::flat_hash_map; + static void test() { + flat_hash_map email = { + { "tom", "tom@gmail.com"}, + { "jeff", "jk@gmail.com"}, + { "jim", "jimg@microsoft.com"} + }; + for (const auto& n : email) + std::cout << n.first << "'s email is: " << n.second << "\n"; + email["bill"] = "bg@whatever.com"; + std::cout << "bill's email is: " << email["bill"] << "\n"; + } + ]] + }, {configs = {languages = "c++11"}})) + end) diff --git a/packages/p/picojson/xmake.lua b/packages/p/picojson/xmake.lua new file mode 100644 index 000000000..3a530af86 --- /dev/null +++ b/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)