cmake_minimum_required(VERSION 3.16)
if(DEFINED ENV{VMUPRO_SDK_PATH})
  set(VMUPRO_SDK "$ENV{VMUPRO_SDK_PATH}")
else()
  set(VMUPRO_SDK "${CMAKE_CURRENT_LIST_DIR}/vendor/vmupro-sdk")
endif()
set(EXTRA_COMPONENT_DIRS "${VMUPRO_SDK}/sdk/c")
# Restrict discovery to the application and its explicit dependency closure.
set(COMPONENTS main c)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(vmupro_atari2600)
include(elf_loader)
# Compiler arithmetic helpers are application-owned, never assumed firmware exports.
# Repeat main inside the archive group so application-owned C++ compatibility
# shims satisfy references introduced while selecting standard-library objects.
set(ELF_LIBS "-Wl,-Bsymbolic,--exclude-libs,ALL,-Map=vmupro_atari2600.app.map,--cref -Wl,-T,${CMAKE_CURRENT_LIST_DIR}/tools/vmupro_sections.ld -Wl,--start-group esp-idf/main/libmain.a -lstdc++ -lgcc -Wl,--end-group")
project_elf(atari2600_elf)
target_link_options(${CMAKE_PROJECT_NAME}.elf PRIVATE -Wl,--unresolved-symbols=ignore-all)
