Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
Jianliang Shen | 412d875 | 2023-08-16 11:23:05 +0800 | [diff] [blame] | 8 | # Load the default extra configs about generated files and secure partitions |
| 9 | include(${CMAKE_SOURCE_DIR}/config/extra_build_config.cmake) |
| 10 | |
David Hu | e3f0f42 | 2023-10-30 12:55:42 +0800 | [diff] [blame] | 11 | if(CONFIG_TFM_TEST_CONFIG_FILE) |
David Hu | a993bd9 | 2023-10-23 22:41:06 +0800 | [diff] [blame] | 12 | 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 Hu | 84dabc7 | 2023-10-30 09:33:11 +0800 | [diff] [blame] | 17 | |
| 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 Hu | a993bd9 | 2023-10-23 22:41:06 +0800 | [diff] [blame] | 21 | include(${CONFIG_TFM_TEST_CONFIG_FILE}) |
| 22 | endif() |
Kevin Peng | b308c34 | 2023-04-04 10:52:24 +0800 | [diff] [blame] | 23 | |
David Hu | e3f0f42 | 2023-10-30 12:55:42 +0800 | [diff] [blame] | 24 | if(CONFIG_PSA_ARCH_TESTS_CONFIG_FILE) |
David Hu | 84dabc7 | 2023-10-30 09:33:11 +0800 | [diff] [blame] | 25 | 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}) |
| 35 | endif() |
| 36 | |
Kevin Peng | b308c34 | 2023-04-04 10:52:24 +0800 | [diff] [blame] | 37 | # Load regression configs overrided by platform |
Kevin Peng | 174f836 | 2023-04-07 11:32:16 +0800 | [diff] [blame] | 38 | include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake OPTIONAL) |
Kevin Peng | b308c34 | 2023-04-04 10:52:24 +0800 | [diff] [blame] | 39 | |
David Hu | a993bd9 | 2023-10-23 22:41:06 +0800 | [diff] [blame] | 40 | # Load defaults, setting options not already set |
| 41 | include(config/config_base.cmake) |
| 42 | |
Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 43 | # Build system log config |
| 44 | include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake) |
| 45 | |
| 46 | # The library to collect compile definitions of config options. |
| 47 | add_library(tfm_config INTERFACE) |
| 48 | |
| 49 | target_compile_definitions(tfm_config |
| 50 | INTERFACE |
Kevin Peng | f6721c7 | 2023-03-01 16:12:45 +0800 | [diff] [blame] | 51 | $<$<STREQUAL:${TEST_PSA_API},CRYPTO>:PSA_API_TEST_CRYPTO> |
| 52 | $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC> |
Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 53 | ) |
| 54 | |
| 55 | # Set user defined TF-M config header file |
| 56 | if(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 | ) |
| 64 | endif() |
| 65 | |
| 66 | # Set platform defined TF-M config header file |
| 67 | set(TARGET_CONFIG_HEADER_FILE ${TARGET_PLATFORM_PATH}/config_tfm_target.h) |
| 68 | if(EXISTS ${TARGET_CONFIG_HEADER_FILE}) |
| 69 | target_compile_definitions(tfm_config |
| 70 | INTERFACE |
| 71 | TARGET_CONFIG_HEADER_FILE="${TARGET_CONFIG_HEADER_FILE}" |
| 72 | ) |
| 73 | endif() |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 74 | |
| 75 | target_include_directories(tfm_config |
| 76 | INTERFACE |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 77 | $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 78 | ) |