Files
wind_power_cal/.agents/skills/wind-third-party-libs/SKILL.md
T
cloud 3cb7684039 更新项目 skills 并完善设计功率曲线前端
- skills: 移除 edge_collector 专属技能(OTA/协议/边缘主机/collector 等),
  保留通用工程规范(analyze-questions/cpp-coding-style/git-commit/shell-scripting/
  frontend-debug/frontend-dialog/frontend-ui-conventions),新增 wind_power_cal
  项目技能(wind-project-overview/build-run/deploy/backend-conventions/
  frontend-conventions/third-party-libs)与元技能 skill-builder;
  .agents/skills 与 .claude/skills 保持同步
- 前端: HomePage/App.css 增加设计功率曲线录入与图表展示

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-14 17:50:23 +08:00

36 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: wind-third-party-libs
description: wind_power_cal 第三方库管理规范。用于新增/引用/重新编译 third_party 下的 Drogon、nlohmann 等库时,按 ensure_third_party.sh 的源码编译与调用约定操作。
---
# 第三方库管理
## 现有
| 目录 | 说明 | 是否入库 |
| --- | --- | --- |
| `third_party/drogon_repo/` | Drogon + Trantor 源码(vendored,无 .git/build | ✅ 入库 |
| `third_party/nlohmann/` | header-only json`json.hpp` + `json_fwd.hpp` | ✅ 入库 |
| `third_party/drogon/install/<arch>/` | 源码编译产物 | ❌ gitignored |
## 源码编译 Drogon
`third_party/ensure_third_party.sh`
- 架构检测 `x64 / arm64 / arm32`
- cmake flags`BUILD_SHARED_LIBS=ON USE_SUBMODULE=ON BUILD_CTL=OFF BUILD_EXAMPLES=OFF BUILD_ORM=OFF BUILD_TESTING=OFF BUILD_BROTLI=ON BUILD_YAML_CONFIG=OFF``CMAKE_INSTALL_LIBDIR=libs`
- 安装到 `third_party/drogon/install/<arch>/`;产物存在(`libs/cmake/Drogon/DrogonConfig.cmake`)则跳过
## 调用约定(重要,踩过坑)
- **被 source 时**显式传 `THIRD_PARTY=<root>/third_party`:调用方(如 `package.sh`)可能已预设 `SCRIPT_DIR`,会让本脚本 `${SCRIPT_DIR:-}` 推导到错误目录。
```bash
THIRD_PARTY="${ROOT_DIR}/third_party" source "${ROOT_DIR}/third_party/ensure_third_party.sh"
```
- 脚本内**软失败用 `return`,不要用 `exit`**(被 source 时 `exit` 会杀掉父 shell)。本仓库写法:`return 0 2>/dev/null || exit 0`。
- 导出 `TARGET_ARCH` 与 `DROGON_INSTALL` 供后续 cmake / run.sh 使用。
## 引用方式
- 后端 CMake`find_package(Drogon CONFIG REQUIRED)`,由顶层 `DROGON_LOCAL_PREFIX` 注入查找路径。
- json`#include <nlohmann/json.hpp>`third_parent 在 include path)。
## 新增第三方库
- header-only(如 nlohmann):直接放 `third_party/<name>/`CMake 加 include path。
- 需编译:仿照 `ensure_third_party.sh` 的 Drogon 块,源码放 `third_party/<name>_repo/`,编译安装到 `third_party/<name>/install/<arch>/`,产物 gitignore。