1# Copyright (c) 2021 Nordic Semiconductor
2#
3# SPDX-License-Identifier: Apache-2.0
4
5sysbuild_images_order(IMAGES_FLASHING_ORDER FLASH IMAGES ${IMAGES})
6
7set(domains_yaml "default: ${DEFAULT_IMAGE}")
8set(domains_yaml "${domains_yaml}\nbuild_dir: ${CMAKE_BINARY_DIR}")
9set(domains_yaml "${domains_yaml}\ndomains:")
10foreach(image ${IMAGES})
11  set(domains_yaml "${domains_yaml}\n  - name: ${image}")
12  set(domains_yaml "${domains_yaml}\n    build_dir: $<TARGET_PROPERTY:${image},_EP_BINARY_DIR>")
13endforeach()
14set(domains_yaml "${domains_yaml}\nflash_order:")
15foreach(image ${IMAGES_FLASHING_ORDER})
16  set(flash_cond "$<NOT:$<BOOL:$<TARGET_PROPERTY:${image},BUILD_ONLY>>>")
17  set(domains_yaml "${domains_yaml}$<${flash_cond}:\n  - ${image}>")
18endforeach()
19file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/domains.yaml CONTENT "${domains_yaml}")
20