From 892bc1143b517ed0ca7e22bfecb51a0e2e2d4dcf Mon Sep 17 00:00:00 2001 From: Thomas Nemer Date: Tue, 11 Nov 2025 18:26:02 +0100 Subject: [PATCH] Add iwyu enforcement to glfw_adapters and demo_app (#117) ## Changes - Add CXX_INCLUDE_WHAT_YOU_USE property to glfw_adapters library - Add CXX_INCLUDE_WHAT_YOU_USE property to prong_demo_app executable - Fix include violations in demo_app/main.cpp (add , remove unused ) - Remove unused private scrollbar fields from Viewport component ## Impact - Enforces include-what-you-use for demo infrastructure - Prevents future include violations with --error flag - All builds and tests pass successfully Part of #114 - Make include-what-you-use mandatory for all example builds --- examples/CMakeLists.txt | 10 ++++++++++ examples/demo_app/main.cpp | 2 +- include/bombfork/prong/components/viewport.h | 6 ------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7f69a95..e494f08 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -75,6 +75,11 @@ target_include_directories(glfw_adapters PUBLIC target_compile_features(glfw_adapters PUBLIC cxx_std_20) +# Enable iwyu for glfw_adapters +set_target_properties(glfw_adapters PROPERTIES + CXX_INCLUDE_WHAT_YOU_USE "${IWYU_PATH};-Xiwyu;--error;-Xiwyu;--verbose=3" +) + # === Demo App Example === add_executable(prong_demo_app @@ -100,6 +105,11 @@ target_compile_features(prong_demo_app PRIVATE cxx_std_20) # Suppress unused function warnings for STB (header-only library with many utilities) target_compile_options(prong_demo_app PRIVATE -Wno-unused-function) +# Enable iwyu for prong_demo_app +set_target_properties(prong_demo_app PROPERTIES + CXX_INCLUDE_WHAT_YOU_USE "${IWYU_PATH};-Xiwyu;--error;-Xiwyu;--verbose=3" +) + # Make example depend on formatting target add_dependencies(prong_demo_app format-example-sources) diff --git a/examples/demo_app/main.cpp b/examples/demo_app/main.cpp index a7f7c8f..9b583b9 100644 --- a/examples/demo_app/main.cpp +++ b/examples/demo_app/main.cpp @@ -11,10 +11,10 @@ #include "scenes/demo_scene.h" #include -#include #include #include #include +#include #ifdef __linux__ #include diff --git a/include/bombfork/prong/components/viewport.h b/include/bombfork/prong/components/viewport.h index 74b3f1a..dddaec0 100644 --- a/include/bombfork/prong/components/viewport.h +++ b/include/bombfork/prong/components/viewport.h @@ -169,12 +169,6 @@ class Viewport : public Component { PanChangedCallback panCallback; SelectionCallback selectionCallback; - // Scrollbar state - bool horizontalScrollbarHover = false; - bool verticalScrollbarHover = false; - bool horizontalScrollbarDrag = false; - bool verticalScrollbarDrag = false; - public: explicit Viewport() : Component(nullptr, "Viewport") { // Initialize default theme