blob: 76b0f18321c5b6a06126aabf257e1d1ae08e242d [file] [log] [blame]
Gyorgy Szing49091802020-11-24 00:33:09 +01001#-------------------------------------------------------------------------------
Gyorgy Szing34aaf212022-10-20 07:26:23 +02002# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
Gyorgy Szing49091802020-11-24 00:33:09 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8#[===[.rst:
9 The base deployment CMake file
10 ------------------------------
11
12 Contains common CMake definitions that are used by concrete deployments.
13 This file should be included first by a concrete deployment's CMakeLists.txt.
14#]===]
15
16# Sets TS-ROOT which is used as the reference directory for everything contained within the project
17get_filename_component(TS_ROOT "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE CACHE PATH "Trusted Services root directory.")
18
19# Replicate TS_ROOT as environment variable to allow access from child CMake contexts
20set(ENV{TS_ROOT} "${TS_ROOT}")
21
22# Common utilities used by the build system
23include(${TS_ROOT}/tools/cmake/common/Utils.cmake REQUIRED)
24include(${TS_ROOT}/tools/cmake/common/AddComponents.cmake REQUIRED)
julhal01ffa98d82021-01-20 13:51:58 +000025include(${TS_ROOT}/tools/cmake/common/AddPlatform.cmake REQUIRED)
Balint Dobszay384fc502021-11-08 11:59:10 +010026include(${TS_ROOT}/tools/cmake/common/TsGetVersion.cmake REQUIRED)
Gyorgy Szing49091802020-11-24 00:33:09 +010027
28# Check build environment requirements are met
29ts_verify_build_env()
30
31# Project wide include directories
32set(TOP_LEVEL_INCLUDE_DIRS
33 "${TS_ROOT}"
34 "${TS_ROOT}/components"
35 )
julhal01ffa98d82021-01-20 13:51:58 +000036
37# Set platform provider root default to use if no commandline variable value has been specified.
38# The root path may be specified to allow an external project to provide platform definitions.
39if (DEFINED ENV{TS_PLATFORM_ROOT})
40 set(_default_platform_root ENV{TS_PLATFORM_ROOT})
41else()
42 set(_default_platform_root "${TS_ROOT}/platform/providers")
43endif()
44set(TS_PLATFORM_ROOT ${_default_platform_root} CACHE STRING "Platform provider path")
45
46# Set the default platform to use if no explict platform has been specified on the cmake commandline.
47if (DEFINED ENV{TS_PLATFORM})
48 set(_default_platform ENV{TS_PLATFORM})
49else()
50 set(_default_platform "ts/vanilla")
51endif()
52set(TS_PLATFORM ${_default_platform} CACHE STRING "Selected platform")
53
54# Custom property for defining platform feature dependencies based on components used in a deployment
55define_property(TARGET PROPERTY TS_PLATFORM_DRIVER_DEPENDENCIES
56 BRIEF_DOCS "List of platform driver interfaces used for a deployment."
57 FULL_DOCS "Used by the platform specific builder to specify a configuration for the built platform components."
Gyorgy Szing34aaf212022-10-20 07:26:23 +020058 )
59
60# Set default build type to Debug
61if (NOT CMAKE_BUILD_TYPE)
62 set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type.")
63endif()
64
65# List of supported build types. Needs to be in alignment with the toolchain file
66set(TS_SUPPORTED_BUILD_TYPES DEBUG "MINSIZEREL" "MINSIZWITHDEBINFO" "RELEASE" "RELWITHDEBINFO" CACHE
67 STRING "List of supported build types.")
68
69# Convert the build type string to upper case to help case insensitive comparison.
70string(TOUPPER "${CMAKE_BUILD_TYPE}" UC_CMAKE_BUILD_TYPE CACHE STRING "Easy to compare build type.")
71mark_as_advanced(UC_CMAKE_BUILD_TYPE)
72
73# Validate build type
74if (NOT "${UC_CMAKE_BUILD_TYPE}" IN_LIST TS_SUPPORTED_BUILD_TYPES)
75 message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\" specified in CMAKE_BUILD_TYPE.")
76endif()
Jelle Sels4960c412023-02-01 09:43:24 +010077
78# Default protocol UUID used by TS SPs.
79set(TS_RPC_UUID_CANON "bdcd76d7-825e-4751-963b-86d4f84943ac" CACHE STRING "Trusted Services PRC (protocol) UUID.")