Browse Source

libnest2d & polyclipping: add packages (#4440)

* libnest2d & polyclipping: add packages

* libnest2d: use boost instead

* libnest2d: copy limits from boost

* libnest2d: copy limits from nlopt

* libnest2d: use cxx14

* libnest2d: use boost 1.72.0

* libnest2d: try with boost geometry

* libnest2d: use cxx14

* libnest2d: set test cxx to 14
Chi Huu Huynh 1 year ago
parent
commit
c0f61ec2cb

+ 15 - 0
packages/l/libnest2d/port/xmake.lua

@@ -0,0 +1,15 @@
+add_rules("mode.debug", "mode.release")
+
+add_requires("nlopt", "polyclipping", "boost")
+
+target("libnest2d")
+    set_kind("$(kind)")
+    set_languages("cxx14")
+    add_packages("nlopt", "polyclipping", "boost")
+
+    add_files("src/*.cpp")
+    add_headerfiles("include/(**.hpp)")
+
+    add_defines("LIBNEST2D_GEOMETRIES_clipper", "LIBNEST2D_OPTIMIZER_nlopt")
+
+    add_includedirs("include", {public = true})

+ 31 - 0
packages/l/libnest2d/xmake.lua

@@ -0,0 +1,31 @@
+package("libnest2d")
+    set_homepage("https://github.com/tamasmeszaros/libnest2d")
+    set_description("2D irregular bin packaging and nesting library written in modern C++")
+    set_license("LGPL-3.0")
+
+    add_urls("https://github.com/tamasmeszaros/libnest2d.git")
+    add_versions("2022.11.16", "663daa69e1d7478669f714218e27681edbc96640")
+
+    add_deps("nlopt", "polyclipping", "boost")
+
+    on_load(function (package)
+        package:add("defines", "LIBNEST2D_GEOMETRIES_clipper")
+        package:add("defines", "LIBNEST2D_OPTIMIZER_nlopt")
+    end)
+
+    on_install("linux", "windows", "macosx", function (package)
+        os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
+        local configs = {}
+        import("package.tools.xmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <libnest2d/libnest2d.hpp>
+
+            void test() {
+                using namespace libnest2d;
+                Degrees deg(180);
+            }
+        ]]}, {configs = {languages = "cxx14"}}))
+    end)

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

@@ -0,0 +1,29 @@
+package("polyclipping")
+    set_homepage("https://sourceforge.net/projects/polyclipping")
+    set_description("Polygon and line clipping and offsetting library")
+    set_license("BSL-1.0")
+
+    add_urls("https://sourceforge.net/projects/polyclipping/files/clipper_ver$(version).zip")
+    add_versions("6.4.2", "a14320d82194807c4480ce59c98aa71cd4175a5156645c4e2b3edd330b930627")
+
+    on_install(function (package)
+        local configs = {}
+        io.writefile("xmake.lua", [[
+            add_rules("mode.release", "mode.debug")
+            target("polyclipping")
+                set_kind("$(kind)")
+                set_languages("cxx11")
+                add_files("cpp/*.cpp")
+                add_headerfiles("cpp/(*.hpp)")
+        ]])
+        import("package.tools.xmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <clipper.hpp>
+            void test() {
+                ClipperLib::Clipper clipper;
+            }
+        ]]}, {configs = {languages = "cxx11"}}))
+    end)