跳到正文
Skillpedia
通用编程12k · #11493

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-cmake-build-system/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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:

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 new CMakeLists.txt or FPP file, a moved module, a switched toolchain. Symptoms are confusing missing-target, missing-autocode, or stale-dependency errors rather than compiler errors. Fix with fprime-util generate -f (--ut for the unit-test cache), which purges and regenerates the build cache.
  • Unresolved implementation: every platform must CHOOSES_IMPLEMENTATIONS for every package a module REQUIRES_IMPLEMENTATIONS; a missing choice surfaces as a link error, not a CMake error. Use the _Stub implementation 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_depend sub-builds needs skip_on_sub_build(); platform-specific modules need restrict_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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能