How olokreaz/cthpp works
Project type and purpose
• CTH++ is an open-source command-line tool (CLI) for generating C++ configuration headers at compile-time.
• It parses JSON config files and, using constexpr, emits a .hpp file containing all config values as typed constants.
File structure
• Top level:
• CMakeLists.txt – build entry point
• src/ – core implementation
– main.cpp: CLI entry point
– program_options.hpp: argument-parsing definitions
• third-party/libfiglet – submodule used to render ASCII art logo
• .clang-format, .gitignore, LICENSE, NOTICE – project metadata
• No “frontend”/“backend” split; this is a single binary tool.
• CMake integration indicates a build-time component.
README for additional insights
• Describes CLI options, JSON schema, and sample generated header.
– CLI parsing
– JSON loading
– Internal config AST/model
– Header code generation
– File output
Elements
• Processing modules in another
• Output (generated .hpp) in a distinct style
• External dependency (libfiglet) and build system (CMake) in a third style
Final recommendations
• Be detailed: break “Code Generator” into subcomponents if necessary (e.g., namespace emitter, value emitter).
• Compile-time vs. runtime actions (most is compile-time).
• Notes on configuration options (debug vs. release, namespace overrides).