cmake_minimum_required(VERSION 3.20)
project(YoshisCookieRecomp C CXX)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

set(NESRECOMP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/nesrecomp" CACHE PATH "NESRecomp engine checkout")

# nesrecomp/ and recomp-ui/ are git submodules (see .gitmodules); the pinned
# commits are the gitlinks recorded in this repo. Clone with --recursive, or run
# `git submodule update --init --recursive` after cloning.

# The engine generates the game's C into the build directory at configure time.
set(NESRECOMP_ROM "" CACHE FILEPATH "ROM image to recompile (not distributed)")
set(NESRECOMP_CYCLE_SEEDS "${CMAKE_CURRENT_SOURCE_DIR}/cyc_seeds.txt" CACHE FILEPATH "Cycle coverage seeds")
set(NESRECOMP_HOST_COMPILER "" CACHE FILEPATH "Optional prebuilt host NESRecomp compiler")
if(NOT EXISTS "${NESRECOMP_ROM}")
    message(FATAL_ERROR "Set NESRECOMP_ROM to the original ROM image for this title")
endif()
include("${NESRECOMP_ROOT}/runner/cyc/project.cmake")
nesrecomp_add_cycle_game(YoshisCookieRecomp
    ROM "${NESRECOMP_ROM}"
    GAME_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/game.toml"
    RECOMPILER "${NESRECOMP_HOST_COMPILER}"
    SEED_FILE "${NESRECOMP_CYCLE_SEEDS}"
    PLAYERS 2
    BOXART "${CMAKE_CURRENT_SOURCE_DIR}/boxart.tga")
