blob: 593ff1d69ce976caab0fe014be608f171aef07cf [file] [log] [blame]
Raef Coles19715382020-07-10 09:50:17 +01001#-------------------------------------------------------------------------------
David Hu1a2d4832022-01-18 14:42:04 +08002# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
Raef Coles19715382020-07-10 09:50:17 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
Raef Coles19715382020-07-10 09:50:17 +01008# Set to not download submodules if that option is available
9if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
10 cmake_policy(SET CMP0097 NEW)
11endif()
12
David Hu195cb5a2022-05-10 22:03:26 +080013# If NS app, secure regression test or non-secure regression test is enabled,
14# fetch tf-m-tests repo.
15# The conditiions are actually overlapped but it can make the logic more clear.
16# Besides, the dependencies between NS app and regression tests will be
17# optimized later.
18if (NS OR TFM_S_REG_TEST OR TFM_NS_REG_TEST OR TEST_BL2 OR TEST_BL1_1 OR TEST_BL1_2)
19 # Set tf-m-tests repo config
20 include(${CMAKE_SOURCE_DIR}/lib/ext/tf-m-tests/repo_config_default.cmake)
David Hu3d2121f2021-08-23 18:00:26 +080021
David Hu195cb5a2022-05-10 22:03:26 +080022 include(FetchContent)
23 set(FETCHCONTENT_QUIET FALSE)
David Hu3d2121f2021-08-23 18:00:26 +080024
David Hu195cb5a2022-05-10 22:03:26 +080025 set(FETCHCONTENT_BASE_DIR ${CMAKE_BINARY_DIR}/lib/ext CACHE STRING "" FORCE)
Raef Coles19715382020-07-10 09:50:17 +010026
David Hu195cb5a2022-05-10 22:03:26 +080027 if ("${TFM_TEST_REPO_PATH}" STREQUAL "DOWNLOAD")
28 FetchContent_Declare(tfm_test_repo
29 GIT_REPOSITORY https://git.trustedfirmware.org/TF-M/tf-m-tests.git
30 GIT_TAG ${TFM_TEST_REPO_VERSION}
31 GIT_PROGRESS TRUE
32 )
33
34 FetchContent_GetProperties(tfm_test_repo)
35 if(NOT tfm_test_repo_POPULATED)
36 FetchContent_Populate(tfm_test_repo)
37 set(TFM_TEST_REPO_PATH ${tfm_test_repo_SOURCE_DIR} CACHE PATH "Path to TFM-TEST repo (or DOWNLOAD to fetch automatically" FORCE)
38 endif()
Raef Coles19715382020-07-10 09:50:17 +010039 endif()
Raef Coles19715382020-07-10 09:50:17 +010040
David Hu195cb5a2022-05-10 22:03:26 +080041 if ("${CMSIS_5_PATH}" STREQUAL DOWNLOAD)
42 set(CMSIS_5_PATH ${TFM_TEST_REPO_PATH}/CMSIS CACHE PATH "Path to CMSIS_5 (or DOWNLOAD to fetch automatically" FORCE)
43 endif()
Raef Coles19715382020-07-10 09:50:17 +010044
David Hu195cb5a2022-05-10 22:03:26 +080045 if (NOT TFM_TEST_PATH)
46 set(TFM_TEST_PATH ${TFM_TEST_REPO_PATH}/test CACHE PATH "Path to TFM tests" FORCE)
47 endif()
48
49 # Load TF-M regression test suites setting
50 if (TFM_NS_REG_TEST OR TFM_S_REG_TEST)
51 include(${TFM_TEST_PATH}/config/set_config.cmake)
52 endif()
Raef Coles19715382020-07-10 09:50:17 +010053endif()