ubuntu 20.04 安装 PCL

ubuntu20.04 自带的 apt 包管理工具可以安装 pcl 1.10. 安装命令如下:

sudo apt install libpcl-dev pcl-tools

其中 libpcl-dev 包含了 PCL 库及其开发文件, pcl-tools 包含了一些操作点云数据的实用工具. 安装完之后会在 /lib/x86_64-linux-gnu/cmake/pcl 下载相关的 cmake 文件. 在 cmake 项目中使用 find_package(PCL Required) 后就可以找到和 PCL 相关的 target 和相关宏定义. 关于定义的内容可以查看 /lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake, 在该文件的开始内容如下:

# ------------------------------------------------------------------------------------
1. Helper to use PCL from outside project
1. 1. target_link_libraries(my_fabulous_target PCL_XXX_LIBRARIES) where XXX is the
1. upper cased xxx from :
1. 
1. - common
1. - kdtree
1. - octree
1. - search
1. - sample_consensus
1. - filters
1. - 2d
1. - geometry
1. - io
1. - features
1. - ml
1. - segmentation
1. - visualization
1. - surface
1. - registration
1. - keypoints
1. ...

这个文件也告诉了我们 pcl 的 cmake 配置文件会生成哪些 target 以及如何使用.

参考资料:

install pcl in ubuntu20.04