Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Raef Coles | 59cf5d8 | 2024-12-09 15:41:13 +0000 | [diff] [blame] | 2 | # SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors |
Chris Brand | 9edf081 | 2022-07-05 14:18:42 -0700 | [diff] [blame] | 3 | # Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company) |
| 4 | # or an affiliate of Cypress Semiconductor Corporation. All rights reserved. |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 5 | # |
| 6 | # SPDX-License-Identifier: BSD-3-Clause |
| 7 | # |
| 8 | #------------------------------------------------------------------------------- |
| 9 | |
David Hu | 1249f0d | 2023-12-04 22:57:56 +0800 | [diff] [blame] | 10 | cmake_minimum_required(VERSION 3.21) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 11 | |
Chris Brand | 19bf274 | 2022-07-05 11:15:17 -0700 | [diff] [blame] | 12 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
Sherry Zhang | 4cb4aaf | 2022-12-08 13:25:31 +0800 | [diff] [blame] | 13 | include(version) |
Chris Brand | 19bf274 | 2022-07-05 11:15:17 -0700 | [diff] [blame] | 14 | include(remote_library) |
Jianliang Shen | bd624ed | 2023-10-24 15:42:59 +0800 | [diff] [blame] | 15 | include(utils) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 16 | |
Anton Komlev | 4f86480 | 2023-09-05 16:57:15 +0100 | [diff] [blame] | 17 | if(EXISTS ${CMAKE_SOURCE_DIR}/localrepos.cmake) |
| 18 | message(WARNING "Building using local repositories from \"" ${CMAKE_SOURCE_DIR}/localrepos.cmake "\"") |
| 19 | include(${CMAKE_SOURCE_DIR}/localrepos.cmake) |
| 20 | endif() |
| 21 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 22 | ############################ CONFIGURATION ##################################### |
Raef Coles | 59cf5d8 | 2024-12-09 15:41:13 +0000 | [diff] [blame] | 23 | |
| 24 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "" FORCE) |
| 25 | |
Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 26 | include(config/pre_config.cmake) |
Kevin Peng | b9c99f0 | 2022-12-07 11:23:17 +0800 | [diff] [blame] | 27 | |
| 28 | if(USE_KCONFIG_TOOL) |
| 29 | include(${CMAKE_SOURCE_DIR}/config/kconfig.cmake) |
| 30 | else() |
| 31 | include(${CMAKE_SOURCE_DIR}/config/set_config.cmake) |
| 32 | endif() |
| 33 | |
Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 34 | include(config/post_config.cmake) |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 35 | |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 36 | ############################### Compiler configuration ######################### |
| 37 | |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 38 | include(${TFM_TOOLCHAIN_FILE}) |
Anton Komlev | dd0a722 | 2023-09-19 18:49:39 +0100 | [diff] [blame] | 39 | |
| 40 | set(CMAKE_C_COMPILER_FORCED true) |
| 41 | set(CMAKE_CXX_COMPILER_FORCED true) |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 42 | |
Rajkumar Kanagaraj | cd83159 | 2022-05-04 11:44:03 +0200 | [diff] [blame] | 43 | project("Trusted Firmware M" VERSION ${TFM_VERSION} LANGUAGES C CXX ASM) |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 44 | |
Jackson Cooper-Driver | c024948 | 2024-07-09 10:34:36 +0100 | [diff] [blame] | 45 | add_subdirectory(lib/backtrace) |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 46 | add_subdirectory(lib/ext) |
Tamas Ban | b881bea | 2020-11-04 16:18:36 +0000 | [diff] [blame] | 47 | add_subdirectory(lib/fih) |
Jackson Cooper-Driver | ed984c9 | 2024-08-14 16:12:40 +0100 | [diff] [blame] | 48 | add_subdirectory(lib/tfm_log) |
| 49 | add_subdirectory(lib/tfm_log_unpriv) |
| 50 | add_subdirectory(lib/tfm_vprintf) |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 51 | add_subdirectory(tools) |
David Hu | 1a2d483 | 2022-01-18 14:42:04 +0800 | [diff] [blame] | 52 | add_subdirectory(secure_fw) |
Raef Coles | d97a7e7 | 2021-12-10 14:58:06 +0000 | [diff] [blame] | 53 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 54 | add_subdirectory(interface) |
| 55 | if(BL2) |
| 56 | add_subdirectory(bl2) |
| 57 | endif() |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 58 | |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 59 | if(BL1 AND PLATFORM_DEFAULT_BL1) |
| 60 | add_subdirectory(bl1/bl1_2) |
| 61 | add_subdirectory(bl1/bl1_1) |
| 62 | endif() |
| 63 | |
Raef Coles | d97a7e7 | 2021-12-10 14:58:06 +0000 | [diff] [blame] | 64 | add_subdirectory(platform) |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 65 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 66 | if(CRYPTO_HW_ACCELERATOR) |
| 67 | add_subdirectory(platform/ext/accelerator) |
| 68 | endif() |
Chris Brand | 9edf081 | 2022-07-05 14:18:42 -0700 | [diff] [blame] | 69 | |
David Hu | e3f0f42 | 2023-10-30 12:55:42 +0800 | [diff] [blame] | 70 | if(IS_DIRECTORY ${CONFIG_TFM_TEST_DIR}) |
David Hu | a993bd9 | 2023-10-23 22:41:06 +0800 | [diff] [blame] | 71 | add_subdirectory(${CONFIG_TFM_TEST_DIR} ${CMAKE_CURRENT_BINARY_DIR}/tf-m-tests) |
| 72 | endif() |
| 73 | |
Anton Komlev | a07180c | 2022-10-24 23:53:47 +0100 | [diff] [blame] | 74 | ############################ Config Check ###################################### |
| 75 | |
| 76 | include(${CMAKE_SOURCE_DIR}/config/check_config.cmake) |
| 77 | |
| 78 | ################################################################################ |
| 79 | |
Chris Brand | 9edf081 | 2022-07-05 14:18:42 -0700 | [diff] [blame] | 80 | include(cmake/install.cmake) |