cmake_minimum_required(VERSION 3.10)

# set the project name
project(CLS_Master_Unity)

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

add_executable(${CMAKE_PROJECT_NAME})
target_sources(${CMAKE_PROJECT_NAME} PUBLIC
    tests.c
    usbdata_test.c
    candata_test.c
    mock_os/mock_os.c
    mock_os/mock_hal.c
    ../lib/Unity/src/unity.c
)

target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
    ./
    ../lib/Unity/src
)

include_directories(mock_os)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/nanopb/extra)
find_package(Nanopb REQUIRED)
include_directories(${NANOPB_INCLUDE_DIRS})
nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS RELPATH proto ../../proto/firmware.proto)
add_library(PROTOS ${PROTO_SRCS} ${PROTO_HDRS})
target_include_directories(PROTOS PUBLIC ${NANOPB_INCLUDE_DIRS} ${PROJECT_BINARY_DIR})
include_directories(${PROJECT_BINARY_DIR})

add_library(CLS_BSP mock_os/CLS_BSP.c) 
target_include_directories(CLS_BSP PUBLIC
./
../lib/Unity/src
)

add_subdirectory(../../Application/Tasks Tasks)
add_subdirectory(../../Application/CLS CLS)


target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC Tasks CLS)