1#-------------------------------------------------------------------------------
2# Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8if (DEFINED ENV{TS_EDK2_PLATFORMS_PATH})
9	# Use externally provided source tree
10	set(EDK2_PLATFORMS_PATH $ENV{TS_EDK2_PLATFORMS_PATH} CACHE PATH "edk2-platforms location" FORCE)
11else()
12	# Otherwise clone the morello edk2-platforms repo
13	set(EDK2_PLATFORMS_URL "https://git.morello-project.org/morello/edk2-platforms.git" CACHE STRING "edk2-platforms repository URL")
14	set(EDK2_PLATFORMS_REFSPEC "morello/master" CACHE STRING "edk2-platforms git refspec")
15	set(EDK2_PLATFORMS_PATH "${CMAKE_CURRENT_BINARY_DIR}/_deps/edk2-platforms-src" CACHE PATH "Location of edk2-platforms source")
16
17	set(GIT_OPTIONS
18		GIT_REPOSITORY ${EDK2_PLATFORMS_URL}
19		GIT_TAG ${EDK2_PLATFORMS_REFSPEC}
20	)
21
22	include(${TS_ROOT}/tools/cmake/common/LazyFetch.cmake REQUIRED)
23	LazyFetch_MakeAvailable(
24		DEP_NAME edk2-platforms
25		FETCH_OPTIONS "${GIT_OPTIONS}"
26		SOURCE_DIR ${EDK2_PLATFORMS_PATH}
27	)
28endif()
29