xmake.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package("pcl")
  2. set_homepage("https://pointclouds.org/")
  3. set_description("The Point Cloud Library (PCL) is a standalone, large scale, open project for 2D/3D image and point cloud processing.")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/PointCloudLibrary/pcl/archive/refs/tags/pcl-$(version).tar.gz",
  6. "https://github.com/PointCloudLibrary/pcl.git")
  7. add_versions("1.12.0", "21dfa9a268de9675c1f94d54d9402e4e02120a0aa4215d064436c52b7d5bd48f")
  8. add_versions("1.12.1", "dc0ac26f094eafa7b26c3653838494cc0a012bd1bdc1f1b0dc79b16c2de0125a")
  9. add_versions("1.14.0", "de297b929eafcb93747f12f98a196efddf3d55e4edf1b6729018b436d5be594d")
  10. add_versions("1.14.1", "5dc5e09509644f703de9a3fb76d99ab2cc67ef53eaf5637db2c6c8b933b28af6")
  11. add_patches("1.14.1", "patches/1.14.1/octree_poisson.patch", "5423a29bbb3f51bb66dca3bcb7851e037944cc33e62e816a8a8d2d00b0bdc964")
  12. add_patches("1.14.1", "patches/1.14.1/sparse_matrix.patch", "90b20730956104f3ed61fc2d4de156401d0c470257def7ac4e1e2ec0a9456442")
  13. add_patches("1.14.1", "patches/1.14.1/correspondence_rejection_features.patch", "20bc608eb0bd7892a6c5fc34773fd7479021d6f5f2e6f311c17b5fe60ddff6fe")
  14. add_configs("vtk", {description = "Build with vtk.", default = false, type = "boolean"})
  15. add_configs("cuda", {description = "Build with cuda.", default = false, type = "boolean"})
  16. add_deps("cmake")
  17. add_deps("eigen", "lz4", "flann", "zlib", "libpng", "qhull", "glew")
  18. on_load("windows", "linux", "macosx", function (package)
  19. package:add("includedirs", "include/pcl-" .. package:version():major() .. "." .. package:version():minor())
  20. if package:version():le("1.14.1") then
  21. package:add("deps", "boost", {version = "1.85.0", configs = {filesystem = true, serialization = true, date_time = true, iostreams = true, system = true, thread = true, graph = true}})
  22. else
  23. package:add("deps", "boost", {configs = {asio = true, filesystem = true, serialization = true, date_time = true, iostreams = true, system = true, thread = true, graph = true}})
  24. end
  25. if package:config("vtk") then
  26. package:add("deps", "vtk")
  27. end
  28. if package:config("cuda") then
  29. package:add("deps", "cuda", {system = true})
  30. end
  31. end)
  32. on_install("windows", "linux", "macosx", function (package)
  33. io.replace("CMakeLists.txt", "set(CMAKE_CXX_FLAGS_DEFAULT \"/DWIN32 /D_WINDOWS /W3 /GR /EHsc\")", "set(CMAKE_CXX_FLAGS_DEFAULT \" /DWIN32 /D_WINDOWS /W3 /GR /EHsc\")\nstring(APPEND CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_DEFAULT})", {plain = true})
  34. io.replace("cmake/Modules/FindFLANN.cmake", "flann_cpp", "flann")
  35. if package:version():le("1.12.0") then
  36. io.replace("cmake/pcl_options.cmake", "set(CMAKE_FIND_LIBRARY_SUFFIXES", "#set(CMAKE_FIND_LIBRARY_SUFFIXES", {plain = true})
  37. end
  38. local configs = {"-DWITH_OPENGL=OFF", "-DWITH_PCAP=OFF", "-DWITH_QT=OFF", "-DWITH_LIBUSB=OFF", "-DBoost_USE_STATIC_LIBS=ON", "-DPCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES=ON"}
  39. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  40. table.insert(configs, "-DPCL_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  41. table.insert(configs, "-DWITH_VTK=" .. (package:config("vtk") and "ON" or "OFF"))
  42. table.insert(configs, "-DWITH_CUDA=" .. (package:config("cuda") and "ON" or "OFF"))
  43. if package:is_plat("windows") then
  44. table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  45. end
  46. import("package.tools.cmake").install(package, configs, {packagedeps = {"lz4", "dl"}})
  47. package:addenv("PATH", "bin")
  48. end)
  49. on_test(function (package)
  50. assert(package:check_cxxsnippets({test = [[
  51. void test() {
  52. using PointT = pcl::PointXYZI;
  53. pcl::PointCloud<PointT>::Ptr cloud (new pcl::PointCloud<PointT>);
  54. }
  55. ]]}, {configs = {languages = "c++14"}, includes = {"pcl/point_cloud.h", "pcl/point_types.h"}}))
  56. end)