blob: 249f34a83c5af30ba98a566397b4917c04653dba [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)
Jianliang Shenbd624ed2023-10-24 15:42:59 +080024include(utils)
Gyorgy Szing30fa9872017-12-05 01:08:47 +000025
Anton Komlev4f864802023-09-05 16:57:15 +010026if(EXISTS ${CMAKE_SOURCE_DIR}/localrepos.cmake)
27 message(WARNING "Building using local repositories from \"" ${CMAKE_SOURCE_DIR}/localrepos.cmake "\"")
28 include(${CMAKE_SOURCE_DIR}/localrepos.cmake)
29endif()
30
Raef Coles9ec67e62020-07-10 09:40:35 +010031############################ CONFIGURATION #####################################
Kevin Pengd0e49712022-12-07 11:13:01 +080032include(config/pre_config.cmake)
Kevin Pengb9c99f02022-12-07 11:23:17 +080033
34if(USE_KCONFIG_TOOL)
35 include(${CMAKE_SOURCE_DIR}/config/kconfig.cmake)
36else()
37 include(${CMAKE_SOURCE_DIR}/config/set_config.cmake)
38endif()
39
Kevin Pengd0e49712022-12-07 11:13:01 +080040include(config/post_config.cmake)
Raef Coles69817322020-10-19 14:14:14 +010041
Raef Coles69817322020-10-19 14:14:14 +010042############################### Compiler configuration #########################
43
Raef Coles69817322020-10-19 14:14:14 +010044include(${TFM_TOOLCHAIN_FILE})
Anton Komlevdd0a7222023-09-19 18:49:39 +010045
46set(CMAKE_C_COMPILER_FORCED true)
47set(CMAKE_CXX_COMPILER_FORCED true)
Raef Coles69817322020-10-19 14:14:14 +010048
Rajkumar Kanagarajcd831592022-05-04 11:44:03 +020049project("Trusted Firmware M" VERSION ${TFM_VERSION} LANGUAGES C CXX ASM)
David Hu9e1b2632023-10-14 13:35:24 +080050tfm_toolchain_reload_compiler()
Raef Coles69817322020-10-19 14:14:14 +010051
Raef Coles9ec67e62020-07-10 09:40:35 +010052add_subdirectory(lib/ext)
Tamas Banb881bea2020-11-04 16:18:36 +000053add_subdirectory(lib/fih)
Raef Coles9ec67e62020-07-10 09:40:35 +010054add_subdirectory(tools)
David Hu1a2d4832022-01-18 14:42:04 +080055add_subdirectory(secure_fw)
Raef Colesd97a7e72021-12-10 14:58:06 +000056
Raef Coles9ec67e62020-07-10 09:40:35 +010057add_subdirectory(interface)
58if(BL2)
59 add_subdirectory(bl2)
60endif()
Raef Coles9ec67e62020-07-10 09:40:35 +010061
Raef Coles15a37f82021-12-07 15:59:14 +000062if(BL1 AND PLATFORM_DEFAULT_BL1)
63 add_subdirectory(bl1/bl1_2)
64 add_subdirectory(bl1/bl1_1)
65endif()
66
Raef Colesd97a7e72021-12-10 14:58:06 +000067add_subdirectory(platform)
Raef Coles9ec67e62020-07-10 09:40:35 +010068
Raef Coles9ec67e62020-07-10 09:40:35 +010069if(CRYPTO_HW_ACCELERATOR)
70 add_subdirectory(platform/ext/accelerator)
71endif()
Chris Brand9edf0812022-07-05 14:18:42 -070072
David Hua993bd92023-10-23 22:41:06 +080073if(DEFINED CONFIG_TFM_TEST_DIR)
74 add_subdirectory(${CONFIG_TFM_TEST_DIR} ${CMAKE_CURRENT_BINARY_DIR}/tf-m-tests)
75endif()
76
Anton Komleva07180c2022-10-24 23:53:47 +010077############################ Config Check ######################################
78
79include(${CMAKE_SOURCE_DIR}/config/check_config.cmake)
80
81################################################################################
82
Chris Brand9edf0812022-07-05 14:18:42 -070083include(cmake/install.cmake)