1# SPDX-License-Identifier: Apache-2.0
2
3cmake_minimum_required(VERSION 3.20.0)
4find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5
6set(output_file ${PROJECT_BINARY_DIR}/check_init_priorities_output.txt)
7
8add_custom_command(
9	COMMENT "Running check_init_priorities.py"
10	OUTPUT ${output_file}
11	DEPENDS
12	  ${logical_target_for_zephyr_elf}
13	  $<$<TARGET_EXISTS:native_runner_executable>:native_runner_executable>
14	COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/check_init_priorities.py
15	  --elf-file=$<IF:$<TARGET_EXISTS:native_runner_executable>,${BYPRODUCT_KERNEL_EXE_NAME},${BYPRODUCT_KERNEL_ELF_NAME}>
16	  --verbose
17	  --output ${output_file}
18	  --always-succeed
19	COMMAND ${PYTHON_EXECUTABLE} ${APPLICATION_SOURCE_DIR}/validate_check_init_priorities_output.py
20	  ${output_file}
21)
22
23add_custom_target(check_init_priorities_output ALL DEPENDS ${output_file})
24
25project(check_init_priorities)
26
27target_sources(app PRIVATE src/main.c)
28