build-cmake
Original:🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected
Used when configuring or building CMake-based embedded firmware projects, calling the built-in script to execute the build and locate firmware artifacts.
9installs
Sourceleokemp223/embed-ai-tool
Added on
NPX Install
npx skill4agent add leokemp223/embed-ai-tool build-cmakeTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Building CMake Projects
Applicable Scenarios
- indicates
Project Profile.build_system: cmake - Users want to configure, recompile, or confirm firmware artifacts for CMake MCU projects.
- The flashing or debugging process requires new ,
ELF, orHEXfiles.BIN - Need to confirm if the environment is ready before building (cmake, generator, toolchain).
Required Inputs
- Workspace path, or an existing .
Project Profile - Optional build presets, build directory, target name, generator, build type, and toolchain file.
Automatic Detection
- If exists, prioritize using the script's
CMakePresets.jsonto list and select presets.--list-presets - Otherwise, check , existing build directories, and toolchain files.
CMakeLists.txt - If there is an existing successful build directory that matches the current intent, reuse it first.
- The generator is automatically detected by the script, prioritizing , followed by the Make tool installed on the host machine.
Ninja - For debugging-oriented requests, is used by default; otherwise,
Debugis the default.RelWithDebInfo
Execution Steps
- First read references/usage.md to confirm whether this is environment detection, listing presets, executing a build, or just scanning artifacts.
- If unsure whether the environment is ready, first run the built-in script scripts/cmake_builder.py in mode to confirm.
--detect - If CMakePresets.json exists, use to list presets, then use
--list-presetsto build.--preset <name> - If no presets exist, manually configure the build using ,
--source,--build-dir,--generator,--build-type.--toolchain - Read the build results and artifact scan report output by the script, focusing on the preferred artifacts (ELF > HEX > BIN) and failure categories.
- Write the build directory, artifact path, artifact type, and generator information back to , and pass it to downstream skills when needed.
Project Profile
Failure Diversion
- When or the required generator is missing, return
cmake.environment-missing - When configuration or build fails due to corrupted presets, missing toolchain files, or invalid target names, return .
project-config-error - When the build appears successful but no flashable or debuggable artifacts are found, return .
artifact-missing - When there are multiple equally reasonable presets or firmware targets, and any selection is unsafe, return .
ambiguous-context
Platform Notes
- On Windows, unless the workspace explicitly requires a specific Visual Studio shell, prioritize to avoid dependency on a specific developer command environment.
Ninja - The built-in script uses Python standard libraries and subprocess to call cmake, so the build scheduling path itself is cross-platform.
- The build directory in the output should remain an absolute path for direct reuse by downstream flashing and debugging skills.
Output Conventions
- Output configuration commands, build commands, build directory, selected generator, and preferred artifact path.
- Update with
Project Profile,artifact_path, and detected toolchain details.artifact_kind - After success, recommend or
flash-openocd.debug-gdb-openocd
Handover Relationships
- When the next step is to flash the program to hardware, pass the successful build result to .
flash-openocd - When the next step requires symbol information or a debugging session, pass the successful build result to .
debug-gdb-openocd