From d84f8f4fb35f7809ae16905d9e6058ede90dcd2b Mon Sep 17 00:00:00 2001 From: Thomas Nemer Date: Tue, 11 Nov 2025 18:45:48 +0100 Subject: [PATCH] [#114.3] Add iwyu enforcement to intermediate examples Add CXX_INCLUDE_WHAT_YOU_USE property to all 4 intermediate examples and fix the include issues identified by iwyu. Changes: - Add iwyu enforcement to CMakeLists.txt for all 4 intermediate examples - Fix missing includes in example source files as reported by iwyu - Ensure all intermediate examples build successfully with strict include checking This ensures intermediate examples follow the same include hygiene standards as basic and advanced examples. Closes #119 --- .../intermediate/01_nested_panels/CMakeLists.txt | 1 + examples/intermediate/01_nested_panels/main.cpp | 6 ++++++ .../intermediate/02_responsive_ui/CMakeLists.txt | 1 + examples/intermediate/02_responsive_ui/main.cpp | 4 ++++ .../03_event_handling/CMakeLists.txt | 1 + examples/intermediate/03_event_handling/main.cpp | 3 ++- .../04_dynamic_layout/CMakeLists.txt | 1 + examples/intermediate/04_dynamic_layout/main.cpp | 16 +++++++++++++++- 8 files changed, 31 insertions(+), 2 deletions(-) diff --git a/examples/intermediate/01_nested_panels/CMakeLists.txt b/examples/intermediate/01_nested_panels/CMakeLists.txt index e8d6c85..c2baa48 100644 --- a/examples/intermediate/01_nested_panels/CMakeLists.txt +++ b/examples/intermediate/01_nested_panels/CMakeLists.txt @@ -30,4 +30,5 @@ add_dependencies(01_nested_panels format-example-sources) # Output to build/examples/intermediate/01_nested_panels/ set_target_properties(01_nested_panels PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples/intermediate/01_nested_panels" + CXX_INCLUDE_WHAT_YOU_USE "${IWYU_PATH};-Xiwyu;--error;-Xiwyu;--verbose=3" ) diff --git a/examples/intermediate/01_nested_panels/main.cpp b/examples/intermediate/01_nested_panels/main.cpp index f54a014..21aea47 100644 --- a/examples/intermediate/01_nested_panels/main.cpp +++ b/examples/intermediate/01_nested_panels/main.cpp @@ -19,13 +19,19 @@ #include #include #include +#include #include +#include #include #include #include #include +#include #include +#include +#include +#include using namespace bombfork::prong; using namespace bombfork::prong::layout; diff --git a/examples/intermediate/02_responsive_ui/CMakeLists.txt b/examples/intermediate/02_responsive_ui/CMakeLists.txt index 335a8b6..05b9589 100644 --- a/examples/intermediate/02_responsive_ui/CMakeLists.txt +++ b/examples/intermediate/02_responsive_ui/CMakeLists.txt @@ -30,4 +30,5 @@ add_dependencies(02_responsive_ui format-example-sources) # Output to build/examples/intermediate/02_responsive_ui/ set_target_properties(02_responsive_ui PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples/intermediate/02_responsive_ui" + CXX_INCLUDE_WHAT_YOU_USE "${IWYU_PATH};-Xiwyu;--error;-Xiwyu;--verbose=3" ) diff --git a/examples/intermediate/02_responsive_ui/main.cpp b/examples/intermediate/02_responsive_ui/main.cpp index a7c4ea6..124243a 100644 --- a/examples/intermediate/02_responsive_ui/main.cpp +++ b/examples/intermediate/02_responsive_ui/main.cpp @@ -15,12 +15,16 @@ #include #include #include +#include #include #include #include #include +#include #include +#include +#include using namespace bombfork::prong; using namespace bombfork::prong::layout; diff --git a/examples/intermediate/03_event_handling/CMakeLists.txt b/examples/intermediate/03_event_handling/CMakeLists.txt index e628578..f6c2c98 100644 --- a/examples/intermediate/03_event_handling/CMakeLists.txt +++ b/examples/intermediate/03_event_handling/CMakeLists.txt @@ -30,4 +30,5 @@ add_dependencies(03_event_handling format-example-sources) # Output to build/examples/intermediate/03_event_handling/ set_target_properties(03_event_handling PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples/intermediate/03_event_handling" + CXX_INCLUDE_WHAT_YOU_USE "${IWYU_PATH};-Xiwyu;--error;-Xiwyu;--verbose=3" ) diff --git a/examples/intermediate/03_event_handling/main.cpp b/examples/intermediate/03_event_handling/main.cpp index 391d574..202fad9 100644 --- a/examples/intermediate/03_event_handling/main.cpp +++ b/examples/intermediate/03_event_handling/main.cpp @@ -14,7 +14,6 @@ #include "../../adapters/glfw_window_adapter.h" #include "../../adapters/simple_opengl_renderer.h" #include -#include #include #include #include @@ -25,8 +24,10 @@ #include #include +#include #include #include +#include using namespace bombfork::prong; using namespace bombfork::prong::core; diff --git a/examples/intermediate/04_dynamic_layout/CMakeLists.txt b/examples/intermediate/04_dynamic_layout/CMakeLists.txt index b03b44a..14d0d00 100644 --- a/examples/intermediate/04_dynamic_layout/CMakeLists.txt +++ b/examples/intermediate/04_dynamic_layout/CMakeLists.txt @@ -30,4 +30,5 @@ add_dependencies(04_dynamic_layout format-example-sources) # Output to build/examples/intermediate/04_dynamic_layout/ set_target_properties(04_dynamic_layout PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples/intermediate/04_dynamic_layout" + CXX_INCLUDE_WHAT_YOU_USE "${IWYU_PATH};-Xiwyu;--error;-Xiwyu;--verbose=3" ) diff --git a/examples/intermediate/04_dynamic_layout/main.cpp b/examples/intermediate/04_dynamic_layout/main.cpp index 6f41bea..781a8dd 100644 --- a/examples/intermediate/04_dynamic_layout/main.cpp +++ b/examples/intermediate/04_dynamic_layout/main.cpp @@ -17,21 +17,35 @@ #include #include #include +#include #include +#include #include #include #include #include -#include +#include #include +#include #include +#include +#include +#include using namespace bombfork::prong; using namespace bombfork::prong::layout; using namespace bombfork::prong::theming; using namespace bombfork::prong::examples; +namespace bombfork { +namespace prong { +namespace rendering { +class IRenderer; +} +} // namespace prong +} // namespace bombfork + // Global state for dynamic manipulation Panel<>* g_contentPanel = nullptr; rendering::IRenderer* g_renderer = nullptr;