1# Copyright (c) 2024 Nordic Semiconductor
2#
3# SPDX-License-Identifier: Apache-2.0
4
5# This module is responsible for including images into sysbuild and to call
6# pre and post hooks.
7
8get_filename_component(APP_DIR  ${APP_DIR} ABSOLUTE)
9get_filename_component(app_name ${APP_DIR} NAME)
10set(DEFAULT_IMAGE "${app_name}")
11
12# This is where all Zephyr applications are added to the multi-image build.
13sysbuild_add_subdirectory(${sysbuild_toplevel_SOURCE_DIR}/images sysbuild/images)
14
15get_property(IMAGES GLOBAL PROPERTY sysbuild_images)
16sysbuild_module_call(PRE_CMAKE MODULES ${SYSBUILD_MODULE_NAMES} IMAGES ${IMAGES})
17sysbuild_images_order(IMAGES_CONFIGURATION_ORDER CONFIGURE IMAGES ${IMAGES})
18foreach(image ${IMAGES_CONFIGURATION_ORDER})
19  sysbuild_module_call(PRE_IMAGE_CMAKE MODULES ${SYSBUILD_MODULE_NAMES} IMAGES ${IMAGES} IMAGE ${image})
20  ExternalZephyrProject_Cmake(APPLICATION ${image})
21  sysbuild_module_call(POST_IMAGE_CMAKE MODULES ${SYSBUILD_MODULE_NAMES} IMAGES ${IMAGES} IMAGE ${image})
22endforeach()
23sysbuild_module_call(POST_CMAKE MODULES ${SYSBUILD_MODULE_NAMES} IMAGES ${IMAGES})
24
25sysbuild_module_call(PRE_DOMAINS MODULES ${SYSBUILD_MODULE_NAMES} IMAGES ${IMAGES})
26include(${sysbuild_toplevel_SOURCE_DIR}/cmake/domains.cmake)
27sysbuild_module_call(POST_DOMAINS MODULES ${SYSBUILD_MODULE_NAMES} IMAGES ${IMAGES})
28