Artur Tynecki | a910166 | 2022-02-08 10:32:32 +0100 | [diff] [blame] | 1 | # Copyright (c) 2021 ARM Limited. All rights reserved. |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| 4 | # Mbed-MCUboot Port |
| 5 | |
| 6 | cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) |
| 7 | |
| 8 | get_filename_component(BOOT_UTIL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../bootutil REALPATH) |
| 9 | |
| 10 | set(LIB_TARGET mbed-mcuboot) |
| 11 | set(LIB_BOOTUTIL bootutil) |
| 12 | |
| 13 | add_library(${LIB_TARGET} STATIC) |
| 14 | |
| 15 | target_include_directories(${LIB_TARGET} |
| 16 | PUBLIC |
| 17 | include |
| 18 | ${BOOT_UTIL_DIR}/include |
| 19 | ${BOOT_UTIL_DIR}/src |
| 20 | ) |
| 21 | |
| 22 | target_sources(${LIB_TARGET} |
| 23 | PRIVATE |
| 24 | mcuboot_main.cpp |
| 25 | app_enc_keys.c |
| 26 | src/flash_map_backend.cpp |
| 27 | src/secondary_bd.cpp |
| 28 | ) |
| 29 | |
| 30 | target_link_libraries(${LIB_TARGET} |
| 31 | PUBLIC |
| 32 | bootutil # Cross-dependency |
| 33 | mbed-mbedtls |
| 34 | mbed-storage-flashiap |
| 35 | mbed-storage-blockdevice |
| 36 | ) |
| 37 | |
| 38 | if("_RTE_" IN_LIST MBED_CONFIG_DEFINITIONS) |
| 39 | target_link_libraries(${LIB_TARGET} |
| 40 | PUBLIC |
| 41 | mbed-os |
| 42 | ) |
| 43 | else() |
| 44 | target_link_libraries(${LIB_TARGET} |
| 45 | PUBLIC |
| 46 | mbed-baremetal |
| 47 | ) |
| 48 | endif() |
| 49 | |
| 50 | # The cross-dependency requires that bootutil have access to the mbed port's |
| 51 | # include directory and is linked with the appropriate mbed-specific libraries. |
| 52 | target_include_directories(${LIB_BOOTUTIL} |
| 53 | PUBLIC |
| 54 | include |
| 55 | ) |
| 56 | |
| 57 | target_link_libraries(${LIB_BOOTUTIL} |
| 58 | PUBLIC |
| 59 | mbed-mcuboot |
| 60 | mbed-mbedtls |
| 61 | ) |