blob: b81f46be54368960e6f5c450f021b3031bc5c1c9 [file] [log] [blame]
Gyorgy Szing30fa9872017-12-05 01:08:47 +00001#-------------------------------------------------------------------------------
Jamie Fox52542dd2018-03-08 13:25:46 +00002# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
Gyorgy Szing30fa9872017-12-05 01:08:47 +00003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8cmake_minimum_required(VERSION 3.7)
9
10#Tell cmake where our modules can be found
11list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake)
12
13#Include common stuff to control cmake.
14include("Common/BuildSys")
15
16#Start an embedded project.
17embedded_project_start(CONFIG "${CMAKE_CURRENT_LIST_DIR}/../ConfigDefault.cmake")
18project(tfm_tests LANGUAGES ASM C)
19embedded_project_fixup()
20
21get_filename_component(TFM_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
22
23#Check incoming configuration options
24if (NOT DEFINED SERVICES_TEST_ENABLED)
25 message(FATAL_ERROR "Incomplete build configuration: SERVICES_TEST_ENABLED is undefined. ")
26endif()
27
28if (NOT DEFINED CORE_TEST)
29 message(FATAL_ERROR "Incomplete build configuration: CORE_TEST is undefined. ")
30endif()
31
32if(CORE_TEST)
33 set (TFM_LVL 3)
34else()
35 set (TFM_LVL 1)
36endif()
37
38#Configure our options as needed.
39if (CORE_TEST_INTERACTIVE OR CORE_TEST_POSITIVE)
40 set(ENABLE_CORE_TESTS True)
41 set(ENABLE_CORE_TESTS_2 True)
42else()
43 set(ENABLE_CORE_TESTS False)
44 set(ENABLE_CORE_TESTS_2 False)
45endif()
46
Gyorgy Szing30fa9872017-12-05 01:08:47 +000047set(ENABLE_SECURE_STORAGE_SERVICE_TESTS TRUE)
Antonio de Angelis7852dff2018-02-07 11:15:54 +000048set(ENABLE_AUDIT_LOGGING_SERVICE_TESTS TRUE)
Gyorgy Szing30fa9872017-12-05 01:08:47 +000049set(ENABLE_INVERT_SERVICE_TESTS TRUE)
50include(${CMAKE_CURRENT_LIST_DIR}/CMakeLists.inc)
51
52#Build the secure library
53add_library(tfm_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_S})
Tamas Bandb69d522018-03-01 10:04:41 +000054
55#Set common compiler and linker flags
56config_setting_shared_compiler_flags(tfm_secure_tests)
57config_setting_shared_linker_flags(tfm_secure_tests)
58
Gyorgy Szing30fa9872017-12-05 01:08:47 +000059embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 TFM_LVL=${TFM_LVL} APPEND)
60
61
62#Build the non-secure library
63set(CMAKE_STATIC_LIBRARY_PREFIX_C "lib")
64add_library(tfm_non_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_NS})
Tamas Bandb69d522018-03-01 10:04:41 +000065
66#Set common compiler and linker flags
67config_setting_shared_compiler_flags(tfm_non_secure_tests)
68config_setting_shared_linker_flags(tfm_non_secure_tests)
69
Gyorgy Szing30fa9872017-12-05 01:08:47 +000070embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 __DOMAIN_NS=1 APPEND)
71#__DOMAIN_NS=1
72
73if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
Tamas Bandb69d522018-03-01 10:04:41 +000074 set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Default install location for tfm_storage." FORCE)
Gyorgy Szing30fa9872017-12-05 01:08:47 +000075endif()
76
77install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/framework/integ_test.h
Antonio de Angelis8ad3d3812018-04-13 16:48:00 +010078 ${CMAKE_CURRENT_SOURCE_DIR}/interface/include/svc_core_test_ns.h
Gyorgy Szing30fa9872017-12-05 01:08:47 +000079 ${CMAKE_CURRENT_SOURCE_DIR}/suites/sst/non_secure/os_wrapper.h
Antonio de Angelis8ad3d3812018-04-13 16:48:00 +010080 ${CMAKE_CURRENT_SOURCE_DIR}/interface/include/sst_test_service_svc.h
Ben Davis6d7256b2018-04-18 14:16:53 +010081 ${CMAKE_CURRENT_SOURCE_DIR}/test_services/tfm_sst_test_service/sst_test_service_svc.h
82 ${CMAKE_CURRENT_SOURCE_DIR}/test_services/tfm_secure_client_service/tfm_secure_client_service_svc.h
Gyorgy Szing30fa9872017-12-05 01:08:47 +000083 DESTINATION tfm/test/inc)
84
85install(TARGETS tfm_non_secure_tests
86 DESTINATION tfm/test/lib
87 PUBLIC_HEADER DESTINATION tfm/test/inc)
88
89
90embedded_project_end(tfm_non_secure_tests)
91embedded_project_end(tfm_secure_tests)