1#
2# Copyright (c) 2020 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(test3_simple)
11include(../../cmake/test_template.cmake)
12
13target_sources(app PRIVATE
14  ../../fuzz/fuzz_pet.c)
15
16set(py_command_pet
17  zcbor
18  code
19  -c ${CMAKE_CURRENT_LIST_DIR}/../../cases/pet.cddl
20  --output-cmake ${PROJECT_BINARY_DIR}/pet.cmake
21  -t Pet
22  -d
23  ${bit_arg}
24  --short-names
25  --file-header "Copyright (c) 2020 Nordic Semiconductor ASA\n\nSPDX-License-Identifier: Apache-2.0"
26  )
27set(py_command_serial_recovery
28  zcbor
29  code
30  -c ${CMAKE_CURRENT_LIST_DIR}/../../cases/serial_recovery.cddl
31  --oh ${PROJECT_BINARY_DIR}/include/serial/serial_recovery_decode.h
32  --oht ${PROJECT_BINARY_DIR}/include/serial/serial_recovery_decode_types.h
33  --oc ${PROJECT_BINARY_DIR}/src/serial/serial_recovery_decode.c
34  -t Upload
35  -d
36  ${bit_arg}
37  --short-names
38
39  # Testing the --include-prefix option
40  --include-prefix serial
41  )
42execute_process(
43  COMMAND ${py_command_pet}
44  COMMAND_ERROR_IS_FATAL ANY
45  )
46execute_process(
47  COMMAND ${py_command_serial_recovery}
48  COMMAND_ERROR_IS_FATAL ANY
49  )
50
51include(${PROJECT_BINARY_DIR}/pet.cmake)
52
53zephyr_include_directories(${PROJECT_BINARY_DIR}/include
54  ${CMAKE_CURRENT_LIST_DIR}/../../../include)
55zephyr_sources(${PROJECT_BINARY_DIR}/src/serial/serial_recovery_decode.c
56  ${CMAKE_CURRENT_LIST_DIR}/../../../src/zcbor_decode.c
57  ${CMAKE_CURRENT_LIST_DIR}/../../../src/zcbor_common.c)
58
59target_link_libraries(pet PRIVATE zephyr_interface)
60target_link_libraries(app PRIVATE pet)
61