Antonio de Angelis | 8908f47 | 2018-08-31 15:44:25 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 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. |
| 22 | set(CRYPTO_DIR ${CMAKE_CURRENT_LIST_DIR}) |
| 23 | |
| 24 | #Check input variables |
| 25 | if (NOT DEFINED ENABLE_CRYPTO) |
| 26 | message(FATAL_ERROR "Incomplete build configuration: ENABLE_CRYPTO is undefined. ") |
| 27 | endif() |
| 28 | |
| 29 | if (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" |
Antonio de Angelis | a6f7216 | 2018-09-05 11:00:37 +0100 | [diff] [blame^] | 41 | "${CRYPTO_DIR}/crypto_hash.c" |
Antonio de Angelis | 8908f47 | 2018-08-31 15:44:25 +0100 | [diff] [blame] | 42 | "${CRYPTO_DIR}/crypto_key.c" |
| 43 | "${CRYPTO_DIR}/crypto_wrappers.c" |
| 44 | "${CRYPTO_DIR}/crypto_utils.c" |
| 45 | ) |
| 46 | |
| 47 | #Append all our source files to global lists. |
| 48 | list(APPEND ALL_SRC_C ${CRYPTO_C_SRC}) |
| 49 | unset(CRYPTO_C_SRC) |
| 50 | |
| 51 | #Setting include directories |
| 52 | embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE) |
| 53 | embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE) |
| 54 | embedded_include_directories(PATH ${MBEDTLS_INSTALL_DIR}/include ABSOLUTE) |
| 55 | |
| 56 | else() |
| 57 | message(FATAL_ERROR "Build system currently doesn't support selectively disabling of a service.") |
| 58 | endif() |