VS2022编译PCL-1.12.1

需要至少安装一个支持VS2022的CUDA Visual Studio Integration,推荐CUDA 11.6及以上版本
VS2022对应的CUDA lib至少需要10.0版本
CUDA_TOOLKIT_ROOT_DIR 	D:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0
CMAKE_INSTALL_PREFIX 	E:/dev/pcl_1.12.1/install
EIGEN_INCLUDE_DIR 		E:/dev/PCL 1.12.1_pre_build/3rdParty/Eigen/eigen3
FLANN_INCLUDE_DIR 		E:/dev/PCL 1.12.1_pre_build/3rdParty/FLANN/include
FLANN_LIBRARY_STATIC 	E:/dev/PCL 1.12.1_pre_build/3rdParty/FLANN/lib/flann_cpp_s.lib
BOOST_ROOT 				E:/dev/PCL 1.12.1_pre_build/3rdParty/Boost
Boost_INCLUDE_DIR 		E:/dev/PCL 1.12.1_pre_build/3rdParty/Boost/include/boost-1_78
VTK_DIR 				E:/dev/PCL 1.12.1_pre_build/3rdParty/VTK/lib/cmake/vtk-9.1
WITH_QT 				Qt5
Qt5_DIR					E:/dev/Qt5.14.2/5.14.2/msvc2017_64/lib/cmake/Qt5
BUILD_CUDA 				true
BUILD_GPU				true
BUILD_visualization 	true
BUILD_apps 				true
WITH_OPENNI 			true
OPENNI_INCLUDE_DIR 		C:/Program Files/OpenNI/Include
OPENNI_LIBRARY 			C:/Program Files/OpenNI/Lib64/openNI64.lib

OpenNI 1下载地址:
https://code.google.com/archive/p/simple-openni/downloads
OpenNI_NITE_Installer-win32-0.27.zip
OpenNI_NITE_Installer-win64-0.27.zip



严重性	代码	说明	项目	文件	行	禁止显示状态
错误	C3052	“k”: 变量没有出现在 default(none)子句下的 data-sharing 子句中	pcl_common	E:\dev\pcl_1.12.1\common\src\fft\kiss_fft.c	269	

Edit common/src/fft/kiss_fft.c
@@ -260,11 +260,13 @@ void kf_work(
 #if (defined _OPENMP && (_OPENMP <= 201307)) || (defined __GNUC__ && (__GNUC__ >= 6 && __GNUC__ < 9))
 #pragma omp parallel for \
   default(none) \
-  shared(f, factors, Fout, in_stride)
+  shared(f, factors, Fout, in_stride) \
+  private(k)
 #else
 #pragma omp parallel for \
   default(none) \
-  shared(f, factors, Fout, fstride, in_stride, m, p, st)
+  shared(f, factors, Fout, fstride, in_stride, m, p, st) \
+  private(k)
 #endif


严重性	代码	说明	项目	文件	行	禁止显示状态
错误	C1189	error -- unsupported Microsoft Visual Studio version! Only the versions between 2015 and 2019 (inclusive) are supported!	pcl_cuda_features	D:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include\crt\host_config.h	133	

Edit CUDA\v10.0\include\crt\host_config.h
-#if _MSC_VER < 1700 || _MSC_VER >= 1920
+#if _MSC_VER < 1700 //|| _MSC_VER >= 1920


严重性	代码	说明	项目	文件	行	禁止显示状态
错误	C1083	无法打开包括文件: “boost/mpl/assert.hpp”: No such file or directory	pcl_cuda_features	E:\dev\pcl_1.12.1\common\include\pcl\point_struct_traits.h	40	

Add to VC include path:
E:\dev\PCL 1.12.1_pre_build\3rdParty\Boost\include\boost-1_78


严重性	代码	说明	项目	文件	行	禁止显示状态
错误	C1189	#error:  Xiron Platform Abstraction Layer - Win32 - Microsoft Visual Studio versions above 2010 (10.0) are not supported! (编译源文件 E:\dev\pcl_1.12.1\io\src\openni_camera\openni_device.cpp)	pcl_io	C:\Program Files\OpenNI\Include\XnPlatform.h	58	
	//#if _MSC_VER > 1600 // After MSVC8 (2010)
	//	#error Xiron Platform Abstraction Layer - Win32 - Microsoft Visual Studio versions above 2010 (10.0) are not supported!
	//#endif


openni_driver.cpp出现编译错误的代码均可以注释掉


最后有两个项目失败:
pcl_ni_trajkovic
pcl_openni_klt