blob: e1fd925374ebb8e38ececcda908a1ee037b991b6 [file] [log] [blame]
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.19.0)
get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../.. REALPATH)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.in
${CMAKE_CURRENT_BINARY_DIR}/chip_build/config
@ONLY
)
set(MBED_PATH ${MBED_OS_PATH} CACHE INTERNAL "")
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
set(APP_TARGET chip-mbed-unit-tests)
include(${MBED_PATH}/tools/cmake/app.cmake)
project(${APP_TARGET})
add_subdirectory(${MBED_PATH} ./mbed_build)
add_subdirectory(${MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build)
add_executable(${APP_TARGET})
add_subdirectory(${CHIP_ROOT}/config/mbed ./chip_build)
mbed_configure_app_target(${APP_TARGET})
target_include_directories(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/main/include/
)
target_sources(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/main/main.cpp
)
target_link_libraries(${APP_TARGET} mbed-os-posix-socket mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-emac chip)
if(MBED_TARGET STREQUAL "CY8CPROTO_062_4343W")
target_link_libraries(${APP_TARGET} mbed-cy-psoc6-common-network)
endif()
# Link the *whole-archives* to keep the static test objects.
target_link_options(${APP_TARGET} PUBLIC -Wl,--whole-archive -lCHIP_tests -Wl,--no-whole-archive)
mbed_set_post_build(${APP_TARGET})
option(VERBOSE_BUILD "Have a verbose build process")
if(VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()