blob: cfaa709c49179016b7658bfe59a6436964e01976 [file] [log] [blame]
Antonio de Angelis8908f472018-08-31 15:44:25 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2018, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8#Definitions to compile the "crypto" module.
9#This file assumes it will be included from a project specific cmakefile, and
10#will not create a library or executable.
11#Inputs:
12# MBEDTLS_INSTALL_DIR - directory where mbed TLS headers and libraries can be found.
13# TFM_ROOT_DIR - root directory of the TF-M repository.
14#Outputs:
15# Will modify include directories to make the source compile.
16# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
17# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
18# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
19# Include directories will be modified by using the include_directories() commands as needed.
20
21#Get the current directory where this file is located.
22set(CRYPTO_DIR ${CMAKE_CURRENT_LIST_DIR})
23
24#Check input variables
25if (NOT DEFINED ENABLE_CRYPTO)
26 message(FATAL_ERROR "Incomplete build configuration: ENABLE_CRYPTO is undefined. ")
27endif()
28
29if (ENABLE_CRYPTO)
30 if (NOT DEFINED MBEDTLS_INSTALL_DIR)
31 message(FATAL_ERROR "Please set MBEDTLS_INSTALL_DIR before including this file.")
32 endif()
33
34 if (NOT DEFINED TFM_ROOT_DIR)
35 message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
36 endif()
37
38 set (CRYPTO_C_SRC "${CRYPTO_DIR}/crypto_init.c"
39 "${CRYPTO_DIR}/crypto_alloc.c"
40 "${CRYPTO_DIR}/crypto_cipher.c"
41 "${CRYPTO_DIR}/crypto_key.c"
42 "${CRYPTO_DIR}/crypto_wrappers.c"
43 "${CRYPTO_DIR}/crypto_utils.c"
44 )
45
46 #Append all our source files to global lists.
47 list(APPEND ALL_SRC_C ${CRYPTO_C_SRC})
48 unset(CRYPTO_C_SRC)
49
50 #Setting include directories
51 embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
52 embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
53 embedded_include_directories(PATH ${MBEDTLS_INSTALL_DIR}/include ABSOLUTE)
54
55else()
56 message(FATAL_ERROR "Build system currently doesn't support selectively disabling of a service.")
57endif()