Bläddra i källkod

add pmp, vcglib and rply (#349)

* add pmp, vcglib and rply

* fix glfw

* use packagedeps

* add libxext dep
Hoildkv 4 år sedan
förälder
incheckning
a96da42009

+ 6 - 14
packages/g/glfw/xmake.lua

@@ -19,7 +19,7 @@ package("glfw")
         add_syslinks("gdi32")
     elseif is_plat("linux") then
         -- TODO: add wayland support
-        add_deps("libx11", "libxrandr", "libxrender", "libxinerama", "libxcursor", "libxi", "libxext")
+        add_deps("libx11", "libxrandr", "libxrender", "libxinerama", "libxfixes", "libxcursor", "libxi", "libxext")
         add_syslinks("dl", "pthread")
         add_defines("_GLFW_X11")
     end
@@ -33,20 +33,12 @@ package("glfw")
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         if package:is_plat("windows") then
             table.insert(configs, "-DUSE_MSVC_RUNTIME_LIBRARY_DLL=" .. (package:config("vs_runtime"):startswith("MT") and "OFF" or "ON"))
-        elseif package:is_plat("linux") then
-            -- patch missing libxrender/includes
-            local cflags = {}
-            local fetchinfo = package:dep("libxrender"):fetch()
-            if fetchinfo then
-                for _, includedir in ipairs(fetchinfo.includedirs) do
-                    table.insert(cflags, "-I" .. includedir)
-                end
-            end
-            if #cflags > 0 then
-                table.insert(configs, "-DCMAKE_C_FLAGS=" .. table.concat(cflags, " "))
-            end
         end
-        import("package.tools.cmake").install(package, configs)
+        if package:is_plat("linux") then
+            import("package.tools.cmake").install(package, configs, {packagedeps = {"libxrender", "libxfixes", "libxext"}})
+        else
+            import("package.tools.cmake").install(package, configs)
+        end
     end)
 
     on_test(function (package)

+ 3 - 2
packages/l/libigl/xmake.lua

@@ -3,9 +3,10 @@ package("libigl")
     set_homepage("https://libigl.github.io/")
     set_description("Simple C++ geometry processing library.")
 
-    add_urls("https://github.com/libigl/libigl/archive/v$(version).tar.gz",
+    add_urls("https://github.com/libigl/libigl/archive/$(version).tar.gz",
              "https://github.com/libigl/libigl.git")
-    add_versions("2.2.0", "b336e548d718536956e2d6958a0624bc76d50be99039454072ecdc5cf1b2ede5")
+    add_versions("v2.2.0", "b336e548d718536956e2d6958a0624bc76d50be99039454072ecdc5cf1b2ede5")
+    add_versions("v2.3.0", "9d6de3bdb9c1cfc61a0a0616fd96d14ef8465995600328c196fa672ee4579b70")
 
     add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"})
     add_configs("use_cgal", {description = "Use CGAL library.", default = false, type = "boolean"})

+ 45 - 0
packages/p/pmp/port/xmake.lua

@@ -0,0 +1,45 @@
+add_rules("mode.debug", "mode.release")
+add_requires("eigen", "glfw", "glew", "rply")
+option("utils")
+    set_default(false)
+    set_showmenu(true)
+option_end()
+target("pmp")
+    set_kind("static")
+    set_languages("c++11")
+    add_files("src/pmp/*.cpp")
+    add_files("src/pmp/algorithms/*.cpp")
+    add_defines("_USE_MATH_DEFINES", {public = true})
+    add_packages("eigen", {public = true})
+    add_packages("rply")
+    add_includedirs("src", {public = true})
+    add_headerfiles("src/(pmp/*.h)")
+    add_headerfiles("src/(pmp/algorithms/*.h)")
+target_end()
+target("pmp_vis")
+    set_kind("static")
+    set_languages("c++11")
+    add_deps("pmp")
+    add_packages("glew", "glfw", {public = true})
+    add_includedirs("external/imgui", {public = true})
+    add_files("external/imgui/*.cpp")
+    add_includedirs("external/stb_image", {public = true})
+    add_files("external/stb_image/*.cpp")
+    add_files("src/pmp/visualization/*.cpp")
+    add_headerfiles("src/(pmp/visualization/*.h)")
+target_end()
+if has_config("utils") then
+
+local apps = {"mview", "curview", "subdiv", "smoothing", "fairing", "parameterization", "decimation", "remeshing", "mpview"}
+if not is_plat("windows") then table.insert(apps, "mconvert") end
+for _, app in ipairs(apps) do
+target(app)
+    set_kind("binary")
+    set_languages("c++11")
+    add_deps("pmp_vis")
+    add_files("src/apps/" .. app .. ".cpp")
+    if app == "mpview" then add_files("src/apps/MeshProcessingViewer.cpp") end
+target_end()
+end
+
+end

+ 39 - 0
packages/p/pmp/xmake.lua

@@ -0,0 +1,39 @@
+package("pmp")
+
+    set_homepage("http://www.pmp-library.org/")
+    set_description("The Polygon Mesh Processing Library")
+    set_license("MIT")
+
+    add_urls("https://github.com/pmp-library/pmp-library/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/pmp-library/pmp-library.git")
+    add_versions("1.2.1", "4c9e6554a986710cec1e19dd67695d8ae65ce02a19100dcf1ba7e17f2f993e3b")
+
+    add_configs("utils", {description = "Build utilities.", default = false, type = "boolean"})
+
+    add_deps("cmake")
+    add_deps("eigen", "glfw", "glew", "rply")
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {}
+        if package:is_plat("linux") and package:config("pic") ~= false then
+            configs.cxflags = "-fPIC"
+        end
+        configs.utils = package:config("utils")
+        os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
+        import("package.tools.xmake").install(package, configs)
+        if package:config("utils") then
+            package:addenv("PATH", "bin")
+        end
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                pmp::SurfaceMesh mesh;
+                pmp::Vertex v0, v1, v2, v3;
+                v0 = mesh.add_vertex(pmp::Point(0, 0, 0));
+                v1 = mesh.add_vertex(pmp::Point(1, 0, 0));
+                v2 = mesh.add_vertex(pmp::Point(0, 1, 0));
+                v3 = mesh.add_vertex(pmp::Point(0, 0, 1));
+            }
+        ]]}, {configs = {languages = "c++11"}, includes = "pmp/SurfaceMesh.h"}))
+    end)

+ 29 - 0
packages/r/rply/xmake.lua

@@ -0,0 +1,29 @@
+package("rply")
+
+    set_homepage("http://w3.impa.br/~diego/software/rply/")
+    set_description("RPly is a library that lets applications read and write PLY files.")
+    set_license("MIT")
+
+    add_urls("http://w3.impa.br/~diego/software/rply/rply-$(version).tar.gz")
+    add_versions("1.1.4", "daf0b060fe701adf72aab0d525323d2e2e1bde9aa6aa9713ff1a5ef1e768d703")
+
+    on_install(function (package)
+        io.writefile("xmake.lua", [[
+            add_rules("mode.debug", "mode.release")
+            target("rply")
+                set_kind("$(kind)")
+                add_files("rply.c")
+                add_headerfiles("rply.h", "rplyfile.h")
+        ]])
+        local configs = {kind = "static"}
+        if package:config("shared") then
+            configs.kind = "shared"
+        elseif package:is_plat("linux") and package:config("pic") ~= false then
+            configs.cxflags = "-fPIC"
+        end
+        import("package.tools.xmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("ply_create", {includes = "rply.h"}))
+    end)

+ 21 - 0
packages/v/vcglib/xmake.lua

@@ -0,0 +1,21 @@
+package("vcglib")
+
+    set_homepage("http://www.vcglib.net/")
+    set_description("The Visualization and Computer Graphics Library (VCG for short) is a open source portable C++ templated library for manipulation, processing and displaying with OpenGL of triangle and tetrahedral meshes.")
+    set_license("GPL-3.0")
+
+    add_urls("https://github.com/cnr-isti-vclab/vcglib/archive/refs/tags/2020.12.tar.gz")
+    add_versions("2020.12", "731c57435e39c4b958a1d766cadd9865d9db35e36410708f2da7818e9fa5f786")
+
+    add_deps("eigen")
+    on_install("windows", "macosx", "linux", function (package)
+        os.mv("vcg", package:installdir("include"))
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                vcg::Quaternionf q(1, 0, 0, 0);
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = "vcg/math/quaternion.h"}))
+    end)