cmake_minimum_required(VERSION 3.25)
project(TopSpinWin32LaunchPage LANGUAGES C)
# Own work: djultra64. Standalone native fixture; no product host activation.
if(NOT WIN32 OR NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
    message(FATAL_ERROR "Native 64-bit Windows required")
endif()
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(TOPSPIN_SDK_ROOT "" CACHE PATH "Current Xbox C runtime SDK")
set(TOPSPIN_FRONTEND_INCLUDE "" CACHE PATH "Current frontend headers")
if(NOT EXISTS "${TOPSPIN_SDK_ROOT}/src/kernel/kernel.h" OR NOT EXISTS "${TOPSPIN_FRONTEND_INCLUDE}/image_handoff.h")
    message(FATAL_ERROR "Actual SDK and frontend headers required")
endif()
add_executable(topspin_windows_handoff_test ../tests/image_handoff_windows.c ../src/image_handoff_windows.c)
target_include_directories(topspin_windows_handoff_test PRIVATE "${TOPSPIN_FRONTEND_INCLUDE}" "${TOPSPIN_SDK_ROOT}/src" "${CMAKE_CURRENT_SOURCE_DIR}/../runtime")
target_compile_definitions(topspin_windows_handoff_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX GUEST_TURN_NO_WRAPPERS)
if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
    target_compile_options(topspin_windows_handoff_test PRIVATE -Wall -Wextra -Werror -Wno-error=comment)
endif()
enable_testing()
add_test(NAME windows_launch_page COMMAND topspin_windows_handoff_test)
