[修改] 增加freeRTOS
1. 版本FreeRTOSv202212.01,命名为kernel;
This commit is contained in:
@ -0,0 +1,54 @@
|
||||
# Include filepaths for source and include.
|
||||
include( ${MODULE_ROOT_DIR}/shadowFilePaths.cmake )
|
||||
|
||||
# ==================== Define your project name (edit) ========================
|
||||
set(project_name "shadow")
|
||||
|
||||
# ===================== Create your mock here (edit) ========================
|
||||
# ================= Create the library under test here (edit) ==================
|
||||
|
||||
# list the files you would like to test here
|
||||
list(APPEND real_source_files
|
||||
${SHADOW_SOURCES}
|
||||
)
|
||||
# list the directories the module under test includes
|
||||
list(APPEND real_include_directories
|
||||
.
|
||||
${SHADOW_INCLUDE_PUBLIC_DIRS}
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../include"
|
||||
)
|
||||
|
||||
# ===================== Create UnitTest Code here (edit) =====================
|
||||
|
||||
# list the directories your test needs to include
|
||||
list(APPEND test_include_directories
|
||||
.
|
||||
${SHADOW_INCLUDE_PUBLIC_DIRS}
|
||||
)
|
||||
|
||||
# ============================= (end edit) ===================================
|
||||
|
||||
set(real_name "${project_name}_real")
|
||||
|
||||
create_real_library(${real_name}
|
||||
"${real_source_files}"
|
||||
"${real_include_directories}"
|
||||
"${mock_name}"
|
||||
)
|
||||
|
||||
list(APPEND utest_link_list
|
||||
lib${real_name}.a
|
||||
)
|
||||
|
||||
list(APPEND utest_dep_list
|
||||
${real_name}
|
||||
)
|
||||
|
||||
set(utest_name "${project_name}_utest")
|
||||
set(utest_source "${project_name}_utest.c")
|
||||
create_test(${utest_name}
|
||||
${utest_source}
|
||||
"${utest_link_list}"
|
||||
"${utest_dep_list}"
|
||||
"${test_include_directories}"
|
||||
)
|
||||
@ -0,0 +1,58 @@
|
||||
# Macro utility to clone the CMock submodule.
|
||||
macro( clone_cmock )
|
||||
find_package( Git REQUIRED )
|
||||
message( "Cloning submodule CMock." )
|
||||
execute_process( COMMAND rm -rf ${CMOCK_DIR}
|
||||
COMMAND ${GIT_EXECUTABLE} submodule update --checkout --init --recursive ${CMOCK_DIR}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
RESULT_VARIABLE CMOCK_CLONE_RESULT )
|
||||
|
||||
if( NOT ${CMOCK_CLONE_RESULT} STREQUAL "0" )
|
||||
message( FATAL_ERROR "Failed to clone CMock submodule." )
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Macro utility to add library targets for Unity and CMock to build configuration.
|
||||
macro( add_cmock_targets )
|
||||
# Build Configuration for CMock and Unity libraries.
|
||||
list( APPEND CMOCK_INCLUDE_DIRS
|
||||
"${CMOCK_DIR}/vendor/unity/src/"
|
||||
"${CMOCK_DIR}/vendor/unity/extras/fixture/src"
|
||||
"${CMOCK_DIR}/vendor/unity/extras/memory/src"
|
||||
"${CMOCK_DIR}/src"
|
||||
)
|
||||
|
||||
add_library(cmock STATIC
|
||||
"${CMOCK_DIR}/src/cmock.c"
|
||||
)
|
||||
|
||||
set_target_properties(cmock PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
COMPILE_FLAGS "-Og"
|
||||
)
|
||||
|
||||
target_include_directories(cmock PUBLIC
|
||||
${CMOCK_DIR}/src
|
||||
${CMOCK_DIR}/vendor/unity/src/
|
||||
${CMOCK_DIR}/examples
|
||||
${CMOCK_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
add_library(unity STATIC
|
||||
"${CMOCK_DIR}/vendor/unity/src/unity.c"
|
||||
"${CMOCK_DIR}/vendor/unity/extras/fixture/src/unity_fixture.c"
|
||||
"${CMOCK_DIR}/vendor/unity/extras/memory/src/unity_memory.c"
|
||||
)
|
||||
|
||||
set_target_properties(unity PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
|
||||
target_include_directories(unity PUBLIC
|
||||
${CMOCK_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(cmock unity)
|
||||
endmacro()
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user