From 18986e365674372f8b7b1bc8fe6c139b329b024a Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 11 Oct 2025 12:19:51 -0400 Subject: [PATCH] refactor(cmake): update include paths and defer test support linkage - Updated include paths in several source files to reflect the new directory structure, ensuring consistency across the project. - Deferred the linkage of the yaze_test_support library to the test.cmake file for better dependency management and ordering. Benefits: - Improved organization of include paths for better maintainability. - Enhanced modularity by managing test dependencies separately. --- src/app/editor/editor_library.cmake | 5 +---- src/app/editor/editor_manager.cc | 10 +++++++++- src/app/editor/editor_manager.h | 5 +++-- src/app/editor/overworld/scratch_space.cc | 2 +- src/app/editor/system/settings_editor.h | 2 +- src/app/emu/emu.cmake | 1 - test/CMakeLists.txt | 1 + 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/app/editor/editor_library.cmake b/src/app/editor/editor_library.cmake index 336270dd..764f2a8c 100644 --- a/src/app/editor/editor_library.cmake +++ b/src/app/editor/editor_library.cmake @@ -108,10 +108,7 @@ target_link_libraries(yaze_editor PUBLIC ImGui ) -# Link test support library if testing is enabled (for TestManager) -if(YAZE_BUILD_TESTS AND TARGET yaze_test_support) - target_link_libraries(yaze_editor PUBLIC yaze_test_support) -endif() +# Note: yaze_test_support linking is deferred to test.cmake to ensure proper ordering if(YAZE_WITH_JSON) target_include_directories(yaze_editor PUBLIC diff --git a/src/app/editor/editor_manager.cc b/src/app/editor/editor_manager.cc index 932dbef5..c1c65e23 100644 --- a/src/app/editor/editor_manager.cc +++ b/src/app/editor/editor_manager.cc @@ -54,12 +54,14 @@ #include "app/editor/system/toast_manager.h" #include "app/emu/emulator.h" #include "app/gfx/performance/performance_dashboard.h" -#include "editor/editor.h" +#include "app/editor/editor.h" #ifdef YAZE_WITH_GRPC #include "app/core/service/screenshot_utils.h" #include "app/editor/agent/agent_chat_widget.h" +#include "cli/service/agent/agent_control_server.h" #include "cli/service/agent/conversational_agent_service.h" #include "cli/service/ai/gemini_ai_service.h" +#include "absl/flags/flag.h" #endif #ifdef YAZE_WITH_GRPC #include "app/editor/agent/automation_bridge.h" @@ -539,6 +541,12 @@ void EditorManager::Initialize(gfx::IRenderer* renderer, const std::string& file context_.shortcut_manager.RegisterShortcut( "Proposal Drawer", {ImGuiKey_P, ImGuiMod_Ctrl}, [this]() { proposal_drawer_.Toggle(); }); + + // Start the agent control server if the flag is set + if (absl::GetFlag(FLAGS_agent_control)) { + agent_control_server_ = std::make_unique(&emulator_); + agent_control_server_->Start(); + } #endif // Testing shortcuts (only when tests are enabled) diff --git a/src/app/editor/editor_manager.h b/src/app/editor/editor_manager.h index 8c72b787..23761d43 100644 --- a/src/app/editor/editor_manager.h +++ b/src/app/editor/editor_manager.h @@ -1,8 +1,8 @@ #ifndef YAZE_APP_EDITOR_EDITOR_MANAGER_H #define YAZE_APP_EDITOR_EDITOR_MANAGER_H -#include "editor/system/user_settings.h" -#include "editor/ui/workspace_manager.h" +#include "app/editor/system/user_settings.h" +#include "app/editor/ui/workspace_manager.h" #define IMGUI_DEFINE_MATH_OPERATORS #include "imgui/imgui.h" @@ -278,6 +278,7 @@ class EditorManager { #ifdef YAZE_WITH_GRPC // Agent editor - manages chat, collaboration, and network coordination AgentEditor agent_editor_; + std::unique_ptr agent_control_server_; #endif std::string version_ = ""; diff --git a/src/app/editor/overworld/scratch_space.cc b/src/app/editor/overworld/scratch_space.cc index 89bf28e2..dcdbaaa1 100644 --- a/src/app/editor/overworld/scratch_space.cc +++ b/src/app/editor/overworld/scratch_space.cc @@ -1,4 +1,4 @@ -#include "editor/overworld/overworld_editor.h" +#include "app/editor/overworld/overworld_editor.h" #include #include diff --git a/src/app/editor/system/settings_editor.h b/src/app/editor/system/settings_editor.h index 333f479a..995cfb91 100644 --- a/src/app/editor/system/settings_editor.h +++ b/src/app/editor/system/settings_editor.h @@ -4,7 +4,7 @@ #include "absl/status/status.h" #include "app/editor/editor.h" #include "app/rom.h" -#include "editor/system/user_settings.h" +#include "app/editor/system/user_settings.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/emu/emu.cmake b/src/app/emu/emu.cmake index 50ba7d88..e159fa5c 100644 --- a/src/app/emu/emu.cmake +++ b/src/app/emu/emu.cmake @@ -21,7 +21,6 @@ if(YAZE_BUILD_EMU AND NOT YAZE_MINIMAL_BUILD) yaze_editor yaze_emulator yaze_agent - yaze_test_support absl::flags absl::flags_parse absl::failure_signal_handler diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0d5eaf88..b2226226 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,6 +16,7 @@ if(YAZE_BUILD_TESTS) ${CMAKE_SOURCE_DIR}/src/lib ${CMAKE_SOURCE_DIR}/src/lib/imgui ${CMAKE_SOURCE_DIR}/src/lib/imgui/backends + ${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine ${CMAKE_SOURCE_DIR}/src/lib/SDL/include ${CMAKE_BINARY_DIR}/src/lib/SDL/include ${PROJECT_BINARY_DIR}