Enhance CMake configuration for UI tests and SDL2 linking
- Added support for UI tests in the CMake configuration by introducing the YAZE_ENABLE_UI_TESTS option, ensuring proper linking with the ImGuiTestEngine if available. - Updated SDL2 linking in test CMakeLists to use variable targets for improved flexibility and compatibility across platforms. - Modified sprite_position_test to check for ROM file existence using std::ifstream for better error handling.
This commit is contained in:
@@ -90,10 +90,14 @@ target_link_libraries(
|
||||
)
|
||||
|
||||
# Conditionally link ImGui Test Engine
|
||||
if(YAZE_ENABLE_UI_TESTS AND TARGET ImGuiTestEngine)
|
||||
target_include_directories(yaze PUBLIC ${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine)
|
||||
target_link_libraries(yaze PUBLIC ${IMGUI_TEST_ENGINE_TARGET})
|
||||
target_compile_definitions(yaze PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=1)
|
||||
if(YAZE_ENABLE_UI_TESTS)
|
||||
if(TARGET ImGuiTestEngine)
|
||||
target_include_directories(yaze PUBLIC ${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine)
|
||||
target_link_libraries(yaze PUBLIC ImGuiTestEngine)
|
||||
target_compile_definitions(yaze PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=1)
|
||||
else()
|
||||
target_compile_definitions(yaze PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=0)
|
||||
endif()
|
||||
else()
|
||||
target_compile_definitions(yaze PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=0)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user