Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Jamie Fox | 52542dd | 2018-03-08 13:25:46 +0000 | [diff] [blame] | 2 | # Copyright (c) 2017-2018, Arm Limited. All rights reserved. |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | cmake_minimum_required(VERSION 3.7) |
| 9 | |
| 10 | #Tell cmake where our modules can be found |
| 11 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake) |
| 12 | |
| 13 | #Include common stuff to control cmake. |
| 14 | include("Common/BuildSys") |
| 15 | |
| 16 | #Start an embedded project. |
| 17 | embedded_project_start(CONFIG "${CMAKE_CURRENT_LIST_DIR}/../ConfigDefault.cmake") |
| 18 | project(tfm_tests LANGUAGES ASM C) |
| 19 | embedded_project_fixup() |
| 20 | |
| 21 | get_filename_component(TFM_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) |
| 22 | |
| 23 | #Check incoming configuration options |
| 24 | if (NOT DEFINED SERVICES_TEST_ENABLED) |
| 25 | message(FATAL_ERROR "Incomplete build configuration: SERVICES_TEST_ENABLED is undefined. ") |
| 26 | endif() |
| 27 | |
| 28 | if (NOT DEFINED CORE_TEST) |
| 29 | message(FATAL_ERROR "Incomplete build configuration: CORE_TEST is undefined. ") |
| 30 | endif() |
| 31 | |
| 32 | if(CORE_TEST) |
| 33 | set (TFM_LVL 3) |
| 34 | else() |
| 35 | set (TFM_LVL 1) |
| 36 | endif() |
| 37 | |
| 38 | #Configure our options as needed. |
| 39 | if (CORE_TEST_INTERACTIVE OR CORE_TEST_POSITIVE) |
| 40 | set(ENABLE_CORE_TESTS True) |
| 41 | set(ENABLE_CORE_TESTS_2 True) |
| 42 | else() |
| 43 | set(ENABLE_CORE_TESTS False) |
| 44 | set(ENABLE_CORE_TESTS_2 False) |
| 45 | endif() |
| 46 | |
| 47 | if (NOT DEFINED CMSIS_5_DIR) |
| 48 | set(CMSIS_5_DIR ${TFM_ROOT_DIR}/../CMSIS_5) |
| 49 | endif() |
| 50 | set(ENABLE_SECURE_STORAGE_SERVICE_TESTS TRUE) |
| 51 | set(ENABLE_INVERT_SERVICE_TESTS TRUE) |
| 52 | include(${CMAKE_CURRENT_LIST_DIR}/CMakeLists.inc) |
| 53 | |
| 54 | #Build the secure library |
| 55 | add_library(tfm_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_S}) |
| 56 | embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 TFM_LVL=${TFM_LVL} APPEND) |
| 57 | |
| 58 | |
| 59 | #Build the non-secure library |
| 60 | set(CMAKE_STATIC_LIBRARY_PREFIX_C "lib") |
| 61 | add_library(tfm_non_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_NS}) |
| 62 | embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 __DOMAIN_NS=1 APPEND) |
| 63 | #__DOMAIN_NS=1 |
| 64 | |
| 65 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 66 | SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Default install location for tfm_storage." FORCE) |
| 67 | endif() |
| 68 | |
| 69 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/framework/integ_test.h |
Antonio de Angelis | 8ad3d381 | 2018-04-13 16:48:00 +0100 | [diff] [blame^] | 70 | ${CMAKE_CURRENT_SOURCE_DIR}/interface/include/svc_core_test_ns.h |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 71 | ${CMAKE_CURRENT_SOURCE_DIR}/suites/sst/non_secure/os_wrapper.h |
Antonio de Angelis | 8ad3d381 | 2018-04-13 16:48:00 +0100 | [diff] [blame^] | 72 | ${CMAKE_CURRENT_SOURCE_DIR}/interface/include/sst_test_service_svc.h |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 73 | DESTINATION tfm/test/inc) |
| 74 | |
| 75 | install(TARGETS tfm_non_secure_tests |
| 76 | DESTINATION tfm/test/lib |
| 77 | PUBLIC_HEADER DESTINATION tfm/test/inc) |
| 78 | |
| 79 | |
| 80 | embedded_project_end(tfm_non_secure_tests) |
| 81 | embedded_project_end(tfm_secure_tests) |