# Copyright (c) 2025 Dominic Masters
# 
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT

# Sources
target_sources(${DUSK_LIBRARY_TARGET_NAME}
  PUBLIC
    input.c
    inputbutton.c
    inputaction.c
)

if(DUSK_TARGET_SYSTEM STREQUAL "linux")
  target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
    PUBLIC
      INPUT_SDL2=1
      INPUT_KEYBOARD=1
      INPUT_MOUSE=1
      INPUT_GAMEPAD=1
  )
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
  target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
    PUBLIC
      INPUT_SDL2=1
      INPUT_GAMEPAD=1
  )
endif()

# CSV
dusk_run_python(
  dusk_input_csv_defs
  tools.input.csv
    --csv ${CMAKE_CURRENT_SOURCE_DIR}/input.csv
    --output ${DUSK_GENERATED_HEADERS_DIR}/input/inputactiondefs.h
)
add_dependencies(${DUSK_LIBRARY_TARGET_NAME} dusk_input_csv_defs)