blob: 68730c0a4cb95f39bb15ac94bd35a531e50863d1 [file] [log] [blame]
Gyorgy Szing30fa9872017-12-05 01:08:47 +00001#-------------------------------------------------------------------------------
Raef Coles9ec67e62020-07-10 09:40:35 +01002# Copyright (c) 2020, Arm Limited. All rights reserved.
Gyorgy Szing30fa9872017-12-05 01:08:47 +00003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
Raef Coles9ec67e62020-07-10 09:40:35 +01008cmake_minimum_required(VERSION 3.13)
Gyorgy Szing30fa9872017-12-05 01:08:47 +00009
Raef Coles9ec67e62020-07-10 09:40:35 +010010project("Trusted Firmware M" VERSION 1.1.0 LANGUAGES C ASM)
11set(TFM_VERSION ${PROJECT_VERSION})
Gyorgy Szing30fa9872017-12-05 01:08:47 +000012
Raef Coles9ec67e62020-07-10 09:40:35 +010013# Some compiler flags depend on the CPU / platform config. This include should
14# be run before anything else so the compiler can be configured properly.
15include(platform/ext/target/${TFM_PLATFORM}/preload.cmake)
16
17# The default build type is release. If debug symbols are needed then
18# -DCMAKE_BUILD_TYPE=debug should be used (likewise with other build types)
19if (NOT CMAKE_BUILD_TYPE)
20 set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type: [Debug, Release, RelWithDebInfo, MinSizeRel]" FORCE)
David Vinczec3e313a2020-01-06 17:31:11 +010021endif()
Gyorgy Szing30fa9872017-12-05 01:08:47 +000022
Raef Coles9ec67e62020-07-10 09:40:35 +010023############################ CONFIGURATION #####################################
24
25# First load defaults.
26include(config/config_default.cmake)
27
28# Then load the build type config, overriding defaults and command line.
29string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE)
30if (EXISTS ${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
31 include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
32endif()
33
34# Then load the profile, overriding build type config, defaults and command
35# line.
36if (TFM_PROFILE)
37 include(config/profile/${TFM_PROFILE}.cmake)
38endif()
39
40# Then load the platform options, overriding profile, build type config,
41# defaults and command line.
42if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/config.cmake)
43 include(platform/ext/target/${TFM_PLATFORM}/config.cmake)
44endif()
45
46# Optionally load extra config, overriding platform options, overriding profile,
47# build type config, defaults and command line.
48if (TFM_EXTRA_CONFIG_PATH)
49 include(${TFM_EXTRA_CONFIG_PATH})
50endif()
51
52list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
53
54################################################################################
55
56add_subdirectory(lib/ext)
57add_subdirectory(tools)
Minos Galanakisdff2eae2020-07-21 15:13:52 +010058add_subdirectory(docs)
Raef Coles9ec67e62020-07-10 09:40:35 +010059if(NS)
60 # Set to ${TFM_TEST_REPO_PATH}/app by default
61 add_subdirectory(${TFM_APP_PATH} ${CMAKE_CURRENT_BINARY_DIR}/app)
62endif()
63add_subdirectory(secure_fw)
64add_subdirectory(interface)
65if(BL2)
66 add_subdirectory(bl2)
67endif()
68add_subdirectory(platform)
69
70if(NS AND (TEST_S OR TEST_NS))
71 # Set to ${TFM_TEST_REPO_PATH}/test by default
72 add_subdirectory(${TFM_TEST_PATH} ${CMAKE_CURRENT_BINARY_DIR}/test)
73endif()
74
75include(cmake/install.cmake)
76
77if(CRYPTO_HW_ACCELERATOR)
78 add_subdirectory(platform/ext/accelerator)
79endif()