1#
2# Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
3#
4# SPDX-License-Identifier: Apache-2.0
5#
6
7cmake_minimum_required(VERSION 3.20.0)
8
9set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/mbox_ipc_remote-prefix/src/mbox_ipc_remote-build/zephyr)
10
11if("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp")
12  set(BOARD_REMOTE "nrf5340dk_nrf5340_cpunet")
13elseif("${BOARD}" STREQUAL "adp_xc7k_ae350")
14  set(BOARD_REMOTE "adp_xc7k_ae350")
15elseif("${BOARD}" STREQUAL "mimxrt595_evk_cm33")
16  set(BOARD_REMOTE "nrf5340dk_nrf5340_cpunet")
17else()
18  message(FATAL_ERROR "${BOARD} is not supported for this sample")
19endif()
20
21message(STATUS "${BOARD} compile as Main in this sample")
22
23find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
24project(mbox_ipc)
25
26enable_language(C ASM)
27
28target_sources(app PRIVATE src/main.c)
29
30include(ExternalProject)
31
32ExternalProject_Add(
33  mbox_ipc_remote
34  SOURCE_DIR ${APPLICATION_SOURCE_DIR}/remote
35  INSTALL_COMMAND ""      # This particular build system has no install command
36  CMAKE_CACHE_ARGS -DBOARD:STRING=${BOARD_REMOTE}
37  BUILD_BYPRODUCTS "${REMOTE_ZEPHYR_DIR}/${KERNEL_BIN_NAME}"
38  # NB: Do we need to pass on more CMake variables?
39  BUILD_ALWAYS True
40)
41