fprime-cmake-build-system
它能做什么
它说明 F Prime 的 CMake 层如何注册模块、设置构建目标并选择平台。适用于构建 F Prime 飞行软件的工程师。
适用场景
- ✓当你要把新模块添加到 F Prime 构建中时。
- ✓当你要把 F Prime 移植到新平台或交叉编译工具链时。
- ✓当 F Prime 项目中的生成或构建步骤失败,你需要找出原因时。
技能链接
https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-cmake-build-system/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我把新的 F Prime 模块注册到 CMake 构建中,并修复生成错误。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会使用 F Prime 的注册函数和构建布局,检查平台和配置,然后重新构建以确认修复结果。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Skill: F Prime CMake Build System
F Prime wraps CMake in an API layer so that modules declare sources and autocoder inputs and get autocoding, dictionaries, unit tests, and install rules for free. Canonical references:
- Build system user manual
- API and options reference — generated from the docblocks in
API.cmakeandoptions.cmake; read those files directly, they are the source of truth - Build system SDD (requirements, ops concepts)
Follow those for full syntax and examples; this skill adds orientation, decision criteria, and the failure modes that are easy to get wrong.
1 — Where things live under cmake/
| Path | Contents |
|---|---|
API.cmake |
The public register_fprime_* / add_fprime_subdirectory API |
module.cmake, config_assembler.cmake |
Internal module and configuration processing |
target/ |
Built-in targets: build, ut, dictionary, install, sbom, version |
target/sub-build/ |
Targets run in sub-builds (fpp_locs, fpp_depend, module_info) |
autocoder/ |
Autocoder integration (fpp.cmake, fpp_ut.cmake) |
platform/ |
${FPRIME_PLATFORM}.cmake platform files (Linux, Darwin, templates) |
toolchain/ |
Cross-compile toolchain files |
settings/, options.cmake, flags.cmake, sanitizers.cmake |
Build settings, options, compile flags |
test/ |
pytest suite for the build system itself |
Change the narrowest layer that solves the problem: a module's own
CMakeLists.txt first, then a platform/toolchain file, and only then
cmake/ internals (which affect every project using F Prime).
2 — Which registration call
| Task | Call |
|---|---|
| Component, port, or plain library module | register_fprime_module |
| Deployment producing an F Prime binary | register_fprime_deployment |
| Non-deployment executable / tool | register_fprime_executable |
| Unit test | register_fprime_ut (see fprime-unit-testing) |
| Configuration module (framework, platform, library, or project overrides) | register_fprime_config |
Implementation of a swappable package (e.g. Os_File) |
register_fprime_module + IMPLEMENTS; register_os_implementation for OSAL packages |
Custom build target (<target> + <MODULE>_<target>) |
register_fprime_target / register_fprime_ut_target |
Common directives: SOURCES, AUTOCODER_INPUTS, HEADERS, DEPENDS,
REQUIRES_IMPLEMENTATIONS, CHOOSES_IMPLEMENTATIONS. A new module
directory must also be pulled in with add_fprime_subdirectory from
the including CMakeLists.txt.
Guides: customization / custom targets, configuration modules, implementations, platforms, toolchains, settings.ini, external libraries, OSAL implementation.
3 — Failure modes
- Stale cache: a build cache can go out of date in many ways —
edited
settings.ini, a newCMakeLists.txtor FPP file, a moved module, a switched toolchain. Symptoms are confusing missing-target, missing-autocode, or stale-dependency errors rather than compiler errors. Fix withfprime-util generate -f(--utfor the unit-test cache), which purges and regenerates the build cache. - Unresolved implementation: every platform must
CHOOSES_IMPLEMENTATIONSfor every package a moduleREQUIRES_IMPLEMENTATIONS; a missing choice surfaces as a link error, not a CMake error. Use the_Stubimplementation when a platform lacks the capability; override in the project's configuration module (CHOOSES_IMPLEMENTATIONS) or per deployment, executable, or UT. - Sub-build assumptions: code that must not run during the
fpp_locs/fpp_dependsub-builds needsskip_on_sub_build(); platform-specific modules needrestrict_platforms(...). - Hardcoded host paths or tool locations in a toolchain belong in
an
environment_file, not in committed CMake. - **Bypassing the
常见问题
我需要先了解 CMake 吗?
了解基本的 CMake 会有帮助,不过该技能也会解释 F Prime 在其之上的封装层。
它涵盖不同平台吗?
涵盖。它涵盖平台文件、工具链文件,以及操作系统实现的选择。
精确的规则在哪里?
该技能指向 F Prime 的构建系统手册及其 API 文件,以获取精确语法。
详情
作者的原始描述
Work with F Prime's custom CMake layer: the `register_fprime_*` API, build targets, toolchains and platform files, implementation selection, configuration modules, sub-builds, and `settings.ini`. Use when adding or wiring a module into a build, adding a custom build target, porting to a new platform or toolchain, choosing or defining an Os implementation, or diagnosing generate/build failures that are not compiler errors.
repo: nasa/fprime
热度
- GitHub 星标
- 12k
- 排名
- #11493
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
fprime-component-design-fpp
12k帮你的智能体把已批准的 F Prime 组件需求,转化为一个描述其端口、命令、事件和遥测的 FPP 模型。
fprime-component-development
12k帮你的智能体引导 F Prime 组件经历每个开发阶段,从需求一直到集成测试。
fprime-component-implementation
12k帮你的智能体按照项目规则,编写 F Prime 组件自动生成的处理函数背后的 C++ 代码。
fprime-component-integration-test
12k帮你的智能体为 F Prime 组件编写可复用的 pytest 集成测试,并在实时部署环境中运行。