Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Raef Coles | d97a7e7 | 2021-12-10 14:58:06 +0000 | [diff] [blame] | 2 | # Copyright (c) 2020-2022, Arm Limited. All rights reserved. |
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 | |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 10 | cmake_minimum_required(VERSION 3.15) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 11 | |
David Hu | dd3ef2e | 2022-08-22 22:46:52 +0800 | [diff] [blame] | 12 | # CMake 3.21 and above requests projects to specify cpu/arch compile and link flags explicitly in |
| 13 | # Armclang. Link: https://cmake.org/cmake/help/latest/policy/CMP0123.html |
| 14 | # It is aligned with current Armclang toolchain implementation. |
| 15 | # Explictly set this policy to NEW behavior to eliminate long warnings. It shall be set in root |
| 16 | # CMakeLists.txt otherwise project() will throw out the warnings. |
| 17 | if(POLICY CMP0123) |
| 18 | cmake_policy(SET CMP0123 NEW) |
| 19 | endif() |
| 20 | |
Chris Brand | 19bf274 | 2022-07-05 11:15:17 -0700 | [diff] [blame] | 21 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
Anton Komlev | 2d2a6fc | 2022-02-20 15:47:53 +0000 | [diff] [blame] | 22 | include(cmake/version.cmake) |
Chris Brand | 19bf274 | 2022-07-05 11:15:17 -0700 | [diff] [blame] | 23 | include(remote_library) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 24 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 25 | ############################ CONFIGURATION ##################################### |
| 26 | |
Jianliang Shen | 1c4f1c2 | 2022-03-07 15:56:06 +0800 | [diff] [blame] | 27 | # Configure TFM_PLATFORM |
| 28 | include(${CMAKE_SOURCE_DIR}/config/tfm_platform.cmake) |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 29 | |
Raef Coles | fbc34cc | 2020-11-24 14:27:52 +0000 | [diff] [blame] | 30 | if(TFM_SYSTEM_DSP) |
| 31 | message(FATAL_ERROR "Hardware DSP is currently not supported in TF-M") |
| 32 | endif() |
| 33 | |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 34 | include(config/set_config.cmake) |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 35 | |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 36 | if(NOT ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" AND |
| 37 | NOT ${CMAKE_GENERATOR} STREQUAL "Ninja") |
| 38 | Message(FATAL_ERROR "Unsupported generator ${CMAKE_GENERATOR}. Hint: Try -G\"Unix Makefiles\"") |
| 39 | endif() |
| 40 | |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 41 | ############################### Compiler configuration ######################### |
| 42 | |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 43 | include(${TFM_TOOLCHAIN_FILE}) |
| 44 | set(CMAKE_PROJECT_INCLUDE_BEFORE ${CMAKE_SOURCE_DIR}/cmake/disable_compiler_detection.cmake) |
| 45 | |
| 46 | project("Trusted Firmware M" VERSION ${TFM_VERSION} LANGUAGES C ASM) |
| 47 | tfm_toolchain_reload_compiler() |
| 48 | |
Satish Kumar | 1ff4b95 | 2021-05-06 20:22:43 +0100 | [diff] [blame] | 49 | # Synchronise the install path variables. If CMAKE_INSTALL_PREFIX is manually |
| 50 | # set then set both to the value of that, else set both to the value of |
| 51 | # TFM_INSTALL_PATH. This has to be done after the call to `project()`. |
| 52 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 53 | set(CMAKE_INSTALL_PREFIX ${TFM_INSTALL_PATH} CACHE PATH "" FORCE) |
| 54 | else() |
| 55 | set(TFM_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH "Path to which to install TF-M files" FORCE) |
| 56 | endif() |
| 57 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 58 | add_subdirectory(lib/ext) |
Tamas Ban | b881bea | 2020-11-04 16:18:36 +0000 | [diff] [blame] | 59 | add_subdirectory(lib/fih) |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 60 | add_subdirectory(tools) |
David Hu | 1a2d483 | 2022-01-18 14:42:04 +0800 | [diff] [blame] | 61 | add_subdirectory(secure_fw) |
Raef Coles | d97a7e7 | 2021-12-10 14:58:06 +0000 | [diff] [blame] | 62 | |
Gabor Abonyi | e3222f9 | 2022-04-07 13:53:03 +0200 | [diff] [blame] | 63 | if(NS AND NS_EVALUATION_APP_PATH) |
| 64 | add_subdirectory(${NS_EVALUATION_APP_PATH} ${CMAKE_CURRENT_BINARY_DIR}/evaluation-app) |
| 65 | elseif(NS OR TFM_S_REG_TEST OR TFM_NS_REG_TEST OR TEST_BL2 OR TEST_BL1_1 OR TEST_BL1_2) |
Raef Coles | 3867593 | 2022-01-18 12:56:40 +0000 | [diff] [blame] | 66 | add_subdirectory(${TFM_TEST_REPO_PATH} ${CMAKE_CURRENT_BINARY_DIR}/tf-m-tests) |
| 67 | endif() |
| 68 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 69 | add_subdirectory(interface) |
| 70 | if(BL2) |
| 71 | add_subdirectory(bl2) |
| 72 | endif() |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 73 | |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 74 | if(BL1 AND PLATFORM_DEFAULT_BL1) |
| 75 | add_subdirectory(bl1/bl1_2) |
| 76 | add_subdirectory(bl1/bl1_1) |
| 77 | endif() |
| 78 | |
Raef Coles | d97a7e7 | 2021-12-10 14:58:06 +0000 | [diff] [blame] | 79 | add_subdirectory(platform) |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 80 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame] | 81 | if(CRYPTO_HW_ACCELERATOR) |
| 82 | add_subdirectory(platform/ext/accelerator) |
| 83 | endif() |
Chris Brand | 9edf081 | 2022-07-05 14:18:42 -0700 | [diff] [blame] | 84 | |
Anton Komlev | a07180c | 2022-10-24 23:53:47 +0100 | [diff] [blame^] | 85 | ############################ Config Check ###################################### |
| 86 | |
| 87 | include(${CMAKE_SOURCE_DIR}/config/check_config.cmake) |
| 88 | |
| 89 | ################################################################################ |
| 90 | |
Chris Brand | 9edf081 | 2022-07-05 14:18:42 -0700 | [diff] [blame] | 91 | include(cmake/install.cmake) |