1cmake_minimum_required(VERSION 3.20.0)
2# Copyright (c) 2018 Nordic Semiconductor ASA
3# Copyright (c) 2019 Linaro Limited
4#
5# SPDX-License-Identifier: Apache-2.0
6#
7
8set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/openamp_remote-prefix/src/openamp_remote-build/zephyr)
9
10if("${BOARD}" STREQUAL "lpcxpresso54114_m4")
11  set(BOARD_REMOTE "lpcxpresso54114_m0")
12elseif("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")
13  set(BOARD_REMOTE "lpcxpresso55s69_cpu1")
14elseif("${BOARD}" STREQUAL "mps2_an521")
15  set(QEMU_EXTRA_FLAGS "-device;loader,file=${REMOTE_ZEPHYR_DIR}/zephyr.elf")
16  set(BOARD_REMOTE "mps2_an521_remote")
17elseif("${BOARD}" STREQUAL "v2m_musca_b1")
18  set(BOARD_REMOTE "v2m_musca_b1_ns")
19else()
20  message(FATAL_ERROR "${BOARD} was not supported for this sample")
21endif()
22
23message(INFO " ${BOARD} compile as Master in this sample")
24
25find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
26project(openamp)
27
28enable_language(C ASM)
29
30target_sources(app PRIVATE src/main.c)
31
32include(ExternalProject)
33
34ExternalProject_Add(
35  openamp_remote
36  SOURCE_DIR ${APPLICATION_SOURCE_DIR}/remote
37  INSTALL_COMMAND ""      # This particular build system has no install command
38  CMAKE_CACHE_ARGS -DBOARD:STRING=${BOARD_REMOTE}
39  CMAKE_CACHE_ARGS -DDTC_OVERLAY_FILE:STRING=${DTC_OVERLAY_FILE}
40  BUILD_BYPRODUCTS "${REMOTE_ZEPHYR_DIR}/${KERNEL_BIN_NAME}"
41  # NB: Do we need to pass on more CMake variables?
42  BUILD_ALWAYS True
43)
44
45target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
46