refactor(cmake): simplify ImGui test engine integration and feature flags

- Updated CMake configuration to always include the ImGui Test Engine when tests are enabled, removing conditional checks for UI tests.
- Simplified feature flag management by enabling JSON and gRPC by default, with a minimal build option to disable only the most expensive features.
- Enhanced status messages to provide clearer feedback on build configurations and feature availability.

Benefits:
- Streamlined integration of the ImGui Test Engine for testing purposes.
- Improved clarity in feature flag settings, making it easier to manage build configurations.
This commit is contained in:
scawful
2025-10-11 21:44:01 -04:00
parent 4358603874
commit d91dddfbe0
8 changed files with 33 additions and 72 deletions

View File

@@ -12,31 +12,21 @@ target_include_directories(ImGui PUBLIC ${SDL2_INCLUDE_DIR})
target_compile_definitions(ImGui PUBLIC
IMGUI_IMPL_OPENGL_LOADER_CUSTOM=<SDL2/SDL_opengl.h> GL_GLEXT_PROTOTYPES=1)
# Set up ImGui Test Engine sources and target conditionally
if(YAZE_ENABLE_UI_TESTS)
# ImGui Test Engine - Always built when tests are enabled for simplified integration
# The test infrastructure is tightly coupled with the editor, so we always include it
if(YAZE_BUILD_TESTS)
set(IMGUI_TEST_ENGINE_PATH ${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine/imgui_test_engine)
file(GLOB IMGUI_TEST_ENGINE_SOURCES ${IMGUI_TEST_ENGINE_PATH}/*.cpp)
add_library("ImGuiTestEngine" STATIC ${IMGUI_TEST_ENGINE_SOURCES})
target_include_directories(ImGuiTestEngine PUBLIC ${IMGUI_PATH} ${CMAKE_SOURCE_DIR}/src/lib)
target_link_libraries(ImGuiTestEngine PUBLIC ImGui)
# Enable test engine definitions only when UI tests are enabled
target_compile_definitions(ImGuiTestEngine PUBLIC
IMGUI_ENABLE_TEST_ENGINE=1
IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL=1)
# Also define for targets that link to ImGuiTestEngine
set(IMGUI_TEST_ENGINE_DEFINITIONS
IMGUI_ENABLE_TEST_ENGINE=1
IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL=1)
# Make ImGuiTestEngine target available
set(IMGUI_TEST_ENGINE_TARGET ImGuiTestEngine)
message(STATUS "✓ ImGui Test Engine enabled (tests are ON)")
else()
# Create empty variables when UI tests are disabled
set(IMGUI_TEST_ENGINE_SOURCES "")
set(IMGUI_TEST_ENGINE_TARGET "")
set(IMGUI_TEST_ENGINE_DEFINITIONS "")
message(STATUS "✗ ImGui Test Engine disabled (tests are OFF)")
endif()
set(