fix: Windows build and formatting issues

Fixes two CI failures:
1. Windows Abseil header lookup - removed manual include_directories
   in util.cmake that were only added when gRPC was enabled. CMake
   target properties now handle Abseil includes automatically.
2. Code formatting violations in test/yaze_test.cc - applied clang-format

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
scawful
2025-11-20 00:44:04 -05:00
parent b259980358
commit 14d1f5de4c
2 changed files with 113 additions and 94 deletions

View File

@@ -35,18 +35,16 @@ target_include_directories(yaze_util PUBLIC
${PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}
) )
if(YAZE_ENABLE_GRPC) # Note: Abseil include paths are provided automatically through target_link_libraries
target_include_directories(yaze_util PRIVATE # No manual include_directories needed - linking to absl::* targets provides the paths
${CMAKE_BINARY_DIR}/_deps/grpc-src/third_party/abseil-cpp
)
endif()
target_link_libraries(yaze_util PUBLIC target_link_libraries(yaze_util PUBLIC
yaze_common yaze_common
) )
# Add Abseil dependencies if gRPC is enabled # Add Abseil dependencies
# We link to grpc++ which transitively provides Abseil and ensures correct build order # When gRPC is enabled, we link to grpc++ which transitively provides Abseil
# When gRPC is disabled, we use the standalone Abseil from absl.cmake
if(YAZE_ENABLE_GRPC) if(YAZE_ENABLE_GRPC)
target_link_libraries(yaze_util PUBLIC target_link_libraries(yaze_util PUBLIC
grpc++ grpc++
@@ -55,6 +53,14 @@ if(YAZE_ENABLE_GRPC)
absl::strings absl::strings
absl::str_format absl::str_format
) )
else()
# Link standalone Abseil targets (configured in cmake/absl.cmake)
target_link_libraries(yaze_util PUBLIC
absl::status
absl::statusor
absl::strings
absl::str_format
)
endif() endif()
set_target_properties(yaze_util PROPERTIES set_target_properties(yaze_util PROPERTIES

View File

@@ -5,27 +5,27 @@
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif #endif
#include <gtest/gtest.h>
#include <SDL.h> #include <SDL.h>
#include <gtest/gtest.h>
#include <cstdlib>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
#include <cstdlib>
#include "absl/debugging/failure_signal_handler.h" #include "absl/debugging/failure_signal_handler.h"
#include "absl/debugging/symbolize.h" #include "absl/debugging/symbolize.h"
#include "imgui/imgui.h" #include "app/controller.h"
#include "app/gfx/backend/sdl2_renderer.h"
#include "app/platform/window.h"
#include "e2e/canvas_selection_test.h"
#include "e2e/dungeon_editor_smoke_test.h"
#include "e2e/framework_smoke_test.h"
#include "imgui/backends/imgui_impl_sdl2.h" #include "imgui/backends/imgui_impl_sdl2.h"
#include "imgui/backends/imgui_impl_sdlrenderer2.h" #include "imgui/backends/imgui_impl_sdlrenderer2.h"
#include "imgui/imgui.h"
#include "imgui_test_engine/imgui_te_context.h" #include "imgui_test_engine/imgui_te_context.h"
#include "imgui_test_engine/imgui_te_engine.h" #include "imgui_test_engine/imgui_te_engine.h"
#include "imgui_test_engine/imgui_te_ui.h" #include "imgui_test_engine/imgui_te_ui.h"
#include "app/platform/window.h"
#include "app/controller.h"
#include "app/gfx/backend/sdl2_renderer.h"
#include "e2e/canvas_selection_test.h"
#include "e2e/framework_smoke_test.h"
#include "e2e/dungeon_editor_smoke_test.h"
// #include "test_editor.h" // Not used in main // #include "test_editor.h" // Not used in main
@@ -219,7 +219,8 @@ void ConfigureTestFilters(const TestConfig& config) {
if (!filters.empty()) { if (!filters.empty()) {
std::string filter_string; std::string filter_string;
for (size_t i = 0; i < filters.size(); i++) { for (size_t i = 0; i < filters.size(); i++) {
if (i > 0) filter_string += ":"; if (i > 0)
filter_string += ":";
filter_string += filters[i]; filter_string += filters[i];
} }
@@ -269,17 +270,21 @@ int main(int argc, char* argv[]) {
yaze::core::Window window; yaze::core::Window window;
// Create renderer for test // Create renderer for test
auto test_renderer = std::make_unique<yaze::gfx::SDL2Renderer>(); auto test_renderer = std::make_unique<yaze::gfx::SDL2Renderer>();
yaze::core::CreateWindow(window, test_renderer.get(), SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); yaze::core::CreateWindow(window, test_renderer.get(),
SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
// Renderer is now owned by test // Renderer is now owned by test
// Setup Dear ImGui context // Setup Dear ImGui context
IMGUI_CHECKVERSION(); IMGUI_CHECKVERSION();
ImGui::CreateContext(); ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io; ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls (void)io;
io.ConfigFlags |=
ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows io.ConfigFlags |=
ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
// Setup Dear ImGui style // Setup Dear ImGui style
ImGui::StyleColorsDark(); ImGui::StyleColorsDark();
@@ -292,7 +297,8 @@ int main(int argc, char* argv[]) {
} }
// Setup Platform/Renderer backends // Setup Platform/Renderer backends
SDL_Renderer* sdl_renderer = static_cast<SDL_Renderer*>(test_renderer->GetBackendRenderer()); SDL_Renderer* sdl_renderer =
static_cast<SDL_Renderer*>(test_renderer->GetBackendRenderer());
ImGui_ImplSDL2_InitForSDLRenderer(window.window_.get(), sdl_renderer); ImGui_ImplSDL2_InitForSDLRenderer(window.window_.get(), sdl_renderer);
ImGui_ImplSDLRenderer2_Init(sdl_renderer); ImGui_ImplSDLRenderer2_Init(sdl_renderer);
@@ -307,20 +313,25 @@ int main(int argc, char* argv[]) {
// Log test speed mode // Log test speed mode
const char* speed_name = "Fast"; const char* speed_name = "Fast";
if (config.test_speed == ImGuiTestRunSpeed_Normal) speed_name = "Normal"; if (config.test_speed == ImGuiTestRunSpeed_Normal)
else if (config.test_speed == ImGuiTestRunSpeed_Cinematic) speed_name = "Cinematic"; speed_name = "Normal";
else if (config.test_speed == ImGuiTestRunSpeed_Cinematic)
speed_name = "Cinematic";
std::cout << "Running tests in " << speed_name << " mode" << std::endl; std::cout << "Running tests in " << speed_name << " mode" << std::endl;
// Register E2E tests only for GUI test targets (they have the source files) // Register E2E tests only for GUI test targets (they have the source files)
#ifdef YAZE_GUI_TEST_TARGET #ifdef YAZE_GUI_TEST_TARGET
ImGuiTest* smoke_test = IM_REGISTER_TEST(engine, "E2ETest", "FrameworkSmokeTest"); ImGuiTest* smoke_test =
IM_REGISTER_TEST(engine, "E2ETest", "FrameworkSmokeTest");
smoke_test->TestFunc = E2ETest_FrameworkSmokeTest; smoke_test->TestFunc = E2ETest_FrameworkSmokeTest;
ImGuiTest* canvas_test = IM_REGISTER_TEST(engine, "E2ETest", "CanvasSelectionTest"); ImGuiTest* canvas_test =
IM_REGISTER_TEST(engine, "E2ETest", "CanvasSelectionTest");
canvas_test->TestFunc = E2ETest_CanvasSelectionTest; canvas_test->TestFunc = E2ETest_CanvasSelectionTest;
canvas_test->UserData = &controller; canvas_test->UserData = &controller;
ImGuiTest* dungeon_test = IM_REGISTER_TEST(engine, "E2ETest", "DungeonEditorSmokeTest"); ImGuiTest* dungeon_test =
IM_REGISTER_TEST(engine, "E2ETest", "DungeonEditorSmokeTest");
dungeon_test->TestFunc = E2ETest_DungeonEditorV2SmokeTest; dungeon_test->TestFunc = E2ETest_DungeonEditorV2SmokeTest;
dungeon_test->UserData = &controller; dungeon_test->UserData = &controller;
#endif #endif
@@ -334,7 +345,9 @@ int main(int argc, char* argv[]) {
if (event.type == SDL_QUIT) { if (event.type == SDL_QUIT) {
done = true; done = true;
} }
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window.window_.get())) { if (event.type == SDL_WINDOWEVENT &&
event.window.event == SDL_WINDOWEVENT_CLOSE &&
event.window.windowID == SDL_GetWindowID(window.window_.get())) {
done = true; done = true;
} }
} }