Update CMake configuration and CI workflows for improved compatibility and testing
- Updated minimum CMake version requirement from 3.5 to 3.16 to leverage new features and policies. - Enhanced CI workflows to include additional build configurations for Ubuntu and macOS, improving cross-platform support. - Added conditional linking for ImGui Test Engine in the CMakeLists, allowing for UI testing when enabled. - Refactored CMake commands in CI to ensure consistent policy version handling and streamlined build processes. - Introduced new constructors for MenuItem in the GUI to enhance menu item management and flexibility.
This commit is contained in:
@@ -153,10 +153,14 @@ if (YAZE_BUILD_LIB)
|
||||
${ABSL_TARGETS}
|
||||
${SDL_TARGETS}
|
||||
${CMAKE_DL_LIBS}
|
||||
ImGuiTestEngine
|
||||
ImGui
|
||||
)
|
||||
|
||||
# Conditionally link ImGui Test Engine
|
||||
if(YAZE_ENABLE_UI_TESTS AND TARGET ImGuiTestEngine)
|
||||
target_link_libraries(yaze_c PRIVATE ImGuiTestEngine)
|
||||
endif()
|
||||
|
||||
# Conditionally link PNG if available
|
||||
if(PNG_FOUND)
|
||||
target_link_libraries(yaze_c PRIVATE ${PNG_LIBRARIES})
|
||||
|
||||
@@ -75,7 +75,9 @@ absl::Status ShutdownWindow(Window& window) {
|
||||
SDL_CloseAudioDevice(window.audio_device_);
|
||||
|
||||
// Stop test engine WHILE ImGui context is still valid
|
||||
#ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE
|
||||
test::TestManager::Get().StopUITesting();
|
||||
#endif
|
||||
|
||||
// Shutdown ImGui implementations
|
||||
ImGui_ImplSDL2_Shutdown();
|
||||
@@ -85,7 +87,9 @@ absl::Status ShutdownWindow(Window& window) {
|
||||
ImGui::DestroyContext();
|
||||
|
||||
// NOW destroy test engine context (after ImGui context is destroyed)
|
||||
#ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE
|
||||
test::TestManager::Get().DestroyUITestingContext();
|
||||
#endif
|
||||
|
||||
// Shutdown graphics arena BEFORE destroying SDL contexts
|
||||
gfx::Arena::Get().Shutdown();
|
||||
|
||||
@@ -87,6 +87,27 @@ struct MenuItem {
|
||||
std::function<void()> callback;
|
||||
std::function<bool()> enabled_condition = kDefaultEnabledCondition;
|
||||
std::vector<MenuItem> subitems;
|
||||
|
||||
// Default constructor
|
||||
MenuItem() = default;
|
||||
|
||||
// Constructor for basic menu items
|
||||
MenuItem(const std::string& name, const std::string& shortcut,
|
||||
std::function<void()> callback)
|
||||
: name(name), shortcut(shortcut), callback(callback) {}
|
||||
|
||||
// Constructor for menu items with enabled condition
|
||||
MenuItem(const std::string& name, const std::string& shortcut,
|
||||
std::function<void()> callback, std::function<bool()> enabled_condition)
|
||||
: name(name), shortcut(shortcut), callback(callback),
|
||||
enabled_condition(enabled_condition) {}
|
||||
|
||||
// Constructor for menu items with subitems
|
||||
MenuItem(const std::string& name, const std::string& shortcut,
|
||||
std::function<void()> callback, std::function<bool()> enabled_condition,
|
||||
std::vector<MenuItem> subitems)
|
||||
: name(name), shortcut(shortcut), callback(callback),
|
||||
enabled_condition(enabled_condition), subitems(std::move(subitems)) {}
|
||||
};
|
||||
using Menu = std::vector<MenuItem>;
|
||||
|
||||
|
||||
@@ -65,11 +65,15 @@ TestManager& TestManager::Get() {
|
||||
|
||||
TestManager::TestManager() {
|
||||
// Initialize UI test engine
|
||||
#ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE
|
||||
InitializeUITesting();
|
||||
#endif
|
||||
}
|
||||
|
||||
TestManager::~TestManager() {
|
||||
#ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE
|
||||
ShutdownUITesting();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <cmath>
|
||||
|
||||
namespace yaze {
|
||||
namespace util {
|
||||
|
||||
Reference in New Issue
Block a user