Skip to content

feat(c++): add lean header output - #3096

Open
foobra wants to merge 1 commit into
glideapps:masterfrom
foobra:agent/cpp-lean-header
Open

feat(c++): add lean header output#3096
foobra wants to merge 1 commit into
glideapps:masterfrom
foobra:agent/cpp-lean-header

Conversation

@foobra

@foobra foobra commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Closes #3095

The C++ renderer now accepts the secondary --lean-header option. It keeps the default output unchanged and adds a split mode for single-source generation:

  • <name>Fwd.hpp contains standard-library dependencies, nlohmann/json_fwd.hpp, generated types, and JSON declarations.
  • <name>Fwd.cpp includes the forward header, the full nlohmann/json.hpp, and the implementation fragment.
  • <name>.inc contains the non-inline serializer and helper definitions.

This removes the full nlohmann JSON header from consumers that only need the generated types. Definitions are emitted as non-inline functions in the implementation fragment so the generated translation unit provides linkable symbols; header-side constraint helpers remain inline.

Added a renderer regression test for the three-file output. Verified the focused C++ unit tests, build/type-check, C++ generation and syntax checks, and multi-translation-unit linking.

@github-actions

Copy link
Copy Markdown

Generated-output differences

253 files differ — 253 modified, 0 new, 0 deleted
7339 changed lines — +3796 / −3543

Open the generated-output report →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C++: add a lean-header mode that avoids including nlohmann/json.hpp

1 participant