From: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date: Sat, 9 Oct 2021 14:27:50 +0200
Subject: Support for PCL-1.12

---
 pcl/pcl_segmentation_180.pxd | 38 +++++++++++++-------------------------
 setup.py                     |  6 +++---
 2 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/pcl/pcl_segmentation_180.pxd b/pcl/pcl_segmentation_180.pxd
index 549a5e3..f85c583 100644
--- a/pcl/pcl_segmentation_180.pxd
+++ b/pcl/pcl_segmentation_180.pxd
@@ -344,35 +344,23 @@ cdef extern from "pcl/segmentation/edge_aware_plane_comparator.h" namespace "pcl
 # /** \brief EuclideanClusterComparator is a comparator used for finding clusters supported by planar surfaces.
 #   * This needs to be run as a second pass after extracting planar surfaces, using MultiPlaneSegmentation for example.
 #   * \author Alex Trevor
-# template<typename PointT, typename PointNT, typename PointLT>
+# template<typename PointT, typename PointLT>
 # class EuclideanClusterComparator: public Comparator<PointT>
 cdef extern from "pcl/segmentation/euclidean_cluster_comparator.h" namespace "pcl":
-    cdef cppclass EuclideanClusterComparator[T, NT, LT](Comparator[T]):
+    cdef cppclass EuclideanClusterComparator[T, LT](Comparator[T]):
         EuclideanClusterComparator()
         # public:
         # typedef typename Comparator<PointT>::PointCloud PointCloud;
         # typedef typename Comparator<PointT>::PointCloudConstPtr PointCloudConstPtr;
-        # typedef typename pcl::PointCloud<PointNT> PointCloudN;
-        # typedef typename PointCloudN::Ptr PointCloudNPtr;
-        # typedef typename PointCloudN::ConstPtr PointCloudNConstPtr;
         # typedef typename pcl::PointCloud<PointLT> PointCloudL;
         # typedef typename PointCloudL::Ptr PointCloudLPtr;
         # typedef typename PointCloudL::ConstPtr PointCloudLConstPtr;
-        # typedef boost::shared_ptr<EuclideanClusterComparator<PointT, PointNT, PointLT> > Ptr;
-        # typedef boost::shared_ptr<const EuclideanClusterComparator<PointT, PointNT, PointLT> > ConstPtr;
+        # typedef boost::shared_ptr<EuclideanClusterComparator<PointT, PointLT> > Ptr;
+        # typedef boost::shared_ptr<const EuclideanClusterComparator<PointT, PointLT> > ConstPtr;
         # using pcl::Comparator<PointT>::input_;
         # 
         # virtual void setInputCloud (const PointCloudConstPtr& cloud)
         
-        # /** \brief Provide a pointer to the input normals.
-        #   * \param[in] normals the input normal cloud
-        # inline void setInputNormals (const PointCloudNConstPtr &normals)
-        void setInputNormals (const shared_ptr[PointCloud[NT]] &normals)
-        
-        # /** \brief Get the input normals. */
-        # inline PointCloudNConstPtr getInputNormals () const
-        const shared_ptr[PointCloud[NT]] getInputNormals ()
-        
         # /** \brief Set the tolerance in radians for difference in normal direction between neighboring points, to be considered part of the same plane.
         #   * \param[in] angular_threshold the tolerance in radians
         # virtual inline void setAngularThreshold (float angular_threshold)
@@ -393,7 +381,7 @@ cdef extern from "pcl/segmentation/euclidean_cluster_comparator.h" namespace "pc
         # /** \brief Set label cloud
         #   * \param[in] labels The label cloud
         # void setLabels (PointCloudLPtr& labels)
-        void setLabels (shared_ptr[PointCloud[LT]] &labels)
+        void setLabels (const shared_ptr[PointCloud[LT]] &labels)
         
         # 
         # /** \brief Set labels in the label cloud to exclude.
@@ -408,14 +396,14 @@ cdef extern from "pcl/segmentation/euclidean_cluster_comparator.h" namespace "pc
         # virtual bool compare (int idx1, int idx2) const
 
 
-ctypedef EuclideanClusterComparator[PointXYZ, Normal, PointXYZ] EuclideanClusterComparator_t
-ctypedef EuclideanClusterComparator[PointXYZI, Normal, PointXYZ] EuclideanClusterComparator_PointXYZI_t
-ctypedef EuclideanClusterComparator[PointXYZRGB, Normal, PointXYZ] EuclideanClusterComparator_PointXYZRGB_t
-ctypedef EuclideanClusterComparator[PointXYZRGBA, Normal, PointXYZ] EuclideanClusterComparator_PointXYZRGBA_t
-ctypedef shared_ptr[EuclideanClusterComparator[PointXYZ, Normal, PointXYZ]] EuclideanClusterComparatorPtr_t
-ctypedef shared_ptr[EuclideanClusterComparator[PointXYZI, Normal, PointXYZ]] EuclideanClusterComparator_PointXYZI_Ptr_t
-ctypedef shared_ptr[EuclideanClusterComparator[PointXYZRGB, Normal, PointXYZ]] EuclideanClusterComparator_PointXYZRGB_Ptr_t
-ctypedef shared_ptr[EuclideanClusterComparator[PointXYZRGBA, Normal, PointXYZ]] EuclideanClusterComparator_PointXYZRGBA_Ptr_t
+ctypedef EuclideanClusterComparator[PointXYZ, PointXYZ] EuclideanClusterComparator_t
+ctypedef EuclideanClusterComparator[PointXYZI, PointXYZ] EuclideanClusterComparator_PointXYZI_t
+ctypedef EuclideanClusterComparator[PointXYZRGB, PointXYZ] EuclideanClusterComparator_PointXYZRGB_t
+ctypedef EuclideanClusterComparator[PointXYZRGBA, PointXYZ] EuclideanClusterComparator_PointXYZRGBA_t
+ctypedef shared_ptr[EuclideanClusterComparator[PointXYZ, PointXYZ]] EuclideanClusterComparatorPtr_t
+ctypedef shared_ptr[EuclideanClusterComparator[PointXYZI, PointXYZ]] EuclideanClusterComparator_PointXYZI_Ptr_t
+ctypedef shared_ptr[EuclideanClusterComparator[PointXYZRGB, PointXYZ]] EuclideanClusterComparator_PointXYZRGB_Ptr_t
+ctypedef shared_ptr[EuclideanClusterComparator[PointXYZRGBA, PointXYZ]] EuclideanClusterComparator_PointXYZRGBA_Ptr_t
 ###
 
 # euclidean_plane_coefficient_comparator.h
diff --git a/setup.py b/setup.py
index 2737368..9c20d1a 100644
--- a/setup.py
+++ b/setup.py
@@ -510,7 +510,7 @@ else:
         os.environ['ARCHFLAGS'] = ''
 
     # Try to find PCL. XXX we should only do this when trying to build or install.
-    PCL_SUPPORTED = ["-1.11", "-1.10", "-1.9", "-1.8", "-1.7", "-1.6", ""]    # in order of preference
+    PCL_SUPPORTED = ["-1.12", "-1.11", "-1.10", "-1.9", "-1.8", "-1.7", "-1.6", ""]    # in order of preference
 
     for pcl_version in PCL_SUPPORTED:
         if subprocess.call(['pkg-config', 'pcl_common%s' % pcl_version]) == 0:
@@ -546,7 +546,7 @@ else:
     # ext_args['include_dirs'].append('/usr/include/vtk')
     # ext_args['include_dirs'].append('/usr/local/include/vtk')
     # pcl 1.7(Ubuntu)
-    ext_args['include_dirs'].append('/usr/include/vtk-7.1')
+    ext_args['include_dirs'].append('/usr/include/vtk-9.0')
     ext_args['library_dirs'].append('/usr/lib')
     # ext_args['libraries'].append('libvtk*.so')
     # pcl 1.8.1(MacOSX)
@@ -617,7 +617,7 @@ else:
                   # debug
                   # gdb_debug=True,
                   ]
-    elif pcl_version == '-1.10' or pcl_version == '-1.11':
+    elif pcl_version == '-1.10' or pcl_version == '-1.11' or pcl_version == '-1.12':
         module = [Extension("pcl._pcl", ["pcl/_pcl_180.pyx", "pcl/minipcl.cpp", "pcl/ProjectInliers.cpp"], language="c++", **ext_args),
                   Extension("pcl.pcl_visualization", ["pcl/pcl_visualization.pyx"], language="c++", extra_compile_args=['-fno-strict-aliasing'], **ext_args),
                   # Extension("pcl.pcl_grabber", ["pcl/pcl_grabber.pyx", "pcl/grabber_callback.cpp"], language="c++", **ext_args),
