add_library(test_support STATIC mmio_stub.cpp)
add_executable(test_updater_window test_updater_window.cpp ${CMAKE_SOURCE_DIR}/updater/app.manifest)
target_link_libraries(test_updater_window PRIVATE uc_update_process uc_launcher_locale shell32 user32 gdi32 dwmapi)
target_compile_definitions(test_updater_window PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)
add_test(NAME test_updater_window COMMAND test_updater_window)
add_executable(test_update_ui test_update_ui.cpp)
target_link_libraries(test_update_ui PRIVATE uc_update_ui uc_ui_style)
target_compile_definitions(test_update_ui PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)
add_custom_command(TARGET test_update_ui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3-shared> $<TARGET_FILE_DIR:test_update_ui>)
add_test(NAME test_update_ui COMMAND test_update_ui)
add_executable(test_update_controller test_update_controller.cpp)
target_link_libraries(test_update_controller PRIVATE uc_launcher_update)
target_compile_definitions(test_update_controller PRIVATE UC_SOURCE_DIR="${CMAKE_SOURCE_DIR}" NOMINMAX WIN32_LEAN_AND_MEAN)
add_test(NAME test_update_controller COMMAND test_update_controller)
add_executable(test_update_process test_update_process.cpp)
target_link_libraries(test_update_process PRIVATE uc_update_process)
add_executable(update_test_child update_test_child.cpp)
target_link_libraries(update_test_child PRIVATE uc_update_process)
target_compile_definitions(update_test_child PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)
add_dependencies(test_update_process update_test_child)
target_compile_definitions(test_update_process PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)
add_test(NAME test_update_process COMMAND test_update_process)
add_executable(test_update_release test_update_release.cpp)
target_link_libraries(test_update_release PRIVATE uc_update_core)
target_compile_definitions(test_update_release PRIVATE UC_SOURCE_DIR="${CMAKE_SOURCE_DIR}")
add_test(NAME test_update_release COMMAND test_update_release)
add_executable(test_update_sha256 test_update_sha256.cpp)
target_link_libraries(test_update_sha256 PRIVATE uc_update_core)
add_test(NAME test_update_sha256 COMMAND test_update_sha256)
add_executable(test_update_package test_update_package.cpp)
target_link_libraries(test_update_package PRIVATE uc_update_core)
target_compile_definitions(test_update_package PRIVATE UC_SOURCE_DIR="${CMAKE_SOURCE_DIR}" NOMINMAX WIN32_LEAN_AND_MEAN)
add_test(NAME test_update_package COMMAND test_update_package)
add_executable(test_update_download test_update_download.cpp)
target_link_libraries(test_update_download PRIVATE uc_update_download)
target_compile_definitions(test_update_download PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)
add_test(NAME test_update_download COMMAND test_update_download)
add_executable(test_update_transaction test_update_transaction.cpp)
target_link_libraries(test_update_transaction PRIVATE uc_update_core)
target_compile_definitions(test_update_transaction PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)
add_test(NAME test_update_transaction COMMAND test_update_transaction)
add_executable(test_nat_mapping test_nat_mapping.cpp)
target_link_libraries(test_nat_mapping PRIVATE uc_nat)
add_test(NAME test_nat_mapping COMMAND test_nat_mapping)
add_executable(test_nat_tunnel test_nat_tunnel.cpp)
target_link_libraries(test_nat_tunnel PRIVATE uc_nat uc_netplay)
add_test(NAME test_nat_tunnel COMMAND test_nat_tunnel)
add_executable(test_network_session test_network_session.cpp)
target_link_libraries(test_network_session PRIVATE uc_nat ws2_32)
add_test(NAME test_network_session COMMAND test_network_session)
add_executable(test_rollback_memory test_rollback_memory.cpp)
target_link_libraries(test_rollback_memory PRIVATE uc_runtime test_support)
add_test(NAME test_rollback_memory COMMAND test_rollback_memory)
add_executable(test_save_rollback test_save_rollback.cpp)
target_link_libraries(test_save_rollback PRIVATE uc_runtime)
add_test(NAME test_save_rollback COMMAND test_save_rollback)
add_executable(test_hle_restore test_hle_restore.cpp)
target_link_libraries(test_hle_restore PRIVATE uc_runtime test_support)
add_test(NAME test_hle_restore COMMAND test_hle_restore)
add_executable(test_sched_restore test_sched_restore.cpp)
target_link_libraries(test_sched_restore PRIVATE uc_runtime test_support)
add_test(NAME test_sched_restore COMMAND test_sched_restore)
add_executable(test_game_loop test_game_loop.cpp)
target_link_libraries(test_game_loop PRIVATE uc_game_pacing test_support)
add_test(NAME test_game_loop COMMAND test_game_loop)
add_executable(test_netplay test_netplay.cpp)
target_link_libraries(test_netplay PRIVATE uc_netplay)
add_test(NAME test_netplay COMMAND test_netplay)
add_executable(test_netplay_stream test_netplay_stream.cpp)
target_link_libraries(test_netplay_stream PRIVATE uc_netplay)
add_test(NAME test_netplay_stream COMMAND test_netplay_stream)
add_executable(test_netplay_datagram test_netplay_datagram.cpp)
target_link_libraries(test_netplay_datagram PRIVATE uc_netplay)
add_test(NAME test_netplay_datagram COMMAND test_netplay_datagram)
add_executable(test_netplay_frame test_netplay_frame.cpp)
target_link_libraries(test_netplay_frame PRIVATE uc_netplay_game test_support)
add_test(NAME test_netplay_frame COMMAND test_netplay_frame)
add_executable(test_netplay_saves test_netplay_saves.cpp)
target_link_libraries(test_netplay_saves PRIVATE uc_netplay_game test_support)
add_test(NAME test_netplay_saves COMMAND test_netplay_saves)
add_executable(test_audio_startup test_audio_startup.cpp ${CMAKE_SOURCE_DIR}/game/audio_startup.cpp)
target_include_directories(test_audio_startup PRIVATE ${CMAKE_SOURCE_DIR}/game)
target_link_libraries(test_audio_startup PRIVATE test_support)
add_test(NAME test_audio_startup COMMAND test_audio_startup)
add_executable(test_audio_startup_restore test_audio_startup_restore.cpp ${CMAKE_SOURCE_DIR}/game/audio_startup.cpp)
target_include_directories(test_audio_startup_restore PRIVATE ${CMAKE_SOURCE_DIR}/game)
target_link_libraries(test_audio_startup_restore PRIVATE test_support)
add_test(NAME test_audio_startup_restore COMMAND test_audio_startup_restore)
add_executable(test_fifo_replay test_fifo_replay.cpp)
target_link_libraries(test_fifo_replay PRIVATE uc_dff)
add_test(NAME test_fifo_replay COMMAND test_fifo_replay)
add_executable(test_fifo_stream test_fifo_stream.cpp)
target_link_libraries(test_fifo_stream PRIVATE uc_fifo_stream)
add_test(NAME test_fifo_stream COMMAND test_fifo_stream)
add_executable(test_image_compare test_image_compare.cpp)
target_link_libraries(test_image_compare PRIVATE uc_replay_images)
add_test(NAME test_image_compare COMMAND test_image_compare)
target_link_libraries(test_support PUBLIC uc_runtime)
add_executable(test_coop_roster test_coop_roster.cpp)
target_link_libraries(test_coop_roster PRIVATE uc_coop_roster)
target_include_directories(test_coop_roster PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_coop_roster COMMAND test_coop_roster)
add_executable(test_coop_config test_coop_config.cpp)
target_link_libraries(test_coop_config PRIVATE uc_coop_config)
target_include_directories(test_coop_config PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_coop_config COMMAND test_coop_config)
add_executable(test_input_bindings test_input_bindings.cpp)
target_link_libraries(test_input_bindings PRIVATE uc_input)
add_test(NAME test_input_bindings COMMAND test_input_bindings)
add_executable(test_gx_io test_gx_io.cpp)
target_link_libraries(test_gx_io PRIVATE uc_runtime)
add_test(NAME test_gx_io COMMAND test_gx_io)
add_executable(test_late_aim test_late_aim.cpp)
target_link_libraries(test_late_aim PRIVATE uc_gx)
add_test(NAME test_late_aim COMMAND test_late_aim)
add_executable(test_ultrawide test_ultrawide.cpp)
target_link_libraries(test_ultrawide PRIVATE uc_gx)
add_test(NAME test_ultrawide COMMAND test_ultrawide)
add_executable(test_gx_vertices test_gx_vertices.cpp)
target_link_libraries(test_gx_vertices PRIVATE uc_gx)
add_test(NAME test_gx_vertices COMMAND test_gx_vertices)
add_executable(test_gx_transforms test_gx_transforms.cpp)
target_link_libraries(test_gx_transforms PRIVATE uc_gx)
add_test(NAME test_gx_transforms COMMAND test_gx_transforms)
add_executable(test_gx_packets test_gx_packets.cpp)
target_link_libraries(test_gx_packets PRIVATE uc_gx)
add_test(NAME test_gx_packets COMMAND test_gx_packets)
add_executable(test_gx_scene test_gx_scene.cpp)
target_link_libraries(test_gx_scene PRIVATE uc_gx)
add_test(NAME test_gx_scene COMMAND test_gx_scene)
add_executable(test_gx_textures test_gx_textures.cpp)
target_link_libraries(test_gx_textures PRIVATE uc_gx)
add_test(NAME test_gx_textures COMMAND test_gx_textures)
add_executable(test_texture_replacement test_texture_replacement.cpp)
target_include_directories(test_texture_replacement PRIVATE ${CMAKE_SOURCE_DIR}/tools/texture_convert)
target_link_libraries(test_texture_replacement PRIVATE uc_gx)
add_test(NAME test_texture_replacement COMMAND test_texture_replacement)
add_executable(test_gx_materials test_gx_materials.cpp)
target_link_libraries(test_gx_materials PRIVATE uc_gx)
add_test(NAME test_gx_materials COMMAND test_gx_materials)
add_executable(test_render_scale test_render_scale.cpp)
target_link_libraries(test_render_scale PRIVATE uc_gx)
add_test(NAME test_render_scale COMMAND test_render_scale)
add_executable(test_native_viewport test_native_viewport.cpp)
target_link_libraries(test_native_viewport PRIVATE uc_gx)
add_test(NAME test_native_viewport COMMAND test_native_viewport)
add_executable(test_native_tev test_native_tev.cpp)
target_link_libraries(test_native_tev PRIVATE uc_directx)
target_include_directories(test_native_tev PRIVATE ${CMAKE_SOURCE_DIR}/renderer)
add_test(NAME test_native_tev COMMAND test_native_tev)
add_executable(test_upscale_math test_upscale_math.cpp)
target_link_libraries(test_upscale_math PRIVATE uc_gx)
add_test(NAME test_upscale_math COMMAND test_upscale_math)
add_executable(test_scene_boundary test_scene_boundary.cpp)
target_link_libraries(test_scene_boundary PRIVATE uc_gx)
target_compile_definitions(test_scene_boundary PRIVATE UC_SCENE_DATA="${CMAKE_CURRENT_SOURCE_DIR}/data/scene_boundary")
add_test(NAME test_scene_boundary COMMAND test_scene_boundary)
add_executable(test_motion_tracker test_motion_tracker.cpp)
target_link_libraries(test_motion_tracker PRIVATE uc_gx)
add_test(NAME test_motion_tracker COMMAND test_motion_tracker)
add_executable(test_post_effects test_post_effects.cpp)
target_link_libraries(test_post_effects PRIVATE uc_gx)
add_test(NAME test_post_effects COMMAND test_post_effects)
add_executable(test_raster_effects_math test_raster_effects_math.cpp)
target_link_libraries(test_raster_effects_math PRIVATE uc_gx)
add_test(NAME test_raster_effects_math COMMAND test_raster_effects_math)
add_executable(test_rt_effects test_rt_effects.cpp)
target_include_directories(test_rt_effects PRIVATE ${CMAKE_SOURCE_DIR}/renderer)
add_test(NAME test_rt_effects COMMAND test_rt_effects)
add_executable(test_scene_lights test_scene_lights.cpp)
target_link_libraries(test_scene_lights PRIVATE uc_gx)
add_test(NAME test_scene_lights COMMAND test_scene_lights)
add_executable(test_shadow_math test_shadow_math.cpp)
target_link_libraries(test_shadow_math PRIVATE uc_gx)
add_test(NAME test_shadow_math COMMAND test_shadow_math)
add_executable(test_view_reconstruct test_view_reconstruct.cpp)
target_link_libraries(test_view_reconstruct PRIVATE uc_gx)
add_test(NAME test_view_reconstruct COMMAND test_view_reconstruct)
add_executable(test_gbuffer test_gbuffer.cpp)
target_link_libraries(test_gbuffer PRIVATE uc_gx)
add_test(NAME test_gbuffer COMMAND test_gbuffer)
add_executable(test_copy_scale test_copy_scale.cpp)
target_link_libraries(test_copy_scale PRIVATE uc_gx)
add_test(NAME test_copy_scale COMMAND test_copy_scale)
add_executable(test_rt_material test_rt_material.cpp)
target_link_libraries(test_rt_material PRIVATE uc_gx)
add_test(NAME test_rt_material COMMAND test_rt_material)
add_executable(test_rt_denoise_math test_rt_denoise_math.cpp)
target_include_directories(test_rt_denoise_math PRIVATE ${CMAKE_SOURCE_DIR}/renderer)
add_test(NAME test_rt_denoise_math COMMAND test_rt_denoise_math)
add_executable(test_rt_shadow_math test_rt_shadow_math.cpp)
target_link_libraries(test_rt_shadow_math PRIVATE uc_gx)
add_test(NAME test_rt_shadow_math COMMAND test_rt_shadow_math)
add_executable(test_rt_ao_math test_rt_ao_math.cpp)
target_link_libraries(test_rt_ao_math PRIVATE uc_gx)
add_test(NAME test_rt_ao_math COMMAND test_rt_ao_math)
add_executable(test_rt_reflect_math test_rt_reflect_math.cpp)
target_link_libraries(test_rt_reflect_math PRIVATE uc_gx)
add_test(NAME test_rt_reflect_math COMMAND test_rt_reflect_math)
add_executable(test_rt_light_math test_rt_light_math.cpp)
target_link_libraries(test_rt_light_math PRIVATE uc_gx)
add_test(NAME test_rt_light_math COMMAND test_rt_light_math)
add_executable(test_rt_path_math test_rt_path_math.cpp)
target_link_libraries(test_rt_path_math PRIVATE uc_gx)
add_test(NAME test_rt_path_math COMMAND test_rt_path_math)
add_executable(test_rr_math test_rr_math.cpp)
target_include_directories(test_rr_math PRIVATE ${CMAKE_SOURCE_DIR}/renderer)
add_test(NAME test_rr_math COMMAND test_rr_math)
add_executable(test_hdr_math test_hdr_math.cpp)
target_include_directories(test_hdr_math PRIVATE ${CMAKE_SOURCE_DIR}/renderer)
add_test(NAME test_hdr_math COMMAND test_hdr_math)
add_executable(test_bloom_math test_bloom_math.cpp)
target_include_directories(test_bloom_math PRIVATE ${CMAKE_SOURCE_DIR}/renderer)
add_test(NAME test_bloom_math COMMAND test_bloom_math)
add_executable(test_rt_mesh_cache test_rt_mesh_cache.cpp)
target_include_directories(test_rt_mesh_cache PRIVATE ${CMAKE_SOURCE_DIR}/renderer)
add_test(NAME test_rt_mesh_cache COMMAND test_rt_mesh_cache)
add_executable(test_rt_ui test_rt_ui.cpp)
target_include_directories(test_rt_ui PRIVATE ${CMAKE_SOURCE_DIR}/game ${CMAKE_SOURCE_DIR}/renderer)
add_test(NAME test_rt_ui COMMAND test_rt_ui)
add_executable(test_dlss5_settings test_dlss5_settings.cpp)
target_include_directories(test_dlss5_settings PRIVATE ${CMAKE_SOURCE_DIR}/renderer)
add_test(NAME test_dlss5_settings COMMAND test_dlss5_settings)
add_executable(test_ngx_dlss5 test_ngx_dlss5.cpp)
target_link_libraries(test_ngx_dlss5 PRIVATE uc_dlss5)
add_test(NAME test_ngx_dlss5 COMMAND test_ngx_dlss5)
add_executable(test_rebuild_gate test_rebuild_gate.cpp)
target_link_libraries(test_rebuild_gate PRIVATE uc_gx)
add_test(NAME test_rebuild_gate COMMAND test_rebuild_gate)
add_executable(test_buffer_memory test_buffer_memory.cpp)
target_link_libraries(test_buffer_memory PRIVATE uc_vulkan)
add_test(NAME test_buffer_memory COMMAND test_buffer_memory)
add_executable(test_pipeline_keys test_pipeline_keys.cpp)
target_link_libraries(test_pipeline_keys PRIVATE uc_vulkan)
add_test(NAME test_pipeline_keys COMMAND test_pipeline_keys)
add_executable(test_rt_instances test_rt_instances.cpp)
target_link_libraries(test_rt_instances PRIVATE uc_vulkan)
add_test(NAME test_rt_instances COMMAND test_rt_instances)
add_executable(test_mesh_hle test_mesh_hle.cpp)
target_link_libraries(test_mesh_hle PRIVATE test_support)
add_test(NAME test_mesh_hle COMMAND test_mesh_hle)
add_executable(test_texture_matrix_hle test_texture_matrix_hle.cpp)
target_link_libraries(test_texture_matrix_hle PRIVATE test_support)
add_test(NAME test_texture_matrix_hle COMMAND test_texture_matrix_hle)
add_executable(test_efb_hle test_efb_hle.cpp)
target_link_libraries(test_efb_hle PRIVATE test_support)
add_test(NAME test_efb_hle COMMAND test_efb_hle)
add_executable(test_gx_gap_audit test_gx_gap_audit.cpp)
target_link_libraries(test_gx_gap_audit PRIVATE test_support)
add_test(NAME test_gx_gap_audit COMMAND test_gx_gap_audit)
add_executable(test_crash_report test_crash_report.cpp)
target_link_libraries(test_crash_report PRIVATE test_support)
add_test(NAME test_crash_report COMMAND test_crash_report)
add_executable(test_crash_bundle test_crash_bundle.cpp)
target_link_libraries(test_crash_bundle PRIVATE test_support uc_crash_bundle)
add_test(NAME test_crash_bundle COMMAND test_crash_bundle)
add_executable(test_normal_matrix_hle test_normal_matrix_hle.cpp)
target_link_libraries(test_normal_matrix_hle PRIVATE test_support)
add_test(NAME test_normal_matrix_hle COMMAND test_normal_matrix_hle)
add_executable(test_ui_mode test_ui_mode.cpp)
target_link_libraries(test_ui_mode PRIVATE uc_ui_mode)
add_test(NAME test_ui_mode COMMAND test_ui_mode)
add_executable(test_options test_options.cpp)
target_link_libraries(test_options PRIVATE uc_options)
add_test(NAME test_options COMMAND test_options)
add_executable(test_window_mode test_window_mode.cpp)
target_link_libraries(test_window_mode PRIVATE uc_options)
add_test(NAME test_window_mode COMMAND test_window_mode)
add_custom_command(TARGET test_window_mode POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3-shared> $<TARGET_FILE_DIR:test_window_mode>)
add_executable(test_frame_limit test_frame_limit.cpp)
target_link_libraries(test_frame_limit PRIVATE uc_options)
add_test(NAME test_frame_limit COMMAND test_frame_limit)
add_executable(test_audio_gap_audit test_audio_gap_audit.cpp)
target_link_libraries(test_audio_gap_audit PRIVATE test_support)
add_test(NAME test_audio_gap_audit COMMAND test_audio_gap_audit)
add_executable(test_ax_audio test_ax_audio.cpp)
target_link_libraries(test_ax_audio PRIVATE test_support)
add_test(NAME test_ax_audio COMMAND test_ax_audio)
add_executable(test_ax_audio_fast test_ax_audio_fast.cpp)
target_link_libraries(test_ax_audio_fast PRIVATE test_support)
add_test(NAME test_ax_audio_fast COMMAND test_ax_audio_fast)
add_executable(test_audio_gap test_audio_gap.cpp)
target_include_directories(test_audio_gap PRIVATE ${CMAKE_SOURCE_DIR}/game)
add_test(NAME test_audio_gap COMMAND test_audio_gap)
add_executable(test_audio_output test_audio_output.cpp ${CMAKE_SOURCE_DIR}/game/audio_output.cpp)
target_include_directories(test_audio_output PRIVATE ${CMAKE_SOURCE_DIR}/game)
target_link_libraries(test_audio_output PRIVATE uc_vulkan uc_path_io)
add_test(NAME test_audio_output COMMAND test_audio_output)
add_custom_command(TARGET test_audio_output POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3-shared> $<TARGET_FILE_DIR:test_audio_output>)
add_executable(test_locked_copy test_locked_copy.cpp)
target_link_libraries(test_locked_copy PRIVATE test_support)
add_test(NAME test_locked_copy COMMAND test_locked_copy)
add_executable(test_intro test_intro.cpp)
target_link_libraries(test_intro PRIVATE uc_intro test_support)
add_test(NAME test_intro COMMAND test_intro)
add_executable(test_game_pacing test_game_pacing.cpp)
target_link_libraries(test_game_pacing PRIVATE uc_game_pacing test_support)
add_test(NAME test_game_pacing COMMAND test_game_pacing)
add_executable(test_frame_limit_cap test_frame_limit_cap.cpp)
target_link_libraries(test_frame_limit_cap PRIVATE uc_options uc_game_pacing test_support)
target_include_directories(test_frame_limit_cap PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_frame_limit_cap COMMAND test_frame_limit_cap)
add_executable(test_savefs test_savefs.cpp)
target_link_libraries(test_savefs PRIVATE uc_runtime)
add_test(NAME test_savefs COMMAND test_savefs)
if(WIN32)
  add_executable(test_windows_path test_windows_path.cpp)
  target_link_libraries(test_windows_path PRIVATE uc_windows_path)
  add_test(NAME test_windows_path COMMAND test_windows_path)
endif()
add_executable(test_save_hle test_save_hle.cpp)
target_link_libraries(test_save_hle PRIVATE test_support)
add_test(NAME test_save_hle COMMAND test_save_hle)
add_executable(test_game_language test_game_language.cpp)
target_link_libraries(test_game_language PRIVATE uc_runtime test_support)
add_test(NAME test_game_language COMMAND test_game_language)
add_executable(test_input test_input.cpp)
target_link_libraries(test_input PRIVATE test_support)
add_test(NAME test_input COMMAND test_input)
add_executable(test_input_probe test_input_probe.cpp)
target_link_libraries(test_input_probe PRIVATE uc_input_probe test_support)
add_test(NAME test_input_probe COMMAND test_input_probe)
add_executable(test_entry_probe test_entry_probe.cpp)
target_link_libraries(test_entry_probe PRIVATE uc_input_probe test_support)
add_test(NAME test_entry_probe COMMAND test_entry_probe)
add_executable(test_prompt_bridge test_prompt_bridge.cpp)
target_link_libraries(test_prompt_bridge PRIVATE uc_prompt_bridge test_support)
add_test(NAME test_prompt_bridge COMMAND test_prompt_bridge)
add_executable(test_game_input test_game_input.cpp)
target_link_libraries(test_game_input PRIVATE uc_game_input test_support)
add_test(NAME test_game_input COMMAND test_game_input)
add_executable(test_input_config test_input_config.cpp)
target_link_libraries(test_input_config PRIVATE uc_input_config uc_client_update_lock)
target_include_directories(test_input_config PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_input_config COMMAND test_input_config)
add_executable(test_gamepad_input test_gamepad_input.cpp)
target_link_libraries(test_gamepad_input PRIVATE uc_gamepad_input test_support)
add_test(NAME test_gamepad_input COMMAND test_gamepad_input)
add_custom_command(TARGET test_gamepad_input POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3-shared> $<TARGET_FILE_DIR:test_gamepad_input>)
add_executable(test_native_pad test_native_pad.cpp)
target_link_libraries(test_native_pad PRIVATE test_support)
add_test(NAME test_native_pad COMMAND test_native_pad)
add_executable(test_native_wii test_native_wii.cpp)
target_link_libraries(test_native_wii PRIVATE test_support)
add_test(NAME test_native_wii COMMAND test_native_wii)
add_executable(test_wiimote_input test_wiimote_input.cpp)
target_link_libraries(test_wiimote_input PRIVATE uc_wiimote_input)
target_include_directories(test_wiimote_input PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_wiimote_input COMMAND test_wiimote_input)
add_executable(test_wiimote_config test_wiimote_config.cpp)
target_link_libraries(test_wiimote_config PRIVATE uc_wiimote_config)
target_include_directories(test_wiimote_config PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_wiimote_config COMMAND test_wiimote_config)
add_executable(test_gamepad_config test_gamepad_config.cpp)
target_link_libraries(test_gamepad_config PRIVATE uc_gamepad_config)
target_include_directories(test_gamepad_config PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_gamepad_config COMMAND test_gamepad_config)
add_executable(test_wiimote_protocol test_wiimote_protocol.cpp)
target_link_libraries(test_wiimote_protocol PRIVATE uc_wiimote_protocol)
target_include_directories(test_wiimote_protocol PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_wiimote_protocol COMMAND test_wiimote_protocol)
add_executable(test_rumble_hold test_rumble_hold.cpp)
target_include_directories(test_rumble_hold PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/common)
add_test(NAME test_rumble_hold COMMAND test_rumble_hold)
add_executable(test_wiimote_math test_wiimote_math.cpp)
target_link_libraries(test_wiimote_math PRIVATE uc_wiimote_math)
target_include_directories(test_wiimote_math PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_wiimote_math COMMAND test_wiimote_math)
add_executable(test_gamepad_math test_gamepad_math.cpp)
target_link_libraries(test_gamepad_math PRIVATE uc_gamepad_math)
target_include_directories(test_gamepad_math PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_gamepad_math COMMAND test_gamepad_math)
add_executable(test_pad_glyphs test_pad_glyphs.cpp)
target_link_libraries(test_pad_glyphs PRIVATE uc_prompt_icons)
target_include_directories(test_pad_glyphs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_pad_glyphs COMMAND test_pad_glyphs)
add_executable(test_input_prompts test_input_prompts.cpp)
target_link_libraries(test_input_prompts PRIVATE uc_input_prompts)
target_include_directories(test_input_prompts PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_input_prompts COMMAND test_input_prompts)
add_executable(test_binding_editor test_binding_editor.cpp)
add_executable(test_deck_menu_nav test_deck_menu_nav.cpp)
target_link_libraries(test_deck_menu_nav PRIVATE uc_settings_registry)
target_include_directories(test_deck_menu_nav PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/game)
add_test(NAME test_deck_menu_nav COMMAND test_deck_menu_nav)
add_executable(test_deck_menu test_deck_menu.cpp ${CMAKE_SOURCE_DIR}/game/deck_menu.cpp)
target_link_libraries(test_deck_menu PRIVATE uc_live_settings uc_settings_registry uc_ui_style uc_launcher_locale uc_binding_editor uc_gamepad_panel uc_prompt_icons uc_vulkan uc_mods uc_deck_pages)
add_custom_command(TARGET test_deck_menu POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3-shared> $<TARGET_FILE_DIR:test_deck_menu>)
add_test(NAME test_deck_menu COMMAND test_deck_menu)
add_executable(test_settings_registry test_settings_registry.cpp)
target_link_libraries(test_settings_registry PRIVATE uc_settings_registry uc_launcher_locale)
target_include_directories(test_settings_registry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_settings_registry COMMAND test_settings_registry)
add_executable(test_launcher_locale test_launcher_locale.cpp)
target_link_libraries(test_launcher_locale PRIVATE uc_launcher_locale)
target_include_directories(test_launcher_locale PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/launcher ${CMAKE_SOURCE_DIR}/renderer)
add_test(NAME test_launcher_locale COMMAND test_launcher_locale)
target_link_libraries(test_binding_editor PRIVATE uc_binding_editor)
target_include_directories(test_binding_editor PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_binding_editor COMMAND test_binding_editor)
add_executable(test_feature_report test_feature_report.cpp)
target_link_libraries(test_feature_report PRIVATE uc_options_config)
add_test(NAME test_feature_report COMMAND test_feature_report)
add_executable(test_startup_error test_startup_error.cpp)
target_link_libraries(test_startup_error PRIVATE uc_options)
add_test(NAME test_startup_error COMMAND test_startup_error)
add_executable(test_host_keys test_host_keys.cpp)
target_link_libraries(test_host_keys PRIVATE SDL3::SDL3)
target_include_directories(test_host_keys PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/game)
add_test(NAME test_host_keys COMMAND test_host_keys)
add_executable(test_live_settings test_live_settings.cpp)
target_link_libraries(test_live_settings PRIVATE uc_live_settings)
target_include_directories(test_live_settings PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_live_settings COMMAND test_live_settings)
add_executable(test_settings_menu test_settings_menu.cpp ${CMAKE_SOURCE_DIR}/game/settings_menu.cpp)
target_link_libraries(test_settings_menu PRIVATE uc_live_settings uc_settings_registry uc_ui_style uc_launcher_locale uc_binding_editor uc_gamepad_panel uc_prompt_icons uc_vulkan uc_mods uc_deck_pages)
add_custom_command(TARGET test_settings_menu POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3-shared> $<TARGET_FILE_DIR:test_settings_menu>)
add_test(NAME test_settings_menu COMMAND test_settings_menu)
add_executable(test_mod_manifest test_mod_manifest.cpp)
target_link_libraries(test_mod_manifest PRIVATE uc_mods)
add_test(NAME test_mod_manifest COMMAND test_mod_manifest)
add_executable(test_mod_paths test_mod_paths.cpp)
target_link_libraries(test_mod_paths PRIVATE uc_mods)
add_test(NAME test_mod_paths COMMAND test_mod_paths)
add_executable(test_mod_zip test_mod_zip.cpp)
target_link_libraries(test_mod_zip PRIVATE uc_mods)
add_test(NAME test_mod_zip COMMAND test_mod_zip)
add_executable(test_mod_registry test_mod_registry.cpp)
target_link_libraries(test_mod_registry PRIVATE uc_mods)
add_test(NAME test_mod_registry COMMAND test_mod_registry)
add_executable(test_mod_standalone test_mod_standalone.cpp)
target_link_libraries(test_mod_standalone PRIVATE uc_mods)
add_test(NAME test_mod_standalone COMMAND test_mod_standalone)
add_executable(test_dvdfs_overlay test_dvdfs_overlay.cpp)
target_link_libraries(test_dvdfs_overlay PRIVATE uc_mods uc_runtime)
add_test(NAME test_dvdfs_overlay COMMAND test_dvdfs_overlay)
add_executable(test_mod_settings test_mod_settings.cpp)
target_link_libraries(test_mod_settings PRIVATE uc_mods)
add_test(NAME test_mod_settings COMMAND test_mod_settings)
add_executable(test_mod_api test_mod_api.cpp)
target_link_libraries(test_mod_api PRIVATE uc_mods uc_runtime)
target_compile_definitions(test_mod_api PRIVATE UC_API_SCHEMA="${CMAKE_SOURCE_DIR}/modding/api/uc_api.json")
add_test(NAME test_mod_api COMMAND test_mod_api)
add_executable(test_mod_lua test_mod_lua.cpp)
target_link_libraries(test_mod_lua PRIVATE uc_mods)
add_test(NAME test_mod_lua COMMAND test_mod_lua)
add_executable(test_mod_js test_mod_js.cpp)
target_link_libraries(test_mod_js PRIVATE uc_mods)
add_test(NAME test_mod_js COMMAND test_mod_js)
foreach(variant good major2 old_imgui init_fails)
  add_library(test_mod_dll_${variant} MODULE test_mod_dll.cpp)
  target_include_directories(test_mod_dll_${variant} PRIVATE ${CMAKE_SOURCE_DIR}/modding)
  set_target_properties(test_mod_dll_${variant} PROPERTIES PREFIX "")
endforeach()
target_compile_definitions(test_mod_dll_major2 PRIVATE TEST_DLL_API_MAJOR=2)
target_compile_definitions(test_mod_dll_old_imgui PRIVATE TEST_DLL_IMGUI="1.0.0")
target_compile_definitions(test_mod_dll_init_fails PRIVATE TEST_DLL_INIT_FAILS=1)
add_library(test_mod_dll_empty MODULE test_mod_dll_empty.cpp)
set_target_properties(test_mod_dll_empty PROPERTIES PREFIX "")
add_executable(test_mod_native test_mod_native.cpp)
target_link_libraries(test_mod_native PRIVATE uc_mods)
add_dependencies(test_mod_native test_mod_dll_good test_mod_dll_major2 test_mod_dll_old_imgui test_mod_dll_init_fails test_mod_dll_empty)
target_compile_definitions(test_mod_native PRIVATE TEST_DLL_GOOD="$<TARGET_FILE:test_mod_dll_good>" TEST_DLL_MAJOR2="$<TARGET_FILE:test_mod_dll_major2>"
  TEST_DLL_OLD_IMGUI="$<TARGET_FILE:test_mod_dll_old_imgui>" TEST_DLL_INIT_FAILS="$<TARGET_FILE:test_mod_dll_init_fails>" TEST_DLL_EMPTY="$<TARGET_FILE:test_mod_dll_empty>")
add_test(NAME test_mod_native COMMAND test_mod_native)
add_executable(test_mod_host test_mod_host.cpp)
target_link_libraries(test_mod_host PRIVATE uc_mods)
add_test(NAME test_mod_host COMMAND test_mod_host)
# This test measures sub-millisecond wall-time budgets; other test processes can preempt its mock callbacks.
set_tests_properties(test_mod_host PROPERTIES RUN_SERIAL TRUE)
add_executable(test_mod_hooks test_mod_hooks.cpp)
target_link_libraries(test_mod_hooks PRIVATE uc_mods)
add_test(NAME test_mod_hooks COMMAND test_mod_hooks)
add_executable(test_game_mods test_game_mods.cpp)
target_link_libraries(test_game_mods PRIVATE uc_game_mods uc_runtime)
add_test(NAME test_game_mods COMMAND test_game_mods)
add_executable(test_audio_decode test_audio_decode.cpp)
target_link_libraries(test_audio_decode PRIVATE uc_mods)
add_test(NAME test_audio_decode COMMAND test_audio_decode)
add_executable(test_audio_convert test_audio_convert.cpp)
target_link_libraries(test_audio_convert PRIVATE uc_mods)
add_test(NAME test_audio_convert COMMAND test_audio_convert)
add_executable(test_audio_converter test_audio_converter.cpp)
target_link_libraries(test_audio_converter PRIVATE uc_mods)
add_test(NAME test_audio_converter COMMAND test_audio_converter)
add_executable(test_txtres test_txtres.cpp)
target_link_libraries(test_txtres PRIVATE uc_mods)
add_test(NAME test_txtres COMMAND test_txtres)
add_executable(test_text_mods test_text_mods.cpp)
target_link_libraries(test_text_mods PRIVATE uc_mods)
add_test(NAME test_text_mods COMMAND test_text_mods)
add_executable(test_u8 test_u8.cpp)
target_link_libraries(test_u8 PRIVATE uc_mods)
add_test(NAME test_u8 COMMAND test_u8)
add_executable(test_arc_mods test_arc_mods.cpp)
target_link_libraries(test_arc_mods PRIVATE uc_mods)
add_test(NAME test_arc_mods COMMAND test_arc_mods)
add_executable(test_brstm test_brstm.cpp)
target_link_libraries(test_brstm PRIVATE uc_mods)
add_test(NAME test_brstm COMMAND test_brstm)
add_executable(test_mod_input test_mod_input.cpp)
target_link_libraries(test_mod_input PRIVATE uc_mods uc_runtime)
add_test(NAME test_mod_input COMMAND test_mod_input)
add_executable(test_mod_game_api test_mod_game_api.cpp)
target_link_libraries(test_mod_game_api PRIVATE uc_mods uc_runtime)
add_test(NAME test_mod_game_api COMMAND test_mod_game_api)
add_executable(test_mod_data_patch test_mod_data_patch.cpp)
target_link_libraries(test_mod_data_patch PRIVATE uc_mods)
add_test(NAME test_mod_data_patch COMMAND test_mod_data_patch)
add_executable(test_mod_name_patch test_mod_name_patch.cpp)
target_link_libraries(test_mod_name_patch PRIVATE uc_mods)
add_test(NAME test_mod_name_patch COMMAND test_mod_name_patch)
add_executable(test_mod_menu test_mod_menu.cpp ${CMAKE_SOURCE_DIR}/game/settings_menu.cpp)
target_link_libraries(test_mod_menu PRIVATE uc_mod_menu uc_live_settings uc_settings_registry uc_ui_style uc_launcher_locale uc_binding_editor uc_gamepad_panel uc_prompt_icons uc_vulkan)
add_custom_command(TARGET test_mod_menu POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3-shared> $<TARGET_FILE_DIR:test_mod_menu>)
add_test(NAME test_mod_menu COMMAND test_mod_menu)
add_executable(test_mod_examples test_mod_examples.cpp)
target_link_libraries(test_mod_examples PRIVATE uc_game_mods uc_runtime)
target_compile_definitions(test_mod_examples PRIVATE UC_EXAMPLES_DIR="${CMAKE_SOURCE_DIR}/mods-examples")
add_test(NAME test_mod_examples COMMAND test_mod_examples)
add_executable(test_options_config test_options_config.cpp)
target_link_libraries(test_options_config PRIVATE uc_options_config)
target_include_directories(test_options_config PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_options_config COMMAND test_options_config)
add_executable(test_hitch_report test_hitch_report.cpp)
target_include_directories(test_hitch_report PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/game)
add_test(NAME test_hitch_report COMMAND test_hitch_report)
add_executable(test_launch test_launch.cpp)
target_link_libraries(test_launch PRIVATE uc_launch shell32)
target_include_directories(test_launch PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_launch COMMAND test_launch)
add_executable(test_cpu_dispatch test_cpu_dispatch.cpp)
target_include_directories(test_cpu_dispatch PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(test_cpu_dispatch uc_dispatch)
add_test(NAME test_cpu_dispatch COMMAND test_cpu_dispatch $<TARGET_FILE:uc_dispatch>)
add_executable(test_image_unpack test_image_unpack.cpp)
target_link_libraries(test_image_unpack PRIVATE uc_image_unpack)
target_include_directories(test_image_unpack PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_image_unpack COMMAND test_image_unpack)
add_executable(test_cpu_calibration test_cpu_calibration.cpp)
target_link_libraries(test_cpu_calibration PRIVATE uc_cpu_calibration uc_client_update_lock)
add_test(NAME test_cpu_calibration COMMAND test_cpu_calibration)
add_executable(test_host_input test_host_input.cpp)
target_link_libraries(test_host_input PRIVATE uc_host_input test_support)
add_test(NAME test_host_input COMMAND test_host_input)
add_custom_command(TARGET test_host_input POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3-shared> $<TARGET_FILE_DIR:test_host_input>)
add_executable(test_evdev_logic test_evdev_logic.cpp)
target_link_libraries(test_evdev_logic PRIVATE uc_evdev_logic)
target_include_directories(test_evdev_logic PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_evdev_logic COMMAND test_evdev_logic)
add_executable(test_coop_session test_coop_session.cpp)
target_link_libraries(test_coop_session PRIVATE uc_coop_session test_support)
target_include_directories(test_coop_session PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_coop_session COMMAND test_coop_session)
add_custom_command(TARGET test_coop_session POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3-shared> $<TARGET_FILE_DIR:test_coop_session>)
add_executable(test_raw_pointer_math test_raw_pointer_math.cpp)
target_include_directories(test_raw_pointer_math PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/common)
add_test(NAME test_raw_pointer_math COMMAND test_raw_pointer_math)
add_executable(test_pointer_devices test_pointer_devices.cpp)
target_link_libraries(test_pointer_devices PRIVATE uc_pointer_feed test_support)
target_include_directories(test_pointer_devices PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_pointer_devices COMMAND test_pointer_devices)
add_custom_command(TARGET test_pointer_devices POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3-shared> $<TARGET_FILE_DIR:test_pointer_devices>)
add_executable(test_gx_hle test_gx_hle.cpp)
target_include_directories(test_gx_hle PRIVATE ${CMAKE_SOURCE_DIR}/runtime/hle)
target_link_libraries(test_gx_hle PRIVATE test_support)
add_test(NAME test_gx_hle COMMAND test_gx_hle)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
add_test(NAME test_build_release COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_build_release.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_slangc_quiet COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_slangc_quiet.py)
add_test(NAME test_build_release_deck COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_build_release_deck.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_update_end_to_end COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_update_end_to_end.py
  ${CMAKE_SOURCE_DIR} $<TARGET_FILE:uc_updater> $<TARGET_FILE:update_test_child> ${CMAKE_BINARY_DIR}/updater-runtime-sources.txt $<TARGET_FILE:test_launcher_update_bootstrap>)
set_tests_properties(test_update_end_to_end PROPERTIES TIMEOUT 180)
add_test(NAME test_nat_ports COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_nat_ports.py $<TARGET_FILE:test_nat_tunnel>)
set_tests_properties(test_nat_ports PROPERTIES RUN_SERIAL TRUE TIMEOUT 60 SKIP_RETURN_CODE 77)
add_test(NAME test_dolphin_reference COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_dolphin_reference.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_train_route COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_train_route.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_gx_list_audit COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_gx_list_audit.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_timing_audit COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_timing_audit.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_pacing_hooks COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_pacing_hooks.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_step_audit COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_step_audit.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_docs_links COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_docs_links.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_mod_api_generated COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_mod_api_generated.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_build_tools COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_build_tools.py ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build_tools)
foreach(t test_dol test_dol_scan test_isa test_analyzer test_isa_roundtrip test_emit test_dsy test_format)
  add_executable(${t} ${t}.cpp)
  target_link_libraries(${t} PRIVATE uc_common)
  target_include_directories(${t} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
  add_test(NAME ${t} COMMAND ${t})
endforeach()
foreach(t test_ppc_int test_ppc_mem test_ppc_float test_clock test_mmio test_lowmem test_sched test_os_hle test_dvd test_vi test_exi test_ios test_dsp test_gx_audit test_render_lifecycle test_sdk_math_hle test_sdk_regs_hle test_leaf_hle test_fcmp_fusion)
  if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${t}.cpp)
    add_executable(${t} ${t}.cpp)
    target_link_libraries(${t} PRIVATE test_support)
    target_include_directories(${t} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
    add_test(NAME ${t} COMMAND ${t})
  endif()
endforeach()

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opcheck.cpp
  COMMAND opcheck_gen ${CMAKE_CURRENT_BINARY_DIR}/opcheck.cpp DEPENDS opcheck_gen)
add_library(opcheck_obj OBJECT ${CMAKE_CURRENT_BINARY_DIR}/opcheck.cpp)
target_include_directories(opcheck_obj PRIVATE ${CMAKE_SOURCE_DIR}/runtime)
target_compile_options(opcheck_obj PRIVATE -Wno-unused-variable)
add_subdirectory(e2e)
add_executable(test_test_protocol test_test_protocol.cpp ${CMAKE_SOURCE_DIR}/game/test_protocol.cpp)
target_include_directories(test_test_protocol PRIVATE ${CMAKE_SOURCE_DIR}/game)
target_link_libraries(test_test_protocol PRIVATE test_support)
add_test(NAME test_test_protocol COMMAND test_test_protocol)
add_executable(test_test_state test_test_state.cpp ${CMAKE_SOURCE_DIR}/game/test_state.cpp)
target_include_directories(test_test_state PRIVATE ${CMAKE_SOURCE_DIR}/game)
target_link_libraries(test_test_state PRIVATE test_support)
add_test(NAME test_test_state COMMAND test_test_state)
add_executable(test_test_server test_test_server.cpp ${CMAKE_SOURCE_DIR}/game/test_server.cpp ${CMAKE_SOURCE_DIR}/game/test_pipe_win.cpp ${CMAKE_SOURCE_DIR}/game/test_protocol.cpp ${CMAKE_SOURCE_DIR}/game/test_state.cpp)
target_include_directories(test_test_server PRIVATE ${CMAKE_SOURCE_DIR}/game ${CMAKE_SOURCE_DIR}/runtime)
target_link_libraries(test_test_server PRIVATE test_support)
add_test(NAME test_test_server COMMAND test_test_server)
add_test(NAME test_uctest_client COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_uctest_client.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_uctest_dumpview COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_uctest_dumpview.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_uctest_steps COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_uctest_steps.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_uctest_language COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_uctest_language.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_loop_independence COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_loop_independence.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_hp_coverage COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_hp_coverage.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_leaf_tools COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_leaf_tools.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_inclusive_profile COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_inclusive_profile.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_perf_stats COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_perf_stats.py ${CMAKE_SOURCE_DIR})
add_test(NAME test_uctest_runsummary COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_uctest_runsummary.py ${CMAKE_SOURCE_DIR})
add_executable(test_test_draws test_test_draws.cpp ${CMAKE_SOURCE_DIR}/game/test_draws.cpp)
target_include_directories(test_test_draws PRIVATE ${CMAKE_SOURCE_DIR}/game ${CMAKE_SOURCE_DIR}/renderer)
target_link_libraries(test_test_draws PRIVATE test_support)
add_test(NAME test_test_draws COMMAND test_test_draws)
add_test(NAME test_uctest_autoplay COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_uctest_autoplay.py ${CMAKE_SOURCE_DIR})
add_executable(test_diagnostic_log test_diagnostic_log.cpp)
target_link_libraries(test_diagnostic_log PRIVATE uc_diagnostics)
add_test(NAME test_diagnostic_log COMMAND test_diagnostic_log)
set_tests_properties(test_diagnostic_log PROPERTIES TIMEOUT 15)
add_executable(test_compat_bswap test_compat_bswap.cpp)
target_include_directories(test_compat_bswap PRIVATE ${CMAKE_SOURCE_DIR}/runtime)
add_test(NAME test_compat_bswap COMMAND test_compat_bswap)
add_executable(test_clock_sleep test_clock_sleep.cpp)
target_link_libraries(test_clock_sleep PRIVATE test_support)
target_include_directories(test_clock_sleep PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_clock_sleep COMMAND test_clock_sleep)
add_executable(test_guest_mem_alias test_guest_mem_alias.cpp)
target_link_libraries(test_guest_mem_alias PRIVATE uc_runtime test_support)
target_include_directories(test_guest_mem_alias PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_guest_mem_alias COMMAND test_guest_mem_alias)
add_executable(test_path_io test_path_io.cpp)
target_link_libraries(test_path_io PRIVATE uc_path_io)
target_include_directories(test_path_io PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_path_io COMMAND test_path_io)
add_executable(test_deck_pages test_deck_pages.cpp)
target_link_libraries(test_deck_pages PRIVATE uc_deck_pages)
add_test(NAME test_deck_pages COMMAND test_deck_pages)
add_executable(test_deck_mods test_deck_mods.cpp)
target_link_libraries(test_deck_mods PRIVATE uc_deck_pages)
target_include_directories(test_deck_mods PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_deck_mods COMMAND test_deck_mods)
add_test(NAME test_deck_snapshot COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/test_deck_snapshot.py ${CMAKE_SOURCE_DIR})
add_executable(test_file_browser test_file_browser.cpp)
target_link_libraries(test_file_browser PRIVATE uc_file_browser)
add_test(NAME test_file_browser COMMAND test_file_browser)
add_executable(test_deck_game test_deck_game.cpp)
target_link_libraries(test_deck_game PRIVATE uc_deck_game)
add_test(NAME test_deck_game COMMAND test_deck_game)
add_executable(test_deck_focus test_deck_focus.cpp)
target_link_libraries(test_deck_focus PRIVATE uc_deck_nav)
add_test(NAME test_deck_focus COMMAND test_deck_focus)
add_executable(test_deck_nav_keys test_deck_nav_keys.cpp)
target_link_libraries(test_deck_nav_keys PRIVATE uc_deck_nav)
add_test(NAME test_deck_nav_keys COMMAND test_deck_nav_keys)
