blob: 060b851c6a63a1fbcc7d6a7765ea424a5c586001 [file] [log] [blame]
Soby Mathewb4c6df42022-11-09 11:13:29 +00001#
2# SPDX-License-Identifier: BSD-3-Clause
3# SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
4#
5
6#
7# Common config options
8#
9arm_config_option(
10 NAME MAX_CPUS
11 HELP "Maximum number of CPUs supported by RMM"
12 TYPE STRING
13 DEFAULT 16)
14
15#
16# The RMM is mapped with 4K pages, and all RMM APIs use the same granularity.
17#
18arm_config_option(
19 NAME GRANULE_SIZE
20 HELP "Granule Size used by RMM"
21 TYPE STRING
22 DEFAULT 4096)
23
AlexeiFedorov7c5001a2022-12-14 13:22:33 +000024#
25# RMM_MAX_GRANULES. Maximum number of granules supported.
26#
27arm_config_option(
28 NAME RMM_MAX_GRANULES
29 HELP "Maximum number of granules supported"
30 TYPE STRING
31 DEFAULT 0x0)
32
Soby Mathewb4c6df42022-11-09 11:13:29 +000033arm_config_option(
34 NAME RMM_DOCS
35 HELP "RMM Documentation build"
36 TYPE BOOL
37 DEFAULT OFF)
38
39# TODO: Move to lib/arch once MbedTLS compilation is moved to build phase.
40arm_config_option(
41 NAME RMM_FPU_USE_AT_REL2
42 HELP "Enable Advanced SIMD support in RMM"
43 TYPE BOOL
44 DEFAULT ON
45 DEPENDS (RMM_ARCH STREQUAL aarch64)
46 ELSE OFF)
47
48#
49# Introduce a pseudo-library purely for applying flags to RMM's libraries.
50# This is applied to any targets created after this point.
51#
52
53add_library(rmm-common INTERFACE)
54
55target_compile_definitions(rmm-common
56 INTERFACE "$<$<CONFIG:Debug>:DEBUG>")
57
58if(MAX_CPUS EQUAL 0x0)
59 message(FATAL_ERROR "MAX_CPUS is not initialized")
60endif()
61
62target_compile_definitions(rmm-common
Javier Almansa Sobrinoc4ad5b02022-07-05 19:05:14 +010063 INTERFACE "MAX_CPUS=${MAX_CPUS}U")
Soby Mathewb4c6df42022-11-09 11:13:29 +000064
65if(NOT(GRANULE_SIZE EQUAL 4096))
66 message(FATAL_ERROR "GRANULE_SIZE is not initialized correctly")
67endif()
68
69target_compile_definitions(rmm-common
70 INTERFACE "GRANULE_SIZE=U(${GRANULE_SIZE})")
71
AlexeiFedorov7c5001a2022-12-14 13:22:33 +000072if (RMM_MAX_GRANULES EQUAL 0x0)
73 message (FATAL_ERROR "RMM_MAX_GRANULES not configured")
74endif()
75
76target_compile_definitions(rmm-common
77 INTERFACE "RMM_MAX_GRANULES=U(${RMM_MAX_GRANULES})")
78
Soby Mathewb4c6df42022-11-09 11:13:29 +000079if(RMM_FPU_USE_AT_REL2)
80 target_compile_definitions(rmm-common
81 INTERFACE "RMM_FPU_USE_AT_REL2=1")
82endif()
83
84#
85# Project name and version
86#
87target_compile_definitions(rmm-common
88 INTERFACE "NAME=\"${PROJECT_NAME}\"")
89
90target_compile_definitions(rmm-common
91 INTERFACE "VERSION=\"${PROJECT_VERSION}\"")
92
93#
94# Get git commit information
95#
96find_package(Git)
97if(GIT_FOUND)
98 execute_process(
99 COMMAND ${GIT_EXECUTABLE} describe --always --dirty --tags
100 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
101 OUTPUT_VARIABLE COMMIT_INFO
102 OUTPUT_STRIP_TRAILING_WHITESPACE
103 )
104endif()
105
106target_compile_definitions(rmm-common
107 INTERFACE "COMMIT_INFO=\"${COMMIT_INFO}\"")
108
109link_libraries(rmm-common)