blob: 5a0839e8855fed50980b48b78e5183ad09b03a31 [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
David Hua993bd92023-10-23 22:41:06 +080037# Load defaults, setting options not already set
38include(config/config_base.cmake)
39
Kevin Pengd0e49712022-12-07 11:13:01 +080040# Build system log config
41include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake)
42
43# The library to collect compile definitions of config options.
44add_library(tfm_config INTERFACE)
45
46target_compile_definitions(tfm_config
47 INTERFACE
Kevin Pengf6721c72023-03-01 16:12:45 +080048 $<$<STREQUAL:${TEST_PSA_API},CRYPTO>:PSA_API_TEST_CRYPTO>
49 $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC>
Kevin Pengd0e49712022-12-07 11:13:01 +080050)
51
52# Set user defined TF-M config header file
53if(PROJECT_CONFIG_HEADER_FILE)
54 if(NOT EXISTS ${PROJECT_CONFIG_HEADER_FILE})
55 message(FATAL_ERROR "${PROJECT_CONFIG_HEADER_FILE} does not exist! Please use absolute path.")
56 endif()
57 target_compile_definitions(tfm_config
58 INTERFACE
59 PROJECT_CONFIG_HEADER_FILE="${PROJECT_CONFIG_HEADER_FILE}"
60 )
61endif()
62
63# Set platform defined TF-M config header file
64set(TARGET_CONFIG_HEADER_FILE ${TARGET_PLATFORM_PATH}/config_tfm_target.h)
65if(EXISTS ${TARGET_CONFIG_HEADER_FILE})
66 target_compile_definitions(tfm_config
67 INTERFACE
68 TARGET_CONFIG_HEADER_FILE="${TARGET_CONFIG_HEADER_FILE}"
69 )
70endif()
David Hu6d1a9b62023-02-22 16:54:04 +080071
72target_include_directories(tfm_config
73 INTERFACE
Anton Komlevaee4b612023-05-14 17:38:36 +010074 $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
David Hu6d1a9b62023-02-22 16:54:04 +080075)