Add mapbox_eternal (#1137)

* Add mapbox_eternal

* Fix compilation
pull/1140/head
Jérôme Leclercq 3 years ago committed by GitHub
parent 8aa0f0f329
commit b4591998c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      packages/m/mapbox_eternal/patches/add_cstdint.patch
  2. 38
      packages/m/mapbox_eternal/xmake.lua

@ -0,0 +1,12 @@
diff --git a/include/mapbox/eternal.hpp b/include/mapbox/eternal.hpp
index 10c2f82..ab92ccb 100644
--- a/include/mapbox/eternal.hpp
+++ b/include/mapbox/eternal.hpp
@@ -2,6 +2,7 @@
#include <utility>
#include <functional>
+#include <cstdint>
// GCC 4.9 compatibility
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 5

@ -0,0 +1,38 @@
package("mapbox_eternal")
set_kind("library", {headeronly = true})
set_homepage("https://github.com/mapbox/eternal")
set_description("A C++14 compile-time/constexpr map and hash map with minimal binary footprint")
set_license("ISC")
set_urls("https://github.com/mapbox/eternal/archive/refs/tags/$(version).tar.gz",
"https://github.com/mapbox/eternal.git")
add_versions("v1.0.1", "7d799381b3786d0bd987eea75df2a81f581a64ee962e922a2f7a7d3d0c3d0421")
add_patches("v1.0.1", path.join(os.scriptdir(), "patches", "add_cstdint.patch"), "9a3724ec903fb9d8963ac1d144228f9b5800a102857ea80199b0251f254d89b4")
on_install(function (package)
os.cp("include/mapbox", package:installdir("include"))
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
struct Color
{
unsigned int r, g, b, a;
};
constexpr auto colors = mapbox::eternal::map<mapbox::eternal::string, Color>({
{ "red", { 255, 0, 0, 1 } },
{ "green", { 0, 128, 0, 1 } },
{ "yellow", { 255, 255, 0, 1 } },
{ "white", { 255, 255, 255, 1 } },
{ "black", { 0, 0, 0, 1 } }
});
void test()
{
colors.contains("yellow");
}
]]}, {configs = {languages = "c++14"}, includes = { "mapbox/eternal.hpp"} }))
end)
Loading…
Cancel
Save