# SPDX-License-Identifier: MPL-2.0
#
# Prototype jetable : héberger Godot par LibGodot (ADR 0007, ADR 0008).
# Exige Godot construit par scripts/build-godot.ps1 (en-tête GDExtension généré + DLL).

set(_godot_src "${PROJECT_SOURCE_DIR}/engines/godot/vendor/godot-src")
set(_godot_header "${_godot_src}/core/extension/gdextension_interface.gen.h")
set(_godot_library "${_godot_src}/bin/godot.windows.template_debug.x86_64.dll")

if(NOT EXISTS "${_godot_header}")
    message(STATUS "prototypes : libgodot_host ignore (construire Godot : scripts/build-godot.ps1)")
    return()
endif()

add_executable(libgodot_host main.cpp)
target_include_directories(libgodot_host SYSTEM PRIVATE "${_godot_src}/core/extension")
target_compile_definitions(libgodot_host PRIVATE
    SEQUA_LIBGODOT_DEFAULT_LIBRARY="${_godot_library}"
    SEQUA_LIBGODOT_DEFAULT_PROJECT="${CMAKE_CURRENT_SOURCE_DIR}/project")
sequa_target_defaults(libgodot_host)

if(SEQUA_BUILD_TESTS AND EXISTS "${_godot_library}")
    add_test(NAME libgodot_host COMMAND libgodot_host --frames 300)
    set_tests_properties(libgodot_host PROPERTIES LABELS "gpu;prototype;godot" TIMEOUT 120)
endif()
