69 lines
1.6 KiB
CMake
69 lines
1.6 KiB
CMake
cmake_minimum_required(VERSION 3.3)
|
|
|
|
project(libdi_fw_tests C)
|
|
enable_language(ASM)
|
|
set(PROJECT_NAME "libdi_fw_tests")
|
|
set(PROJECT_BRIEF "Libdi FW tests")
|
|
|
|
set(STM32_CHIP STM32L063C8)
|
|
|
|
MACRO(SUBDIRLIST result curdir)
|
|
FILE(GLOB children ${curdir}/*)
|
|
SET(dirlist "")
|
|
FOREACH(child ${children})
|
|
IF(IS_DIRECTORY ${child})
|
|
STRING(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/${curdir}/" "" childname "${child}")
|
|
LIST(APPEND dirlist ${childname})
|
|
ENDIF()
|
|
ENDFOREACH()
|
|
SET(${result} ${dirlist})
|
|
ENDMACRO()
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
include(CTest)
|
|
endif()
|
|
|
|
include("common/cmake/CMakeLists.txt")
|
|
|
|
find_package(Libdi COMPONENTS log REQUIRED)
|
|
find_package(Unity REQUIRED)
|
|
|
|
SET(STM32_LINKER_SCRIPT ${ChibiOS_LINKER_SCRIPT})
|
|
|
|
include_directories(
|
|
${Libdi_INCLUDE_DIRS}
|
|
${Unity_INCLUDE_DIRS}
|
|
"${CMAKE_BINARY_DIR}/include"
|
|
)
|
|
|
|
add_definitions(-DTHUMB -DCORTEX_USE_FPU=FALSE)
|
|
add_definitions(-DUNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION=True -DUNITY_OUTPUT_CHAR=di_fw_test_unity_putc)
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
add_definitions(-DDI_LOG_ENABLE_FROM_DEBUG=TRUE)
|
|
else()
|
|
add_definitions(-DDI_LOG_ENABLE_FROM_WARN=TRUE)
|
|
endif()
|
|
|
|
subdirlist(SUBDIRS src)
|
|
set(ALLSOURCES "${INCSRC}")
|
|
foreach(DIR ${SUBDIRS})
|
|
aux_source_directory(src/${DIR} SRCS)
|
|
set(ALLSOURCES "${ALLSOURCES};${SRCS}")
|
|
|
|
add_subdirectory(src/${DIR})
|
|
|
|
add_test(
|
|
NAME "${DIR}-test"
|
|
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${DIR}"
|
|
)
|
|
set_tests_properties("${DIR}-test" PROPERTIES TIMEOUT 30)
|
|
endforeach()
|
|
|
|
if (BUILD_TESTING)
|
|
enable_linting()
|
|
endif()
|
|
|
|
|
|
#add_subdirectory(tests)
|