Refactor CMake configuration for ImGuiTestEngine and feature flags

- Updated the CMake configuration to use target_compile_definitions for ImGuiTestEngine, improving clarity and maintainability.
- Introduced IMGUI_TEST_ENGINE_DEFINITIONS to streamline the definition process for targets linking to ImGuiTestEngine.
- Modified feature flags in features.h to conditionally enable the native file dialog based on the YAZE_ENABLE_NFD flag, enhancing flexibility in feature management.
This commit is contained in:
scawful
2025-09-26 12:26:01 -04:00
parent d728ed37aa
commit 41a5b952e4
6 changed files with 22 additions and 8 deletions

View File

@@ -16,7 +16,14 @@ if(YAZE_ENABLE_UI_TESTS)
target_link_libraries(ImGuiTestEngine PUBLIC ImGui)
# Enable test engine definitions only when UI tests are enabled
add_definitions("-DIMGUI_ENABLE_TEST_ENGINE -DIMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL=1")
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)
@@ -24,6 +31,7 @@ else()
# Create empty variables when UI tests are disabled
set(IMGUI_TEST_ENGINE_SOURCES "")
set(IMGUI_TEST_ENGINE_TARGET "")
set(IMGUI_TEST_ENGINE_DEFINITIONS "")
endif()
set(