Skip to content

[#114.2] Add iwyu enforcement to basic examples#122

Merged
thomasnemer merged 1 commit intomainfrom
118-add-iwyu-enforcement-to-basic-examples
Nov 11, 2025
Merged

[#114.2] Add iwyu enforcement to basic examples#122
thomasnemer merged 1 commit intomainfrom
118-add-iwyu-enforcement-to-basic-examples

Conversation

@thomasnemer
Copy link
Copy Markdown
Contributor

Summary

  • Added CXX_INCLUDE_WHAT_YOU_USE property to all 8 basic example CMakeLists.txt files
  • Fixed missing includes in example source files to satisfy iwyu requirements
  • All examples now build successfully with iwyu --error flag enabled

Changes

CMakeLists.txt (8 files)

Added iwyu enforcement to:

  • 01_hello_button
  • 02_stack_layout
  • 03_flex_layout
  • 04_grid_layout
  • 05_dock_layout
  • 06_flow_layout
  • 07_text_input
  • 08_list_box

Source Files (8 files)

Added missing includes to satisfy iwyu:

  • Standard library headers: <functional>, <memory>, <utility>, <string>, <vector>, <optional>
  • Prong headers: <bombfork/prong/core/component.h>
  • GLFW adapters (text_input only): clipboard and keyboard headers

Test Plan

  • All 8 basic examples build successfully with mise build-examples
  • iwyu checks pass with --error flag (build would fail otherwise)
  • Pre-commit hooks passed (clang-format)
  • Pre-push hooks passed (build validation)

Related Issues

Part of #114 - Make include-what-you-use mandatory for all example builds
Closes #118

Add CXX_INCLUDE_WHAT_YOU_USE property to all 8 basic example executables
to enforce include-what-you-use checks at build time. This ensures
example code maintains proper include hygiene and demonstrates best
practices.

Changes:
- Add iwyu property to CMakeLists.txt for all 8 basic examples
- Add missing includes to example source files to satisfy iwyu:
  - <functional>, <memory>, <utility> for standard library types
  - <string>, <vector>, <optional> where used
  - bombfork/prong/core/component.h for Component methods
  - GLFW adapter headers for text_input example

All examples build successfully with iwyu --error flag enabled.

Closes #118
@thomasnemer thomasnemer merged commit 771fff1 into main Nov 11, 2025
1 check passed
@thomasnemer thomasnemer deleted the 118-add-iwyu-enforcement-to-basic-examples branch November 11, 2025 17:37
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.

[#114.2] Add iwyu enforcement to basic examples

1 participant