Ver código fonte

poselib: add package (#4861)

* eigen: support some platform

* poselib: add package

* limit plat

* Update xmake.lua
star9029 1 ano atrás
pai
commit
bbc24db246
2 arquivos alterados com 37 adições e 1 exclusões
  1. 1 1
      packages/e/eigen/xmake.lua
  2. 36 0
      packages/p/poselib/xmake.lua

+ 1 - 1
packages/e/eigen/xmake.lua

@@ -24,7 +24,7 @@ package("eigen")
     add_includedirs("include")
     add_includedirs("include")
     add_includedirs("include/eigen3")
     add_includedirs("include/eigen3")
 
 
-    on_install("macosx", "linux", "windows", "mingw", "cross", function (package)
+    on_install(function (package)
         import("package.tools.cmake").install(package, {"-DBUILD_TESTING=OFF"})
         import("package.tools.cmake").install(package, {"-DBUILD_TESTING=OFF"})
     end)
     end)
 
 

+ 36 - 0
packages/p/poselib/xmake.lua

@@ -0,0 +1,36 @@
+package("poselib")
+    set_homepage("https://github.com/PoseLib/PoseLib")
+    set_description("Minimal solvers for calibrated camera pose estimation")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/PoseLib/PoseLib/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/PoseLib/PoseLib.git")
+
+    add_versions("v2.0.4", "caa0c1c9b882f6e36b5ced6f781406ed97d4c1f0f61aa31345ebe54633d67c16")
+
+    add_deps("cmake")
+    add_deps("eigen")
+
+    on_install("!wasm and (!windows or windows|!arm64)", function (package)
+        io.replace("CMakeLists.txt", "-march=native", "", {plain = true})
+        io.replace("CMakeLists.txt", "-Wall -Werror -fPIC", "", {plain = true})
+
+        local configs = {}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        if package:config("shared") and package:is_plat("windows") then
+            table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                std::vector<Eigen::Vector3d> x1(10, Eigen::Vector3d{});
+                std::vector<Eigen::Vector3d> x2(10, Eigen::Vector3d{});
+                Eigen::Matrix3d h;
+                int res = poselib::homography_4pt(x1, x2, &h);
+            }
+        ]]}, {configs = {languages = "c++17"}, includes = "PoseLib/poselib.h"}))
+    end)