1#
2# Arm SCP/MCP Software
3# Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8set(SCP_ROOT ${CMAKE_SOURCE_DIR})
9set(CONTRIB_ROOT ${CMAKE_SOURCE_DIR}/contrib)
10set(UNITY_SRC_ROOT ${CONTRIB_ROOT}/cmock/git/vendor/unity/src)
11set(CMOCK_SRC_ROOT ${CONTRIB_ROOT}/cmock/git/src)
12
13add_library(${SCP_MODULE_TARGET} SCP_MODULE)
14
15target_include_directories(${SCP_MODULE_TARGET}
16                           PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
17
18target_sources(${SCP_MODULE_TARGET}
19               PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/mod_ut.c")
20
21set(UNIT_TEST_TARGET ${SCP_MODULE_TARGET})
22add_subdirectory(${CMAKE_SOURCE_DIR}/module/scmi/test
23    ${CMAKE_BINARY_DIR}/module/scmi/test)
24
25set(UNIT_TEST_ROOT ${CMAKE_SOURCE_DIR}/unit_test)
26
27target_include_directories(
28    ${UNIT_TEST_TARGET} PRIVATE ${UNIT_TEST_ROOT}/unity_mocks ${CMOCK_SRC_ROOT}
29                                ${UNITY_SRC_ROOT})
30target_compile_definitions(${UNIT_TEST_TARGET} PRIVATE -DTEST_TARGET=1)
31target_sources(
32    ${UNIT_TEST_TARGET}
33    PRIVATE ${UNITY_SRC_ROOT}/unity.c ${CMOCK_SRC_ROOT}/cmock.c
34            ${UNIT_TEST_ROOT}/unity_mocks/scp_unity.c)
35