blob: 66a9d9cb22ec3b7913f41f21e467e3d03f635596 [file] [log] [blame]
Kevin Pengd0e49712022-12-07 11:13:01 +08001#-------------------------------------------------------------------------------
2# Copyright (c) 2023, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
Jianliang Shen412d8752023-08-16 11:23:05 +08008# Load the default extra configs about generated files and secure partitions
9include(${CMAKE_SOURCE_DIR}/config/extra_build_config.cmake)
10
Kevin Pengb308c342023-04-04 10:52:24 +080011# Load defaults, setting options not already set
12include(config/config_base.cmake)
13
14# Load regression configs overrided by platform
Kevin Peng174f8362023-04-07 11:32:16 +080015include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake OPTIONAL)
Kevin Pengb308c342023-04-04 10:52:24 +080016
Kevin Pengd0e49712022-12-07 11:13:01 +080017# Fetch tf-m-tests repo during config, if NS or regression test is required.
18# Therefore tf-m-tests configs can be set with TF-M configs since their configs
19# are coupled.
20include(lib/ext/tf-m-tests/fetch_repo.cmake)
21
22# Load TF-M regression test suites setting
Kevin Pengb9c99f02022-12-07 11:23:17 +080023if(NOT USE_KCONFIG_TOOL AND (TFM_NS_REG_TEST OR TFM_S_REG_TEST))
Kevin Pengd0e49712022-12-07 11:13:01 +080024 include(${TFM_TEST_PATH}/config/set_config.cmake)
25endif()
26
27# Build system log config
28include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake)
29
30# The library to collect compile definitions of config options.
31add_library(tfm_config INTERFACE)
32
33target_compile_definitions(tfm_config
34 INTERFACE
Kevin Pengf6721c72023-03-01 16:12:45 +080035 $<$<STREQUAL:${TEST_PSA_API},CRYPTO>:PSA_API_TEST_CRYPTO>
36 $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC>
Kevin Pengd0e49712022-12-07 11:13:01 +080037)
38
39# Set user defined TF-M config header file
40if(PROJECT_CONFIG_HEADER_FILE)
41 if(NOT EXISTS ${PROJECT_CONFIG_HEADER_FILE})
42 message(FATAL_ERROR "${PROJECT_CONFIG_HEADER_FILE} does not exist! Please use absolute path.")
43 endif()
44 target_compile_definitions(tfm_config
45 INTERFACE
46 PROJECT_CONFIG_HEADER_FILE="${PROJECT_CONFIG_HEADER_FILE}"
47 )
48endif()
49
50# Set platform defined TF-M config header file
51set(TARGET_CONFIG_HEADER_FILE ${TARGET_PLATFORM_PATH}/config_tfm_target.h)
52if(EXISTS ${TARGET_CONFIG_HEADER_FILE})
53 target_compile_definitions(tfm_config
54 INTERFACE
55 TARGET_CONFIG_HEADER_FILE="${TARGET_CONFIG_HEADER_FILE}"
56 )
57endif()
David Hu6d1a9b62023-02-22 16:54:04 +080058
59target_include_directories(tfm_config
60 INTERFACE
61 ${CMAKE_CURRENT_LIST_DIR}
62)