blob: 4fc7b3470041b46dee0a93d86700f95bfc4500aa [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
David Hue3f0f422023-10-30 12:55:42 +080011if(CONFIG_TFM_TEST_CONFIG_FILE)
David Hua993bd92023-10-23 22:41:06 +080012 if(NOT IS_ABSOLUTE "${CONFIG_TFM_TEST_CONFIG_FILE}")
13 message(SEND_ERROR "CONFIG_TFM_TEST_CONFIG_FILE is not an absolute path:")
14 message(SEND_ERROR "${CONFIG_TFM_TEST_CONFIG_FILE}")
15 message(SEND_ERROR "Configuration might fail.")
16 endif()
David Hu84dabc72023-10-30 09:33:11 +080017
18 # Include platform specific regression tests preference at first
19 include(${TARGET_PLATFORM_PATH}/tests/tfm_tests_config.cmake OPTIONAL)
20 # Then include the test configuration specified by users
David Hua993bd92023-10-23 22:41:06 +080021 include(${CONFIG_TFM_TEST_CONFIG_FILE})
22endif()
Kevin Pengb308c342023-04-04 10:52:24 +080023
David Hue3f0f422023-10-30 12:55:42 +080024if(CONFIG_PSA_ARCH_TESTS_CONFIG_FILE)
David Hu84dabc72023-10-30 09:33:11 +080025 if(NOT IS_ABSOLUTE "${CONFIG_PSA_ARCH_TESTS_CONFIG_FILE}")
26 message(SEND_ERROR "CONFIG_PSA_ARCH_TESTS_CONFIG_FILE is not an absolute path:")
27 message(SEND_ERROR "${CONFIG_PSA_ARCH_TESTS_CONFIG_FILE}")
28 message(SEND_ERROR "Configuration might fail.")
29 endif()
30
31 # Include platform specific psa arch tests preference at first
32 include(${TARGET_PLATFORM_PATH}/tests/psa_arch_tests_config.cmake OPTIONAL)
33 # Then include the test configuration specified by users
34 include(${CONFIG_PSA_ARCH_TESTS_CONFIG_FILE})
35endif()
36
Kevin Pengb308c342023-04-04 10:52:24 +080037# Load regression configs overrided by platform
Kevin Peng174f8362023-04-07 11:32:16 +080038include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake OPTIONAL)
Kevin Pengb308c342023-04-04 10:52:24 +080039
David Hua993bd92023-10-23 22:41:06 +080040# Load defaults, setting options not already set
41include(config/config_base.cmake)
42
Kevin Pengd0e49712022-12-07 11:13:01 +080043# Build system log config
44include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake)
45
46# The library to collect compile definitions of config options.
47add_library(tfm_config INTERFACE)
48
49target_compile_definitions(tfm_config
50 INTERFACE
Kevin Pengf6721c72023-03-01 16:12:45 +080051 $<$<STREQUAL:${TEST_PSA_API},CRYPTO>:PSA_API_TEST_CRYPTO>
52 $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC>
Kevin Pengd0e49712022-12-07 11:13:01 +080053)
54
55# Set user defined TF-M config header file
56if(PROJECT_CONFIG_HEADER_FILE)
57 if(NOT EXISTS ${PROJECT_CONFIG_HEADER_FILE})
58 message(FATAL_ERROR "${PROJECT_CONFIG_HEADER_FILE} does not exist! Please use absolute path.")
59 endif()
60 target_compile_definitions(tfm_config
61 INTERFACE
62 PROJECT_CONFIG_HEADER_FILE="${PROJECT_CONFIG_HEADER_FILE}"
63 )
64endif()
65
66# Set platform defined TF-M config header file
67set(TARGET_CONFIG_HEADER_FILE ${TARGET_PLATFORM_PATH}/config_tfm_target.h)
68if(EXISTS ${TARGET_CONFIG_HEADER_FILE})
69 target_compile_definitions(tfm_config
70 INTERFACE
71 TARGET_CONFIG_HEADER_FILE="${TARGET_CONFIG_HEADER_FILE}"
72 )
73endif()
David Hu6d1a9b62023-02-22 16:54:04 +080074
75target_include_directories(tfm_config
76 INTERFACE
Anton Komlevaee4b612023-05-14 17:38:36 +010077 $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
David Hu6d1a9b62023-02-22 16:54:04 +080078)