# Real F1 widgets, with a private instrumented ImGui and no window or ROM.
add_executable(triaevum_prebackend_budget_tests EXCLUDE_FROM_ALL prebackend_budget_tests.cpp)
target_compile_features(triaevum_prebackend_budget_tests PRIVATE cxx_std_20)
add_executable(triaevum_cpu_phase_probe_tests EXCLUDE_FROM_ALL
    ../../oot3d/native_game_runtime/oot3d_cpu_phase_probe_tests.cpp)
target_compile_features(triaevum_cpu_phase_probe_tests PRIVATE cxx_std_20)
target_compile_definitions(triaevum_cpu_phase_probe_tests PRIVATE TRIAEVUM_ENABLE_CPU_PHASE_PROBE=1)

FetchContent_GetProperties(ImGui SOURCE_DIR _f1_imgui_source)
add_executable(triaevum_f1_settings_smoke EXCLUDE_FROM_ALL
    f1_settings_panel_smoke.cpp
    ../../oot3d/native_game_runtime/oot3d_native_controls_settings_panel.cpp
    ../../../titles/oot3d/topscreen/oot3d_top_screen_settings_panel.cpp
    ../../oot3d/native_game_runtime/oot3d_photo_mode_panel.cpp
    ../../oot3d/native_game_runtime/oot3d_game_language.cpp
    ../../oot3d/native_game_runtime/oot3d_game_language_panel.cpp
    ../../oot3d/native_game_runtime/triaevum_audio_settings_panel.cpp
    ../../../titles/oot3d/environment/oot3d_scene_environment.cpp
    ../../../titles/oot3d/environment/oot3d_scene_environment_blend.cpp
    ../../../titles/oot3d/environment/oot3d_light_gizmo.cpp
    ../../../titles/oot3d/environment/oot3d_scene_environment_codec.cpp
    ../../../titles/oot3d/environment/oot3d_scene_environment_panel.cpp
    ../../oot3d/native_game_runtime/oot3d_savestate_panel.cpp
    ../../oot3d/native_game_runtime/oot3d_savestate_settings.cpp
    ../../oot3d/native_game_runtime/oot3d_savestate_library.cpp
    ${_f1_imgui_source}/imgui.cpp
    ${_f1_imgui_source}/imgui_draw.cpp
    ${_f1_imgui_source}/imgui_tables.cpp
    ${_f1_imgui_source}/imgui_widgets.cpp)
target_compile_features(triaevum_f1_settings_smoke PRIVATE cxx_std_20)
target_compile_definitions(triaevum_f1_settings_smoke PRIVATE IMGUI_ENABLE_TEST_ENGINE)
target_include_directories(triaevum_f1_settings_smoke PRIVATE
    ${_f1_imgui_source}
    ${PROJECT_SOURCE_DIR}/runtime/three_ds_recomp/src/fast/renderer)
target_link_libraries(triaevum_f1_settings_smoke PRIVATE
    three_ds_recomp_runtime oot3d_ui_topscreen oot3d_native_control_config)
# The MXAO controls are labelled by the iMMERSE module, a separate library the
# runtime loads from beside the executable: copied beside the smoke test.
if(TARGET triaevum_immerse)
    target_compile_definitions(triaevum_f1_settings_smoke PRIVATE ENABLE_OOT3D_IMMERSE)
    add_dependencies(triaevum_f1_settings_smoke triaevum_immerse)
    add_custom_command(TARGET triaevum_f1_settings_smoke POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
        "$<TARGET_FILE:triaevum_immerse>" "$<TARGET_FILE_DIR:triaevum_f1_settings_smoke>")
endif()
if(WIN32)
    target_compile_definitions(triaevum_f1_settings_smoke PRIVATE NOMINMAX)
    set_property(TARGET triaevum_f1_settings_smoke PROPERTY MSVC_RUNTIME_LIBRARY
        "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
# Developer builds: the Dev Tools tab with MM3D's zones and arrival options.
if(TRIAEVUM_DEVELOPER_TOOLS AND TRIAEVUM_TITLE_MM3D)
    target_sources(triaevum_f1_settings_smoke PRIVATE
        ../../oot3d/native_game_runtime/oot3d_dev_warp.cpp
        ../../oot3d/native_game_runtime/oot3d_dev_tools_panel.cpp)
    target_include_directories(triaevum_f1_settings_smoke PRIVATE
        ${PROJECT_SOURCE_DIR}/tools/oot3d/native_game_runtime
        ${PROJECT_SOURCE_DIR}/titles/mm3d/adapter
        ${PROJECT_SOURCE_DIR}/tools/oot3d/decomp_support/include)
    target_compile_definitions(triaevum_f1_settings_smoke PRIVATE
        TRIAEVUM_DEVELOPER_TOOLS=1 TRIAEVUM_TITLE_MM3D=1)
endif()
set_property(TARGET triaevum_f1_settings_smoke PROPERTY FOLDER Tests)

# Build-path remapping: __FILE__ is repository-relative (logs carry no host path).
add_executable(triaevum_build_path_remap_tests EXCLUDE_FROM_ALL build_path_remap_tests.cpp)
target_compile_features(triaevum_build_path_remap_tests PRIVATE cxx_std_20)
