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 | |
Tamas Ban | 3109b30 | 2018-08-15 14:51:58 +0100 | [diff] [blame] | 28 | if (NOT DEFINED CORE_TEST_INTERACTIVE) |
| 29 | message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_INTERACTIVE is undefined. ") |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 30 | endif() |
| 31 | |
Tamas Ban | 3109b30 | 2018-08-15 14:51:58 +0100 | [diff] [blame] | 32 | if (NOT DEFINED CORE_TEST_POSITIVE) |
| 33 | message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_POSITIVE is undefined. ") |
| 34 | endif() |
| 35 | |
| 36 | if (NOT DEFINED TFM_LVL) |
| 37 | message(FATAL_ERROR "Incomplete build configuration: TFM_LVL is undefined. ") |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 38 | endif() |
| 39 | |
| 40 | #Configure our options as needed. |
| 41 | if (CORE_TEST_INTERACTIVE OR CORE_TEST_POSITIVE) |
| 42 | set(ENABLE_CORE_TESTS True) |
| 43 | set(ENABLE_CORE_TESTS_2 True) |
| 44 | else() |
| 45 | set(ENABLE_CORE_TESTS False) |
| 46 | set(ENABLE_CORE_TESTS_2 False) |
| 47 | endif() |
| 48 | |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 49 | set(ENABLE_SECURE_STORAGE_SERVICE_TESTS TRUE) |
Antonio de Angelis | 7852dff | 2018-02-07 11:15:54 +0000 | [diff] [blame] | 50 | set(ENABLE_AUDIT_LOGGING_SERVICE_TESTS TRUE) |
Antonio de Angelis | 88c5b27 | 2018-08-31 15:48:21 +0100 | [diff] [blame^] | 51 | set(ENABLE_CRYPTO_SERVICE_TESTS TRUE) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 52 | set(ENABLE_INVERT_SERVICE_TESTS TRUE) |
| 53 | include(${CMAKE_CURRENT_LIST_DIR}/CMakeLists.inc) |
| 54 | |
| 55 | #Build the secure library |
| 56 | add_library(tfm_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_S}) |
Tamas Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 57 | |
| 58 | #Set common compiler and linker flags |
| 59 | config_setting_shared_compiler_flags(tfm_secure_tests) |
| 60 | config_setting_shared_linker_flags(tfm_secure_tests) |
| 61 | |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 62 | embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 TFM_LVL=${TFM_LVL} APPEND) |
| 63 | |
| 64 | |
| 65 | #Build the non-secure library |
| 66 | set(CMAKE_STATIC_LIBRARY_PREFIX_C "lib") |
| 67 | add_library(tfm_non_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_NS}) |
Tamas Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 68 | |
| 69 | #Set common compiler and linker flags |
| 70 | config_setting_shared_compiler_flags(tfm_non_secure_tests) |
| 71 | config_setting_shared_linker_flags(tfm_non_secure_tests) |
| 72 | |
Tamas Ban | d90c81b | 2018-08-15 15:03:42 +0100 | [diff] [blame] | 73 | embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 __DOMAIN_NS=1 TFM_LVL=${TFM_LVL} APPEND) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 74 | #__DOMAIN_NS=1 |
| 75 | |
| 76 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
Tamas Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 77 | set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Default install location for tfm_storage." FORCE) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 78 | endif() |
| 79 | |
Tamas Ban | c2074a7 | 2018-08-14 10:23:12 +0100 | [diff] [blame] | 80 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_integ_test.h |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 81 | ${CMAKE_CURRENT_SOURCE_DIR}/suites/sst/non_secure/os_wrapper.h |
Mate Toth-Pal | 1379e15 | 2018-07-30 17:38:29 +0200 | [diff] [blame] | 82 | ${CMAKE_CURRENT_SOURCE_DIR}/test_services/tfm_sst_test_service/sst_test_service.h |
| 83 | ${CMAKE_CURRENT_SOURCE_DIR}/test_services/tfm_secure_client_service/tfm_secure_client_service.h |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 84 | DESTINATION tfm/test/inc) |
| 85 | |
| 86 | install(TARGETS tfm_non_secure_tests |
Tamas Ban | 57bfa43 | 2018-04-13 16:05:49 +0100 | [diff] [blame] | 87 | DESTINATION export/tfm/test/lib |
| 88 | PUBLIC_HEADER DESTINATION export/tfm/test/inc) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 89 | |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 90 | embedded_project_end(tfm_non_secure_tests) |
| 91 | embedded_project_end(tfm_secure_tests) |