【PCL】vs2022配置PCL环境

vs2022配置PCL环境

  • 前言
  • 一、安装教程
  • 二、路径python脚本


前言

vs2022 配置PCL环境和路径Python脚本


一、安装教程

看这位兄弟写的就行


二、路径python脚本

因为我和他的版本并不一样,一个一个改太麻烦了,所以特此写了个python脚本。请注意要脚本中OpenNI2位置,修改成你的位置即可。

import os 

# 查找给定路径中的PCL依赖库
def dependency(paths):
    # 将输入的路径字符串按分号分割成列表
    data = paths.split(";")
    arr = []
    for path in data:
        # 检查路径是否存在
        if os.path.exists(path):
            # 遍历路径中的所有文件
            for _, _, files in os.walk(path):
                for file in files:
                    # 如果文件以.lib结尾,则添加到列表中
                    if file.endswith(".lib"):
                        arr.append(file)
        else:
            print("路径不存在")
    # 输出找到的PCL依赖库列表
    print("PCL依赖项:")
    print(";".join(arr))

# 获取包含目录
def includes(path):
    data = ['C:\Program Files\OpenNI2\Include']
    for root, dirs, _ in os.walk(path):
        # 计算当前目录的深度
        depth = root.count(os.sep)-path.count(os.sep)
        if depth == 3:
            if "include" in root or "3rdParty" in root:
                # 确保当前目录是以'includes'结尾
                if "include" == root[-7:]:
                    data.append(root)
                if "pcl" == root[-3:]:
                    data.append(root[:-4].replace(path,"$(PCL_ROOT)"))
        # 如果深度大于3,则停止遍历当前目录            
        if depth > 3:
            del dirs[:]
    print("PCL包含目录:")
    print(";".join(data))

def lib(path):
    data = ['C:\Program Files\OpenNI2\Lib']
    for root, dirs,_ in os.walk(path):
        # 计算当前目录的深度
        depth = root.count(os.sep)-path.count(os.sep)
        if depth == 3 or depth < 2:
            if "lib" in root or "3rdParty" in root:
                # 确保当前目录是以'includes'结尾
                if "lib" == root[-3:]:
                    data.append(root)
        # 如果深度大于3,则停止遍历当前目录            
        if depth > 3:
            del dirs[:]
    print("PCL库目录:")
    print(";".join(data))
    dependency(";".join(data))      


# 主程序入口
if __name__ == "__main__":
    print("\r")
    print("查找PCL依赖库")
    print("ver  1.0.0")
    print("\r")
    while True:
        # 用户输入PCL安装路径
        path = input("请输入PCL安装路径\n")
        # 检查输入路径是否存在
        if os.path.exists(path):
            includes(path)
            lib(path)
        key = input("结束请输入quit,继续请随意按键\r\n")
        if key == "quit":
            break
        
        

运行结果:
【PCL】vs2022配置PCL环境_第1张图片

你可能感兴趣的:(点云,python,数据结构,算法)