29 lines
969 B
CMake
29 lines
969 B
CMake
cmake_minimum_required(VERSION 3.20)
|
|
project(ninlight_host_tests C)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
include(FetchContent)
|
|
FetchContent_Declare(unity
|
|
GIT_REPOSITORY https://github.com/ThrowTheSwitch/Unity.git
|
|
GIT_TAG v2.6.0)
|
|
FetchContent_MakeAvailable(unity)
|
|
|
|
enable_testing()
|
|
set(NL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../src)
|
|
|
|
function(nl_test name)
|
|
add_executable(${name} ${ARGN})
|
|
target_include_directories(${name} PRIVATE ${NL_SRC} ${CMAKE_CURRENT_SOURCE_DIR})
|
|
target_compile_options(${name} PRIVATE -Wall -Wextra -Werror)
|
|
target_compile_definitions(${name} PRIVATE NINLIGHT_HOST_TEST=1)
|
|
target_link_libraries(${name} PRIVATE unity m)
|
|
add_test(NAME ${name} COMMAND ${name})
|
|
endfunction()
|
|
|
|
nl_test(test_sha256 test_sha256.c ${NL_SRC}/util/nl_sha256.c)
|
|
nl_test(test_crc test_crc.c ${NL_SRC}/util/nl_crc.c)
|
|
nl_test(test_board test_board.c ${NL_SRC}/board/nl_board.c)
|
|
nl_test(test_color test_color.c ${NL_SRC}/light/nl_color.c)
|