Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame^] | 2 | # Copyright (c) 2020, Arm Limited. All rights reserved. |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame^] | 8 | cmake_minimum_required(VERSION 3.13) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 9 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame^] | 10 | project("Trusted Firmware M" VERSION 1.1.0 LANGUAGES C ASM) |
| 11 | set(TFM_VERSION ${PROJECT_VERSION}) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 12 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame^] | 13 | # 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. |
| 15 | include(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) |
| 19 | if (NOT CMAKE_BUILD_TYPE) |
| 20 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type: [Debug, Release, RelWithDebInfo, MinSizeRel]" FORCE) |
David Vincze | c3e313a | 2020-01-06 17:31:11 +0100 | [diff] [blame] | 21 | endif() |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 22 | |
Raef Coles | 9ec67e6 | 2020-07-10 09:40:35 +0100 | [diff] [blame^] | 23 | message(FATAL_ERROR "This commit is inside the patch chain for convertion of the |
| 24 | old cmake buildsystem to the modern one. TFM will not build unless all of these |
| 25 | patches have been applied, these commits are split only for ease of |
| 26 | understanding. If you wish to build TFM, please checkout the commit |
| 27 | \"Build: Convert docs directory to modern cmake\"") |
| 28 | |
| 29 | ############################ CONFIGURATION ##################################### |
| 30 | |
| 31 | # First load defaults. |
| 32 | include(config/config_default.cmake) |
| 33 | |
| 34 | # Then load the build type config, overriding defaults and command line. |
| 35 | string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) |
| 36 | if (EXISTS ${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake) |
| 37 | include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake) |
| 38 | endif() |
| 39 | |
| 40 | # Then load the profile, overriding build type config, defaults and command |
| 41 | # line. |
| 42 | if (TFM_PROFILE) |
| 43 | include(config/profile/${TFM_PROFILE}.cmake) |
| 44 | endif() |
| 45 | |
| 46 | # Then load the platform options, overriding profile, build type config, |
| 47 | # defaults and command line. |
| 48 | if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/config.cmake) |
| 49 | include(platform/ext/target/${TFM_PLATFORM}/config.cmake) |
| 50 | endif() |
| 51 | |
| 52 | # Optionally load extra config, overriding platform options, overriding profile, |
| 53 | # build type config, defaults and command line. |
| 54 | if (TFM_EXTRA_CONFIG_PATH) |
| 55 | include(${TFM_EXTRA_CONFIG_PATH}) |
| 56 | endif() |
| 57 | |
| 58 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
| 59 | |
| 60 | ################################################################################ |
| 61 | |
| 62 | add_subdirectory(lib/ext) |
| 63 | add_subdirectory(tools) |
| 64 | if(NS) |
| 65 | # Set to ${TFM_TEST_REPO_PATH}/app by default |
| 66 | add_subdirectory(${TFM_APP_PATH} ${CMAKE_CURRENT_BINARY_DIR}/app) |
| 67 | endif() |
| 68 | add_subdirectory(secure_fw) |
| 69 | add_subdirectory(interface) |
| 70 | if(BL2) |
| 71 | add_subdirectory(bl2) |
| 72 | endif() |
| 73 | add_subdirectory(platform) |
| 74 | |
| 75 | if(NS AND (TEST_S OR TEST_NS)) |
| 76 | # Set to ${TFM_TEST_REPO_PATH}/test by default |
| 77 | add_subdirectory(${TFM_TEST_PATH} ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 78 | endif() |
| 79 | |
| 80 | include(cmake/install.cmake) |
| 81 | |
| 82 | if(CRYPTO_HW_ACCELERATOR) |
| 83 | add_subdirectory(platform/ext/accelerator) |
| 84 | endif() |