aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRaef Coles <raef.coles@arm.com>2020-07-10 09:40:35 +0100
committerTamas Ban <tamas.ban@arm.com>2020-09-24 12:49:54 +0000
commit9ec67e6f3f9d09fa21323b49e3b65537fac95144 (patch)
treef9fb65c16c226f6fdbc45be6d3899eaaa29e8cad /CMakeLists.txt
parent01da63fbc646e1215579097168378e642af14842 (diff)
downloadtrusted-firmware-m-9ec67e6f3f9d09fa21323b49e3b65537fac95144.tar.gz
Build: Convert buildsystem base to modern cmake
Alters root cmake file and configuration files, and adds cmake toolchain files. WARNING: This change will not build in isolation, it requires _all_ other cmake changes to successfully build. It is split out only for clarity of changes. Signed-off-by: Raef Coles <raef.coles@arm.com> Change-Id: Iecc914859a5b1d497176ec82f0b6c22764c7b556
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt80
1 files changed, 72 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7f1a7ba23..d629418ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,20 +1,84 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-cmake_minimum_required(VERSION 3.7)
+cmake_minimum_required(VERSION 3.13)
+
+project("Trusted Firmware M" VERSION 1.1.0 LANGUAGES C ASM)
+set(TFM_VERSION ${PROJECT_VERSION})
+
+# Some compiler flags depend on the CPU / platform config. This include should
+# be run before anything else so the compiler can be configured properly.
+include(platform/ext/target/${TFM_PLATFORM}/preload.cmake)
+
+# The default build type is release. If debug symbols are needed then
+# -DCMAKE_BUILD_TYPE=debug should be used (likewise with other build types)
+if (NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type: [Debug, Release, RelWithDebInfo, MinSizeRel]" FORCE)
+endif()
+
+message(FATAL_ERROR "This commit is inside the patch chain for convertion of the
+old cmake buildsystem to the modern one. TFM will not build unless all of these
+patches have been applied, these commits are split only for ease of
+understanding. If you wish to build TFM, please checkout the commit
+\"Build: Convert docs directory to modern cmake\"")
+
+############################ CONFIGURATION #####################################
+
+# First load defaults.
+include(config/config_default.cmake)
+
+# Then load the build type config, overriding defaults and command line.
+string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE)
+if (EXISTS ${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
+ include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
+endif()
+
+# Then load the profile, overriding build type config, defaults and command
+# line.
+if (TFM_PROFILE)
+ include(config/profile/${TFM_PROFILE}.cmake)
+endif()
+
+# Then load the platform options, overriding profile, build type config,
+# defaults and command line.
+if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/config.cmake)
+ include(platform/ext/target/${TFM_PLATFORM}/config.cmake)
+endif()
+
+# Optionally load extra config, overriding platform options, overriding profile,
+# build type config, defaults and command line.
+if (TFM_EXTRA_CONFIG_PATH)
+ include(${TFM_EXTRA_CONFIG_PATH})
+endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
-include("Common/BuildSys")
+################################################################################
+
+add_subdirectory(lib/ext)
+add_subdirectory(tools)
+if(NS)
+ # Set to ${TFM_TEST_REPO_PATH}/app by default
+ add_subdirectory(${TFM_APP_PATH} ${CMAKE_CURRENT_BINARY_DIR}/app)
+endif()
add_subdirectory(secure_fw)
-add_subdirectory(../tf-m-tests/app ${CMAKE_CURRENT_BINARY_DIR}/app)
-if (BL2)
- add_subdirectory(bl2/ext/mcuboot)
+add_subdirectory(interface)
+if(BL2)
+ add_subdirectory(bl2)
+endif()
+add_subdirectory(platform)
+
+if(NS AND (TEST_S OR TEST_NS))
+ # Set to ${TFM_TEST_REPO_PATH}/test by default
+ add_subdirectory(${TFM_TEST_PATH} ${CMAKE_CURRENT_BINARY_DIR}/test)
endif()
-#Define a top-level generic tfm project
-project(tfm LANGUAGES)
+include(cmake/install.cmake)
+
+if(CRYPTO_HW_ACCELERATOR)
+ add_subdirectory(platform/ext/accelerator)
+endif()