1#
2# Copyright (c) 2021 Nordic Semiconductor ASA
3#
4# SPDX-License-Identifier: Apache-2.0
5#
6
7cmake_minimum_required(VERSION 3.13.1)
8
9find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10project(test9_manifest14)
11include(../../cmake/test_template.cmake)
12
13if (NOT MANIFEST)
14  set(MANIFEST manifest14)
15endif()
16
17set(py_command
18  ${PYTHON_EXECUTABLE}
19  ${CMAKE_CURRENT_LIST_DIR}/../../../zcbor/zcbor.py
20  code
21  -c ${CMAKE_CURRENT_LIST_DIR}/../../cases/${MANIFEST}.cddl
22  -c ${CMAKE_CURRENT_LIST_DIR}/../../cases/cose.cddl
23  --default-max-qty 4
24  --output-cmake ${PROJECT_BINARY_DIR}/${MANIFEST}.cmake
25  -t
26  SUIT_Envelope_Tagged
27  SUIT_Envelope
28  SUIT_Manifest
29  SUIT_Command_Sequence
30  SUIT_Common_Sequence
31  -d
32  ${bit_arg}
33  )
34
35execute_process(
36  COMMAND
37  ${py_command}
38  COMMAND_ERROR_IS_FATAL ANY
39)
40
41set(py_command_convert
42  ${PYTHON_EXECUTABLE}
43  ${CMAKE_CURRENT_LIST_DIR}/../../../zcbor/zcbor.py
44  convert
45  -c ${CMAKE_CURRENT_LIST_DIR}/../../cases/${MANIFEST}.cddl
46  -c ${CMAKE_CURRENT_LIST_DIR}/../../cases/cose.cddl
47  --default-max-qty 4
48  -t SUIT_Envelope_Tagged
49  -i ${CMAKE_CURRENT_LIST_DIR}/../../cases/manifest14_example0.cborhex
50  -o ${PROJECT_BINARY_DIR}/include/example0.h # The same dir as the generated header files from the above command.
51  --c-code-var-name example0
52  --c-code-columns 8
53)
54
55execute_process(
56  COMMAND
57  ${py_command_convert}
58  COMMAND_ERROR_IS_FATAL ANY
59)
60
61include(${PROJECT_BINARY_DIR}/${MANIFEST}.cmake)
62
63target_link_libraries(${MANIFEST} PRIVATE zephyr_interface)
64target_link_libraries(app PRIVATE ${MANIFEST})
65
66if (${MANIFEST} STREQUAL "manifest16")
67  target_compile_definitions(app PRIVATE MANIFEST16)
68endif()
69