Jelajahi Sumber

add pcl (#503)

* add pcl

* fix ci on windows-2016

* fix again
Hoildkv 4 tahun lalu
induk
melakukan
6a9a6bb003
2 mengubah file dengan 57 tambahan dan 1 penghapusan
  1. 5 1
      .github/workflows/windows.yml
  2. 52 0
      packages/p/pcl/xmake.lua

+ 5 - 1
.github/workflows/windows.yml

@@ -33,5 +33,9 @@ jobs:
 
       - name: Tests
         run: |
-          xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }} --vs_runtime=${{ matrix.vs_runtime }} --vs_sdkver=10.0.19041.0 --linkjobs=2
+          if ("${{ matrix.os }}" -eq "windows-latest") {
+            xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }} --vs_runtime=${{ matrix.vs_runtime }} --vs_sdkver=10.0.19041.0 --linkjobs=2
+          } else {
+            xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }} --vs_runtime=${{ matrix.vs_runtime }} --linkjobs=2
+          }
 

+ 52 - 0
packages/p/pcl/xmake.lua

@@ -0,0 +1,52 @@
+package("pcl")
+
+    set_homepage("https://pointclouds.org/")
+    set_description("The Point Cloud Library (PCL) is a standalone, large scale, open project for 2D/3D image and point cloud processing.")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/PointCloudLibrary/pcl/archive/refs/tags/pcl-$(version).tar.gz",
+             "https://github.com/PointCloudLibrary/pcl.git")
+    add_versions("1.12.0", "21dfa9a268de9675c1f94d54d9402e4e02120a0aa4215d064436c52b7d5bd48f")
+
+    add_configs("vtk", {description = "Build with vtk.", default = false, type = "boolean"})
+    add_configs("cuda", {description = "Build with cuda.", default = false, type = "boolean"})
+
+    add_deps("cmake")
+    add_deps("boost", {configs = {filesystem = true, serialization = true, date_time = true, iostreams = true, system = true}})
+    add_deps("eigen", "boost", "lz4", "flann", "zlib", "libpng", "qhull", "glew")
+    on_load("windows", "linux", "macosx", function (package)
+        package:add("includedirs", "include/pcl-" .. package:version():major() .. "." .. package:version():minor())
+        if package:config("vtk") then
+            package:add("deps", "vtk")
+        end
+        if package:config("cuda") then
+            package:add("deps", "cuda", {system = true})
+            package:add("deps", "optix", {system = true})
+        end
+    end)
+
+    on_install("windows", "linux", "macosx", function (package)
+        io.replace("CMakeLists.txt", "add_compile_options(/bigobj)", "add_compile_options(/bigobj)\nadd_compile_options(/EHsc)", {plain = true})
+        io.replace("CMakeLists.txt", "find_package%(FLANN 1.- REQUIRED%)", "find_package(flann CONFIG REQUIRED)")
+        io.replace("cmake/pcl_options.cmake", "set(CMAKE_FIND_LIBRARY_SUFFIXES", "#set(CMAKE_FIND_LIBRARY_SUFFIXES", {plain = true})
+
+        local configs = {"-DWITH_OPENGL=OFF", "-DWITH_PCAP=OFF", "-DWITH_QT=OFF", "-DBoost_USE_STATIC_LIBS=ON"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DPCL_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DWITH_VTK=" .. (package:config("vtk") and "ON" or "OFF"))
+        table.insert(configs, "-DWITH_CUDA=" .. (package:config("cuda") and "ON" or "OFF"))
+        if package:is_plat("windows") then
+            table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+        end
+        import("package.tools.cmake").install(package, configs, {packagedeps = {"lz4", "dl"}})
+        package:addenv("PATH", "bin")
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                using PointT = pcl::PointXYZI;
+                pcl::PointCloud<PointT>::Ptr cloud (new pcl::PointCloud<PointT>);
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = {"pcl/point_cloud.h", "pcl/point_types.h"}}))
+    end)