blob: 0badba6bf698e65ff930e3e293b8a4df00ebbabd [file] [log] [blame]
Gyorgy Szing30fa9872017-12-05 01:08:47 +00001#-------------------------------------------------------------------------------
Kevin Pengd0e49712022-12-07 11:13:01 +08002# Copyright (c) 2020-2023, Arm Limited. All rights reserved.
Chris Brand9edf0812022-07-05 14:18:42 -07003# Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company)
4# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
Gyorgy Szing30fa9872017-12-05 01:08:47 +00005#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8#-------------------------------------------------------------------------------
9
Raef Coles69817322020-10-19 14:14:14 +010010cmake_minimum_required(VERSION 3.15)
Gyorgy Szing30fa9872017-12-05 01:08:47 +000011
David Hudd3ef2e2022-08-22 22:46:52 +080012# 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.
17if(POLICY CMP0123)
18 cmake_policy(SET CMP0123 NEW)
19endif()
20
Chris Brand19bf2742022-07-05 11:15:17 -070021list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
Sherry Zhang4cb4aaf2022-12-08 13:25:31 +080022include(version)
Chris Brand19bf2742022-07-05 11:15:17 -070023include(remote_library)
Gyorgy Szing30fa9872017-12-05 01:08:47 +000024
Raef Coles9ec67e62020-07-10 09:40:35 +010025############################ CONFIGURATION #####################################
Kevin Pengd0e49712022-12-07 11:13:01 +080026include(config/pre_config.cmake)
Raef Coles958aeef2020-10-08 12:12:58 +010027include(config/set_config.cmake)
Kevin Pengd0e49712022-12-07 11:13:01 +080028include(config/post_config.cmake)
Raef Coles69817322020-10-19 14:14:14 +010029
Raef Coles69817322020-10-19 14:14:14 +010030############################### Compiler configuration #########################
31
Raef Coles69817322020-10-19 14:14:14 +010032include(${TFM_TOOLCHAIN_FILE})
33set(CMAKE_PROJECT_INCLUDE_BEFORE ${CMAKE_SOURCE_DIR}/cmake/disable_compiler_detection.cmake)
34
Rajkumar Kanagarajcd831592022-05-04 11:44:03 +020035project("Trusted Firmware M" VERSION ${TFM_VERSION} LANGUAGES C CXX ASM)
Raef Coles69817322020-10-19 14:14:14 +010036tfm_toolchain_reload_compiler()
37
Satish Kumar1ff4b952021-05-06 20:22:43 +010038# Synchronise the install path variables. If CMAKE_INSTALL_PREFIX is manually
39# set then set both to the value of that, else set both to the value of
40# TFM_INSTALL_PATH. This has to be done after the call to `project()`.
41if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
42 set(CMAKE_INSTALL_PREFIX ${TFM_INSTALL_PATH} CACHE PATH "" FORCE)
43else()
44 set(TFM_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH "Path to which to install TF-M files" FORCE)
45endif()
46
Raef Coles9ec67e62020-07-10 09:40:35 +010047add_subdirectory(lib/ext)
Tamas Banb881bea2020-11-04 16:18:36 +000048add_subdirectory(lib/fih)
Raef Coles9ec67e62020-07-10 09:40:35 +010049add_subdirectory(tools)
David Hu1a2d4832022-01-18 14:42:04 +080050add_subdirectory(secure_fw)
Raef Colesd97a7e72021-12-10 14:58:06 +000051
Gabor Abonyie3222f92022-04-07 13:53:03 +020052if(NS AND NS_EVALUATION_APP_PATH)
53 add_subdirectory(${NS_EVALUATION_APP_PATH} ${CMAKE_CURRENT_BINARY_DIR}/evaluation-app)
54elseif(NS OR TFM_S_REG_TEST OR TFM_NS_REG_TEST OR TEST_BL2 OR TEST_BL1_1 OR TEST_BL1_2)
Raef Coles38675932022-01-18 12:56:40 +000055 add_subdirectory(${TFM_TEST_REPO_PATH} ${CMAKE_CURRENT_BINARY_DIR}/tf-m-tests)
56endif()
57
Raef Coles9ec67e62020-07-10 09:40:35 +010058add_subdirectory(interface)
59if(BL2)
60 add_subdirectory(bl2)
61endif()
Raef Coles9ec67e62020-07-10 09:40:35 +010062
Raef Coles15a37f82021-12-07 15:59:14 +000063if(BL1 AND PLATFORM_DEFAULT_BL1)
64 add_subdirectory(bl1/bl1_2)
65 add_subdirectory(bl1/bl1_1)
66endif()
67
Raef Colesd97a7e72021-12-10 14:58:06 +000068add_subdirectory(platform)
Raef Coles9ec67e62020-07-10 09:40:35 +010069
Raef Coles9ec67e62020-07-10 09:40:35 +010070if(CRYPTO_HW_ACCELERATOR)
71 add_subdirectory(platform/ext/accelerator)
72endif()
Chris Brand9edf0812022-07-05 14:18:42 -070073
Anton Komleva07180c2022-10-24 23:53:47 +010074############################ Config Check ######################################
75
76include(${CMAKE_SOURCE_DIR}/config/check_config.cmake)
77
78################################################################################
79
Chris Brand9edf0812022-07-05 14:18:42 -070080include(cmake/install.cmake)