# rmshub/kconfiglib_cmake architecture

> Architecture diagram of the GitHub repository rmshub/kconfiglib_cmake, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rmshub/kconfiglib_cmake
- Repository: https://github.com/rmshub/kconfiglib_cmake

## Overview

This repository adds CMake-based configuration generation around Kconfiglib. A project supplies a Kconfig definition and optional defaults; the generator loads and evaluates them, optionally launches the terminal menuconfig editor, and writes CMake, C-header, and updated configuration outputs. The CMake integration makes generated build settings and the header available to the consuming project. The main Python imports and README support these links; CMake implementation details were not sampled, so those relationships are based on the README.

Main entry points: [`scripts/kconfiggen.py`](https://github.com/rmshub/kconfiglib_cmake/blob/main/scripts/kconfiggen.py) (Configuration generator), [`cmake/kconfig.cmake`](https://github.com/rmshub/kconfiglib_cmake/blob/main/cmake/kconfig.cmake) (CMake integration), [`Kconfig`](https://github.com/rmshub/kconfiglib_cmake/blob/main/Kconfig) (Kconfig definitions), [`sdkconfig.defaults`](https://github.com/rmshub/kconfiglib_cmake/blob/main/sdkconfig.defaults) (Default settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["CMake integration"]
  node_cmake["CMake integration<br/>[kconfig.cmake]"]
end

subgraph group_configuration["Configuration processing"]
  node_kconfig_input["Kconfig definitions"]
  node_defaults["Default settings<br/>[sdkconfig.defaults]"]
  node_generator["Configuration generator<br/>[kconfiggen.py]"]
  node_kconfiglib["Kconfig engine<br/>[kconfiglib.py]"]
  node_project_config["Project configuration"]
end

subgraph group_editing["Interactive editing"]
  node_menuconfig["Terminal editor<br/>[menuconfig.py]"]
end

subgraph group_outputs["Generated outputs"]
  node_cmake_output["Generated CMake settings"]
  node_header_output["Generated C header"]
  node_config_output["Updated configuration"]
end

node_project["Consuming project"]
node_developer(("Project user"))

node_developer -->|"configures"| node_cmake
node_cmake -->|"invokes"| node_generator
node_kconfig_input -->|"defines options"| node_generator
node_defaults -->|"provides defaults"| node_generator
node_generator -->|"evaluates"| node_kconfiglib
node_generator -->|"loads and updates"| node_project_config
node_generator -->|"launches optionally"| node_menuconfig
node_generator -->|"writes settings"| node_cmake_output
node_generator -->|"writes header"| node_header_output
node_generator -->|"writes config"| node_config_output
node_cmake -->|"includes"| node_cmake_output
node_cmake -->|"exposes"| node_header_output
node_cmake_output -->|"customizes build"| node_project
node_header_output -->|"provides definitions"| node_project

click node_cmake "https://github.com/rmshub/kconfiglib_cmake/blob/main/cmake/kconfig.cmake"
click node_kconfig_input "https://github.com/rmshub/kconfiglib_cmake/blob/main/Kconfig"
click node_defaults "https://github.com/rmshub/kconfiglib_cmake/blob/main/sdkconfig.defaults"
click node_generator "https://github.com/rmshub/kconfiglib_cmake/blob/main/scripts/kconfiggen.py"
click node_kconfiglib "https://github.com/rmshub/kconfiglib_cmake/blob/main/scripts/kconfiglib.py"
click node_menuconfig "https://github.com/rmshub/kconfiglib_cmake/blob/main/scripts/menuconfig.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cmake,node_developer toneBlue
class node_kconfig_input,node_defaults,node_generator,node_kconfiglib,node_project_config toneAmber
class node_menuconfig toneMint
class node_cmake_output,node_header_output,node_config_output toneRose
class node_project toneIndigo
```

## Components

### CMake integration

- [CMake integration](https://github.com/rmshub/kconfiglib_cmake/blob/main/cmake/kconfig.cmake): `cmake/kconfig.cmake`

### Configuration processing

- [Kconfig definitions](https://github.com/rmshub/kconfiglib_cmake/blob/main/Kconfig): `Kconfig`
- [Default settings](https://github.com/rmshub/kconfiglib_cmake/blob/main/sdkconfig.defaults): `sdkconfig.defaults`
- [Configuration generator](https://github.com/rmshub/kconfiglib_cmake/blob/main/scripts/kconfiggen.py): `scripts/kconfiggen.py`
- [Kconfig engine](https://github.com/rmshub/kconfiglib_cmake/blob/main/scripts/kconfiglib.py): `scripts/kconfiglib.py`
- **Project configuration**

### Interactive editing

- [Terminal editor](https://github.com/rmshub/kconfiglib_cmake/blob/main/scripts/menuconfig.py): `scripts/menuconfig.py`

### Generated outputs

- **Generated CMake settings**
- **Generated C header**
- **Updated configuration**

### Other components

- **Consuming project**
- **Project user**

## Connections

- Project user → CMake integration: configures (evidence: `README.md`)
- CMake integration → Configuration generator: invokes (evidence: `README.md`)
- Kconfig definitions → Configuration generator: defines options (evidence: `README.md`)
- Default settings → Configuration generator: provides defaults (evidence: `scripts/kconfiggen.py`)
- Configuration generator → Kconfig engine: evaluates (evidence: `scripts/kconfiggen.py`)
- Configuration generator → Project configuration: loads and updates (evidence: `scripts/kconfiggen.py`)
- Configuration generator → Terminal editor: launches optionally (evidence: `scripts/kconfiggen.py`)
- Configuration generator → Generated CMake settings: writes settings (evidence: `scripts/kconfiggen.py`)
- Configuration generator → Generated C header: writes header (evidence: `scripts/kconfiggen.py`)
- Configuration generator → Updated configuration: writes config (evidence: `scripts/kconfiggen.py`)
- CMake integration → Generated CMake settings: includes (evidence: `README.md`)
- CMake integration → Generated C header: exposes (evidence: `README.md`)
- Generated CMake settings → Consuming project: customizes build (evidence: `README.md`)
- Generated C header → Consuming project: provides definitions (evidence: `README.md`)
