Add mapbox_earcut (#1329)

* Add mapbox_earcut

* try fix patch for mapbox_earcut

* try fix patch for mapbox_earcut

* mapbox earcut.hpp is headeronly library
pull/1332/head
Shiwei Wang 3 years ago committed by GitHub
parent f32c11ffda
commit 2ae1a0f94c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      packages/m/mapbox_earcut/patches/2.2.3/mingw.patch
  2. 31
      packages/m/mapbox_earcut/xmake.lua

@ -0,0 +1,12 @@
diff --git a/include/mapbox/earcut.hpp b/include/mapbox/earcut.hpp
index 01bd7e9..a772dc1 100644
--- a/include/mapbox/earcut.hpp
+++ b/include/mapbox/earcut.hpp
@@ -3,6 +3,7 @@
#include <algorithm>
#include <cassert>
#include <cmath>
+#include <limits>
#include <memory>
#include <vector>

@ -0,0 +1,31 @@
package("mapbox_earcut")
set_kind("library", {headeronly = true})
set_homepage("https://github.com/mapbox/earcut.hpp")
set_description("A C++ port of earcut.js, a fast, header-only polygon triangulation library.")
set_license("ISC")
add_urls("https://github.com/mapbox/earcut.hpp/archive/refs/tags/v$(version).zip",
"https://github.com/mapbox/earcut.hpp.git")
add_versions("2.2.3", "010d2fe35938744960dcc0b25076eb541b07bb314a92afbcab14f7f887ceb98d")
add_patches("2.2.3", path.join(os.scriptdir(), "patches", "2.2.3", "mingw.patch"), "ac6ceb3d494d5a553936f6845c2df41d567614e33e389f47fe1520d6070a30e0")
on_install(function (package)
os.cp("include/mapbox", package:installdir("include"))
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <mapbox/earcut.hpp>
#include <vector>
#include <array>
using N = uint32_t;
using PolyPoint2D = std::array<double, 2>;
void test () {
std::vector<std::vector<PolyPoint2D> > polygons2d;
mapbox::earcut<N>(polygons2d);
}
]]}, {configs = {languages = "c++11"}, includes = "mapbox/earcut.hpp"}))
end)
Loading…
Cancel
Save