Better doc for dev

This commit is contained in:
Aoran Zeng 2025-06-20 23:07:42 +08:00
parent 54e13aa77f
commit 4119466247
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98

View File

@ -31,9 +31,10 @@
## 获取代码
**请务必使用 dev 分支开发**
```bash
# 请务必使用 dev 分支开发
$ git clone https://gitee.com/RubyMetric/chsrc.git -b dev
git clone https://gitee.com/RubyMetric/chsrc.git -b dev
```
关于分支的说明,可参考 [./03-CONTRIBUTING.md](./03-CONTRIBUTING.md)
@ -42,9 +43,33 @@ $ git clone https://gitee.com/RubyMetric/chsrc.git -b dev
## `make` 用户
## 编译运行
### 编译运行
共有四种构建模式:
1. **`DEV mode`**
2. **`DEBUG mode`**
3. **`RELEASE mode`**
4. **`CI-RELEASE mode`**
第四种只在 GitHub Actions 使用,一般只需要前三者;而在开发时你仅需要前两者;如果不需要 Debug仅仅第一个 **DEV mode** 就够了。
**如果你使用 `just`,可以在 VS Code 中获得更好的体验,按 `Ctrl-Shift-B` 直接使用 DEV mode 构建**
```bash
just (b) # 在Windows上默认使用 gcc 编译在macOS上默认使用 clang 编译,在其他系统上默认使用 cc 编译
just CC=clang # 使用 clang 编译
just CC=gcc # 使用 gcc 编译
# 编译出 debug 版本: chsrc-debug
just bd
# 编译出 release 版本: chsrc-release
just br
```
<br>
`make` 用户:
```bash
make (b) # 在Windows上默认使用 cc 编译在macOS上默认使用 clang 编译,在其他系统上默认使用 cc 编译
@ -52,11 +77,31 @@ make CC=clang # 使用 clang 编译
make CC=gcc # 使用 gcc 编译
# 编译出 debug 版本: chsrc-debug
just bd
make bd
# 编译出 release 版本: chsrc-release
just br
make br
```
<br>
## Debug
**如果你使用 `just`,可以在 VS Code 中获得更好的体验,按 F5 即可立即开始 Debug**
```bash
# 重新编译出 ./chsrc-debug并启动 GDB 调试 (在macOS上启动 LLDB 调试)
$ just debug
# 重新编译出 ./chsrc-debug并启动 LLDB 调试
$ just DEBUGGER=lldb debug
```
<br>
`make` 用户:
```bash
# 重新编译出 ./chsrc-debug并启动 GDB 调试 (在macOS上启动 LLDB 调试)
$ make debug
@ -67,7 +112,11 @@ $ make debug DEBUGGER=lldb
<br>
### 测试
## 测试
`just` 用户只需要替换下述 `make``just`
```bash
make test-xy # 测试 xy.h
@ -81,47 +130,6 @@ make clean
## `just` 用户
如果你使用 `just`,可以在 VS Code 中获得更好的体验
### 编译运行
```bash
just (b) # 在Windows上默认使用 gcc 编译在macOS上默认使用 clang 编译,在其他系统上默认使用 cc 编译
just CC=clang # 使用 clang 编译
just CC=gcc # 使用 gcc 编译
# 编译出 debug 版本: chsrc-debug
just bd
# 编译出 release 版本: chsrc-release
just br
```
```bash
# 重新编译出 ./chsrc-debug并启动 GDB 调试 (在macOS上启动 LLDB 调试)
$ just debug
# 重新编译出 ./chsrc-debug并启动 LLDB 调试
$ just DEBUGGER=lldb debug
```
<br>
### 测试
```bash
just test-xy # 测试 xy.h
just test-fw # 测试 framework
just test # 测试上述两个
just test-cli # 测试命令
just clean
```
<br>
## 提交 PR
关于分支的说明以及如何提交代码,请参考 [./03-CONTRIBUTING.md](./03-CONTRIBUTING.md)