cmake_minimum_required(VERSION 3.20)
project(recomp_input_core VERSION 0.1.0 LANGUAGES C)
option(RECOMP_INPUT_BUILD_TESTS "Build donor and realistic snapshot fixtures" ON)
add_library(recomp_input_core STATIC src/recomp_input.c src/effects.c)
add_library(recomp-input::core ALIAS recomp_input_core)
target_include_directories(recomp_input_core PUBLIC include)
target_compile_features(recomp_input_core PUBLIC c_std_99)
if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
 target_compile_options(recomp_input_core PRIVATE -Wall -Wextra -Wpedantic)
endif()
if(RECOMP_INPUT_BUILD_TESTS)
 enable_testing()
 add_executable(input_contract tests/input_test.c tests/fake_sdl.c tests/oracle/launcher_input.c)
 target_include_directories(input_contract PRIVATE tests)
 target_link_libraries(input_contract PRIVATE recomp-input::core)
 add_test(NAME input_contract COMMAND input_contract)
 add_executable(input_effects_contract tests/effects_test.c)
 target_link_libraries(input_effects_contract PRIVATE recomp-input::core)
 add_test(NAME input_effects_contract COMMAND input_effects_contract)
endif()
