Gyorgy Szing | 4909180 | 2020-11-24 00:33:09 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Gyorgy Szing | 34aaf21 | 2022-10-20 07:26:23 +0200 | [diff] [blame] | 2 | # Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved. |
Gyorgy Szing | 4909180 | 2020-11-24 00:33:09 +0100 | [diff] [blame] | 3 | # |
| 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 |
| 17 | get_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 |
| 20 | set(ENV{TS_ROOT} "${TS_ROOT}") |
| 21 | |
| 22 | # Common utilities used by the build system |
| 23 | include(${TS_ROOT}/tools/cmake/common/Utils.cmake REQUIRED) |
| 24 | include(${TS_ROOT}/tools/cmake/common/AddComponents.cmake REQUIRED) |
julhal01 | ffa98d8 | 2021-01-20 13:51:58 +0000 | [diff] [blame] | 25 | include(${TS_ROOT}/tools/cmake/common/AddPlatform.cmake REQUIRED) |
Balint Dobszay | 384fc50 | 2021-11-08 11:59:10 +0100 | [diff] [blame] | 26 | include(${TS_ROOT}/tools/cmake/common/TsGetVersion.cmake REQUIRED) |
Gyorgy Szing | 4909180 | 2020-11-24 00:33:09 +0100 | [diff] [blame] | 27 | |
| 28 | # Check build environment requirements are met |
| 29 | ts_verify_build_env() |
| 30 | |
| 31 | # Project wide include directories |
| 32 | set(TOP_LEVEL_INCLUDE_DIRS |
| 33 | "${TS_ROOT}" |
| 34 | "${TS_ROOT}/components" |
| 35 | ) |
julhal01 | ffa98d8 | 2021-01-20 13:51:58 +0000 | [diff] [blame] | 36 | |
| 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. |
| 39 | if (DEFINED ENV{TS_PLATFORM_ROOT}) |
| 40 | set(_default_platform_root ENV{TS_PLATFORM_ROOT}) |
| 41 | else() |
| 42 | set(_default_platform_root "${TS_ROOT}/platform/providers") |
| 43 | endif() |
| 44 | set(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. |
| 47 | if (DEFINED ENV{TS_PLATFORM}) |
| 48 | set(_default_platform ENV{TS_PLATFORM}) |
| 49 | else() |
| 50 | set(_default_platform "ts/vanilla") |
| 51 | endif() |
| 52 | set(TS_PLATFORM ${_default_platform} CACHE STRING "Selected platform") |
| 53 | |
| 54 | # Custom property for defining platform feature dependencies based on components used in a deployment |
| 55 | define_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 Szing | 34aaf21 | 2022-10-20 07:26:23 +0200 | [diff] [blame] | 58 | ) |
| 59 | |
| 60 | # Set default build type to Debug |
| 61 | if (NOT CMAKE_BUILD_TYPE) |
| 62 | set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type.") |
| 63 | endif() |
| 64 | |
| 65 | # List of supported build types. Needs to be in alignment with the toolchain file |
Gyorgy Szing | 1ff7d79 | 2024-09-18 13:40:05 +0200 | [diff] [blame] | 66 | set(TS_SUPPORTED_BUILD_TYPES "DEBUG" "MINSIZEREL" "MINSIZWITHDEBINFO" "RELEASE" "RELWITHDEBINFO" "DEBUGCOVERAGE" CACHE |
Gyorgy Szing | 34aaf21 | 2022-10-20 07:26:23 +0200 | [diff] [blame] | 67 | STRING "List of supported build types.") |
| 68 | |
| 69 | # Convert the build type string to upper case to help case insensitive comparison. |
| 70 | string(TOUPPER "${CMAKE_BUILD_TYPE}" UC_CMAKE_BUILD_TYPE CACHE STRING "Easy to compare build type.") |
| 71 | mark_as_advanced(UC_CMAKE_BUILD_TYPE) |
| 72 | |
| 73 | # Validate build type |
| 74 | if (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.") |
| 76 | endif() |
Jelle Sels | 4960c41 | 2023-02-01 09:43:24 +0100 | [diff] [blame] | 77 | |
Gyorgy Szing | 09daade | 2024-09-18 13:45:26 +0200 | [diff] [blame^] | 78 | # Set postfix of libraries according the build type. |
| 79 | if (UC_CMAKE_BUILD_TYPE STREQUAL "DEBUGCOVERAGE") |
| 80 | set(CMAKE_${UC_CMAKE_BUILD_TYPE}_POSTFIX "c") |
| 81 | elseif(UC_CMAKE_BUILD_TYPE STREQUAL "DEBUG") |
| 82 | set(CMAKE_${UC_CMAKE_BUILD_TYPE}_POSTFIX "d") |
| 83 | endif() |
| 84 | |
Jelle Sels | 4960c41 | 2023-02-01 09:43:24 +0100 | [diff] [blame] | 85 | # Default protocol UUID used by TS SPs. |
| 86 | set(TS_RPC_UUID_CANON "bdcd76d7-825e-4751-963b-86d4f84943ac" CACHE STRING "Trusted Services PRC (protocol) UUID.") |