Skip to content

Commit f5d4cc3

Browse files
authored
Merge pull request #14 from zz990099/develop_refactor_project
Refactor project structure & Format files.
2 parents 7c64c73 + 992e126 commit f5d4cc3

File tree

66 files changed

+2248
-5347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2248
-5347
lines changed

.clang-format

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#基础样式
2+
BasedOnStyle: Google
3+
# 指针和引用的对齐: Left, Right, Middle
4+
DerivePointerAlignment: false
5+
PointerAlignment: Right
6+
#访问修饰符前的空格
7+
AccessModifierOffset: -2
8+
# 缩进宽度
9+
IndentWidth: 2
10+
# 连续的空行保留几行
11+
MaxEmptyLinesToKeep: 1
12+
# 圆括号的换行方式
13+
BreakBeforeBraces: Custom
14+
# 是否允许短方法单行
15+
AllowShortFunctionsOnASingleLine: false
16+
# 支持一行的if
17+
AllowShortIfStatementsOnASingleLine: false
18+
# 在未封闭(括号的开始和结束不在同一行)的括号中的代码是否对齐
19+
AlignAfterOpenBracket: Align
20+
# switch的case缩进
21+
IndentCaseLabels: true
22+
# 每行字符的长度
23+
ColumnLimit: 100
24+
# 注释对齐,true将左对齐,false不会对齐
25+
AlignTrailingComments: true
26+
# C cast括号后加空格
27+
SpaceAfterCStyleCast: false
28+
# 换行的时候对齐操作符
29+
AlignOperands: true
30+
# 中括号两边空格 []
31+
SpacesInSquareBrackets: false
32+
# 多行声明语句按照=对齐
33+
AlignConsecutiveDeclarations: true
34+
# 连续赋值时,对齐所有等号
35+
AlignConsecutiveAssignments: true
36+
# 容器类的空格 例如 OC的字典
37+
SpacesInContainerLiterals: false
38+
# 在构造函数初始化时按逗号断行,并以冒号对齐
39+
BreakConstructorInitializersBeforeComma: false
40+
# 函数参数换行
41+
AllowAllParametersOfDeclarationOnNextLine: true
42+
#在续行(#下一行)时的缩进长度
43+
ContinuationIndentWidth: 4
44+
# tab键盘的宽度
45+
TabWidth: 4
46+
# 赋值运算符前加空格
47+
SpaceBeforeAssignmentOperators: true
48+
# 行尾的注释前加1个空格
49+
SpacesBeforeTrailingComments: 1
50+
# false表示所有形参要么都在同一行,要么都各自一行
51+
BinPackParameters: false
52+
# 头文件排序
53+
SortIncludes: false
54+
55+
# 大括号换行,只有当BreakBeforeBraces设置为Custom时才有效
56+
BraceWrapping:
57+
# class定义后面
58+
AfterClass: false
59+
# 控制语句后面
60+
AfterControlStatement: true
61+
# enum定义后面
62+
AfterEnum: false
63+
# 函数定义后面
64+
AfterFunction: true
65+
# 命名空间定义后面
66+
AfterNamespace: false
67+
# struct定义后面
68+
AfterStruct: false
69+
# union定义后面
70+
AfterUnion: false
71+
# extern之后
72+
AfterExternBlock: false
73+
# catch之前
74+
BeforeCatch: false
75+
# else之前
76+
BeforeElse: false
77+
# 缩进大括号
78+
IndentBraces: false
79+
# 分离空函数
80+
SplitEmptyFunction: false
81+
# 分离空语句
82+
SplitEmptyRecord: false
83+
# 分离空命名空间
84+
SplitEmptyNamespace: false

.github/workflows/Compilation.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ jobs:
1919
-v ${{ github.workspace }}:/workspace
2020
-w /workspace
2121
steps:
22-
- uses: actions/checkout@v4
23-
- name: Build the Docker image
22+
- name: Init Submodule
23+
uses: actions/checkout@v4
24+
with:
25+
submodules: recursive # 递归初始化所有子模块
26+
# 如果子模块是私有仓库,需配置 SSH 密钥
27+
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
28+
29+
- name: Build Project
2430
run:
25-
cd /workspace &&
26-
mkdir build && cd build &&
27-
cmake .. &&
31+
cd /workspace &&
32+
mkdir build && cd build &&
33+
cmake .. -DENABLE_TENSORRT=ON &&
2834
make -j
2935

3036
tensorrt10:
@@ -38,10 +44,16 @@ jobs:
3844
-v ${{ github.workspace }}:/workspace
3945
-w /workspace
4046
steps:
41-
- uses: actions/checkout@v4
42-
- name: Build the Docker image
47+
- name: Init Submodule
48+
uses: actions/checkout@v4
49+
with:
50+
submodules: recursive # 递归初始化所有子模块
51+
# 如果子模块是私有仓库,需配置 SSH 密钥
52+
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
53+
54+
- name: Build Project
4355
run:
44-
cd /workspace &&
45-
mkdir build && cd build &&
46-
cmake .. &&
56+
cd /workspace &&
57+
mkdir build && cd build &&
58+
cmake .. -DENABLE_TENSORRT=ON &&
4759
make -j

.github/workflows/Lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: pre-commit Checks
2+
3+
on:
4+
pull_request: # 在 PR 时触发
5+
push: # 在推送代码到 main/master 分支时触发
6+
branches: [main, master]
7+
8+
jobs:
9+
pre-commit:
10+
name: Run pre-commit checks
11+
runs-on: ubuntu-latest # 使用 Ubuntu 环境
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4 # 检出代码
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.10" # 指定 Python 版本
21+
22+
- name: Install pre-commit
23+
run: pip install pre-commit # 安装 pre-commit
24+
25+
- name: Run pre-commit checks
26+
run: pre-commit run --all-files # 运行所有检查

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
build
33
models
44
.vscode
5-
mustard0
5+
mustard0

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "easy_deploy_tool"]
2+
path = easy_deploy_tool
3+
url = git@github.com:zz990099/EasyDeployTool.git

.pre-commit-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
repos:
2+
# 官方仓库中的基础钩子
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v5.0.0
5+
hooks:
6+
- id: check-added-large-files
7+
- id: check-ast
8+
- id: check-case-conflict
9+
- id: check-merge-conflict
10+
- id: check-symlinks
11+
- id: check-xml
12+
- id: check-yaml
13+
args: ["--allow-multiple-documents"]
14+
- id: debug-statements
15+
- id: end-of-file-fixer
16+
- id: mixed-line-ending
17+
- id: trailing-whitespace
18+
exclude_types: [rst]
19+
- id: fix-byte-order-marker
20+
21+
# 运行 Uncrustify 格式化 C/C++ 代码
22+
- repo: https://github.com/pre-commit/mirrors-clang-format
23+
rev: "v20.1.0" # 指定 clang-format 版本
24+
hooks:
25+
- id: clang-format
26+
name: clang-format (check)
27+
args: [--style=file, --dry-run, --Werror] # 检查模式
28+
types: [c, c++]
29+
exclude:
30+
detection_6d_foundationpose/src/nvdiffrast(/.*)?

CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ cmake_minimum_required(VERSION 3.8)
22
project(foundationpose_cpp)
33

44
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
5-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
6-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
5+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
6+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
77

8-
add_subdirectory(deploy_core)
9-
add_subdirectory(inference_core)
8+
add_subdirectory(easy_deploy_tool)
109
add_subdirectory(detection_6d_foundationpose)
1110

12-
add_subdirectory(simple_tests)
11+
add_subdirectory(simple_tests)

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@
4848

4949
### Enviroment Build
5050

51-
1. 使用`docker`来构建运行环境
51+
1. 下载`foundationpose_cpp`repo
52+
```bash
53+
git clone git@github.com:zz990099/foundationpose_cpp.git
54+
cd foundationpose_cpp
55+
git submodule init
56+
git submodule update
57+
```
58+
59+
2. 使用`docker`来构建运行环境
5260
```bash
5361
cd ${foundationpose_cpp}/docker
5462
bash build_docker.sh --container_type=trt8 # trt10, jetson_trt8, jetson_trt10
@@ -71,7 +79,7 @@
7179
```bash
7280
cd /workspace
7381
mkdir build && cd build
74-
cmake ..
82+
cmake -DENABLE_TENSORRT=ON ..
7583
make -j
7684
```
7785

deploy_core/CMakeLists.txt

Lines changed: 0 additions & 30 deletions
This file was deleted.

deploy_core/README.md

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)