198 lines
6.1 KiB
Markdown
198 lines
6.1 KiB
Markdown
|
|
# Utils 模块重构总结
|
|||
|
|
|
|||
|
|
## 修改概述
|
|||
|
|
|
|||
|
|
已成功将 Utils 目录设置为独立的 git 仓库,并更新了主项目中所有对 VrCommon、VrUtils 和 CloudUtils 的引用。
|
|||
|
|
|
|||
|
|
## 主要修改内容
|
|||
|
|
|
|||
|
|
### 1. Utils 目录结构
|
|||
|
|
|
|||
|
|
创建了独立的 Utils 模块,包含以下子模块:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
Utils/
|
|||
|
|
├── VrCommon/ # 核心接口和数据结构
|
|||
|
|
├── VrUtils/ # 工具类库(JSON、log4cpp、tinyxml2、INI、MD5、CRC)
|
|||
|
|
├── CloudUtils/ # 点云工具
|
|||
|
|
├── DataUtils/ # 数据处理工具
|
|||
|
|
│ ├── CloudMathClac/ # 点云数学计算
|
|||
|
|
│ └── CoordinateTransform/ # 坐标转换
|
|||
|
|
└── CloudView/ # 点云查看工具
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 2. 创建的新文件
|
|||
|
|
|
|||
|
|
- `Utils/Utils.pro` - Utils 模块主项目文件
|
|||
|
|
- `Utils/README.md` - Utils 模块说明文档
|
|||
|
|
- `Utils/.gitignore` - Git 忽略文件配置
|
|||
|
|
|
|||
|
|
### 3. 修改的 .pro 文件
|
|||
|
|
|
|||
|
|
#### 主项目
|
|||
|
|
- `GrabBagPrj/GrabBagPrj.pro` - 将 VrCommon 和 VrUtils 的引用改为 Utils 模块
|
|||
|
|
|
|||
|
|
#### Utils 内部模块
|
|||
|
|
- `Utils/VrCommon/VrCommon.pro` - 添加 VrConfigCmd.h 头文件
|
|||
|
|
- `Utils/VrUtils/VrUtils.pro` - 保持不变
|
|||
|
|
- `Utils/CloudUtils/CloudUtils.pro` - 更新 INCLUDEPATH 为相对路径
|
|||
|
|
- `Utils/CloudView/CloudView.pro` - 更新 INCLUDEPATH 和 LIBS 路径
|
|||
|
|
- `Utils/DataUtils/CloudMathClac/CloudMathClac.pro` - 更新 SDK 路径
|
|||
|
|
- `Utils/DataUtils/CoordinateTransform/CoordinateTransform.pro` - 更新 SDK 路径
|
|||
|
|
|
|||
|
|
#### VrNets 模块
|
|||
|
|
- `VrNets/VrTcpClient.pro` - 更新 INCLUDEPATH 和 LIBS 路径
|
|||
|
|
- `VrNets/VrTcpServer.pro` - 更新 INCLUDEPATH 和 LIBS 路径
|
|||
|
|
|
|||
|
|
#### Module 模块
|
|||
|
|
- `Module/ShareMem/ShareMem.pro` - 更新 INCLUDEPATH
|
|||
|
|
- `Module/ThreadPool/ThreadPool.pro` - 更新 INCLUDEPATH(修正错误路径)
|
|||
|
|
- `Module/ModbusTCPServer/ModbusTCPServer.pro` - 更新 INCLUDEPATH 和 LIBS
|
|||
|
|
- `Module/BinocularMarkReceiver/BinocularMarkReceiver.pro` - 更新 INCLUDEPATH 和 LIBS
|
|||
|
|
- `Module/HandEyeCalib/HandEyeCalib.pro` - 更新 INCLUDEPATH
|
|||
|
|
- `Module/ChessboardDetector/ChessboardDetector.pro` - 更新 INCLUDEPATH
|
|||
|
|
- `Module/AuthModule/AuthModule.pro` - 更新 INCLUDEPATH
|
|||
|
|
|
|||
|
|
#### Device 模块
|
|||
|
|
- `Device/VrEyeDevice/VrEyeDevice.pro` - 更新 INCLUDEPATH 和 LIBS
|
|||
|
|
- `Device/HikDevice/HikDevice.pro` - 更新 INCLUDEPATH 和 LIBS
|
|||
|
|
- `Device/GalaxyDevice/GalaxyDevice.pro` - 更新 INCLUDEPATH 和 LIBS
|
|||
|
|
- `Device/GlLineLaserDevice/GlLineLaserDevice.pro` - 更新 INCLUDEPATH 和 LIBS
|
|||
|
|
- `Device/EpicEyeDevice/EpicEyeDevice.pro` - 更新 INCLUDEPATH
|
|||
|
|
|
|||
|
|
#### AppUtils 模块
|
|||
|
|
- `AppUtils/AppCommon/AppCommon.pro` - 更新 INCLUDEPATH 和 LIBS
|
|||
|
|
- `AppUtils/UICommon/UICommon.pro` - 更新 INCLUDEPATH
|
|||
|
|
|
|||
|
|
#### Tools 模块
|
|||
|
|
- `Tools/AuthRegister/AuthRegister.pro` - 更新 LIBS
|
|||
|
|
- `Tools/ConfigDecryptor/ConfigDecryptor.pro` - 更新 INCLUDEPATH 和 LIBS
|
|||
|
|
- `Tools/CalibView/CalibView.pro` - 更新 INCLUDEPATH 和 LIBS
|
|||
|
|
- `Tools/VrEyeView/VrEyeView.pro` - 更新 INCLUDEPATH 和 LIBS
|
|||
|
|
|
|||
|
|
#### App 模块(批量更新)
|
|||
|
|
批量更新了 App 目录下所有应用程序的 .pro 文件(约 27 个文件),包括:
|
|||
|
|
- GrabBag
|
|||
|
|
- BeltTearing
|
|||
|
|
- LapWeld
|
|||
|
|
- Workpiece
|
|||
|
|
- WorkpieceProject
|
|||
|
|
- BinocularMark
|
|||
|
|
- BagThreadPosition
|
|||
|
|
- ParticleSize
|
|||
|
|
- ScrewPosition
|
|||
|
|
- TunnelChannel
|
|||
|
|
- WheelMeasure
|
|||
|
|
- WorkpieceHole
|
|||
|
|
|
|||
|
|
#### Test 模块
|
|||
|
|
- `Test/tcpclient/tcpclient_test.pro` - 更新路径
|
|||
|
|
- `Test/tcpserver/tcpserver_test.pro` - 更新路径
|
|||
|
|
|
|||
|
|
### 4. 路径替换规则
|
|||
|
|
|
|||
|
|
所有 .pro 文件中的路径按以下规则进行了替换:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
旧路径 新路径
|
|||
|
|
../../VrCommon/Inc -> ../../Utils/VrCommon/Inc
|
|||
|
|
../../VrUtils/Inc -> ../../Utils/VrUtils/Inc
|
|||
|
|
../../VrCommon/release -> ../../Utils/VrCommon/release
|
|||
|
|
../../VrCommon/debug -> ../../Utils/VrCommon/debug
|
|||
|
|
../../VrUtils/release -> ../../Utils/VrUtils/release
|
|||
|
|
../../VrUtils/debug -> ../../Utils/VrUtils/debug
|
|||
|
|
../../AppUtils/CloudUtils -> ../../Utils/CloudUtils
|
|||
|
|
|
|||
|
|
../../../VrCommon/Inc -> ../../../Utils/VrCommon/Inc
|
|||
|
|
../../../VrUtils/Inc -> ../../../Utils/VrUtils/Inc
|
|||
|
|
../../../VrCommon/release -> ../../../Utils/VrCommon/release
|
|||
|
|
../../../VrCommon/debug -> ../../../Utils/VrCommon/debug
|
|||
|
|
../../../VrUtils/release -> ../../../Utils/VrUtils/release
|
|||
|
|
../../../VrUtils/debug -> ../../../Utils/VrUtils/debug
|
|||
|
|
../../../AppUtils/CloudUtils -> ../../../Utils/CloudUtils
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 5. Git 仓库初始化
|
|||
|
|
|
|||
|
|
已在 Utils 目录下初始化 git 仓库:
|
|||
|
|
```bash
|
|||
|
|
cd Utils
|
|||
|
|
git init
|
|||
|
|
git add .
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
所有文件已添加到暂存区,等待提交。
|
|||
|
|
|
|||
|
|
## 依赖关系
|
|||
|
|
|
|||
|
|
更新后的依赖关系:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
主项目 (GrabBagPrj)
|
|||
|
|
└── Utils
|
|||
|
|
├── VrCommon
|
|||
|
|
├── VrUtils (依赖 VrCommon)
|
|||
|
|
├── CloudUtils (依赖 VrCommon, VrUtils)
|
|||
|
|
├── DataUtils (依赖 VrCommon)
|
|||
|
|
└── CloudView (依赖 VrCommon, VrUtils, CloudUtils)
|
|||
|
|
└── VrNets (依赖 Utils)
|
|||
|
|
└── Module (依赖 Utils)
|
|||
|
|
└── Device (依赖 Utils)
|
|||
|
|
└── AppUtils (依赖 Utils)
|
|||
|
|
└── App (依赖 Utils, VrNets, Module, Device, AppUtils)
|
|||
|
|
└── Tools (依赖 Utils, Module, Robot)
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 下一步操作
|
|||
|
|
|
|||
|
|
1. 在 Utils 目录下提交初始版本:
|
|||
|
|
```bash
|
|||
|
|
cd Utils
|
|||
|
|
git commit -m "初始提交:Utils 工具库模块"
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
2. 如果需要推送到远程仓库:
|
|||
|
|
```bash
|
|||
|
|
git remote add origin <远程仓库地址>
|
|||
|
|
git push -u origin master
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
3. 在主项目中,可以将 Utils 作为 git submodule 引用:
|
|||
|
|
```bash
|
|||
|
|
cd ..
|
|||
|
|
git submodule add <Utils仓库地址> Utils
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 验证构建
|
|||
|
|
|
|||
|
|
建议执行以下步骤验证构建:
|
|||
|
|
|
|||
|
|
1. 清理旧的构建产物:
|
|||
|
|
```bash
|
|||
|
|
cd GrabBagPrj
|
|||
|
|
make clean
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
2. 重新生成 Makefile:
|
|||
|
|
```bash
|
|||
|
|
qmake GrabBagPrj.pro
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
3. 编译项目:
|
|||
|
|
```bash
|
|||
|
|
make
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 注意事项
|
|||
|
|
|
|||
|
|
1. 所有路径更新已完成,但建议在实际编译前进行测试
|
|||
|
|
2. Utils 模块现在是独立的,可以被其他项目引用
|
|||
|
|
3. 如果需要修改 Utils 模块,应该在 Utils 目录下进行 git 操作
|
|||
|
|
4. 主项目的 .gitignore 应该排除 Utils 目录(如果使用 submodule)
|
|||
|
|
|
|||
|
|
## 文件统计
|
|||
|
|
|
|||
|
|
- 修改的 .pro 文件:约 60+ 个
|
|||
|
|
- 新建的文件:3 个(Utils.pro, README.md, .gitignore)
|
|||
|
|
- Utils 模块包含的文件:约 230+ 个
|