forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
76 lines (58 loc) · 2.61 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# 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)
get_filename_component(MBED_COMMON ${CHIP_ROOT}/examples/platform/mbed REALPATH)
get_filename_component(SHELL_COMMON ${CHIP_ROOT}/examples/shell/shell_common REALPATH)
get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH)
get_filename_component(NLIO_ROOT ${CHIP_ROOT}/third_party/nlio/repo/include 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(MCUBOOT_PATH ${MBED_MCU_BOOT_PATH} CACHE INTERNAL "")
set(APP_PATH ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
set(APP_TYPE ${MBED_APP_TYPE} CACHE INTERNAL "")
set(BOOT_ENABLED FALSE)
set(APP_TARGET chip-mbed-shell-example)
if(APP_TYPE STREQUAL "boot" OR APP_TYPE STREQUAL "upgrade")
set(BOOT_ENABLED TRUE)
endif()
include(${MBED_PATH}/tools/cmake/app.cmake)
if(MBED_TARGET STREQUAL "CY8CPROTO_062_4343W" AND BOOT_ENABLED)
list(REMOVE_ITEM MBED_TARGET_LABELS CM0P_SLEEP)
list(REMOVE_ITEM MBED_TARGET_DEFINITIONS COMPONENT_CM0P_SLEEP=1)
endif()
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
main/include
${MBED_COMMON}/util/include
${SHELL_COMMON}/include
${GEN_DIR}/app-common
${NLIO_ROOT}
)
target_sources(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/main/main.cpp
${SHELL_COMMON}/cmd_misc.cpp
${SHELL_COMMON}/cmd_otcli.cpp
${SHELL_COMMON}/cmd_server.cpp
${SHELL_COMMON}/globals.cpp
${MBED_COMMON}/util/DFUManager.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()
mbed_set_post_build(${APP_TARGET})
option(VERBOSE_BUILD "Have a verbose build process")
if(VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()