blob: 7961e7199388f2bf3ac7e0accb45c07106ea7dd0 [file] [log] [blame]
Artur Tynecki0efd3182022-12-05 20:18:32 +01001#
Artur Tynecki58699c82023-05-16 04:56:13 +02002# Copyright (c) 2022-2023 Project CHIP Authors
Artur Tynecki0efd3182022-12-05 20:18:32 +01003#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17cmake_minimum_required(VERSION 3.21)
18
19get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../.. REALPATH)
20get_filename_component(OPEN_IOT_SDK_CONFIG ${CHIP_ROOT}/config/openiotsdk REALPATH)
21get_filename_component(OPEN_IOT_SDK_EXAMPLE_COMMON ${CHIP_ROOT}/examples/platform/openiotsdk REALPATH)
22get_filename_component(SHELL_COMMON ${CHIP_ROOT}/examples/shell/shell_common REALPATH)
23
24list(APPEND CMAKE_MODULE_PATH ${OPEN_IOT_SDK_CONFIG}/cmake)
25
Artur Tynecki4f24db42023-01-29 01:50:10 +010026set(APP_TARGET chip-openiotsdk-shell-example_ns)
27
Artur Tynecki0efd3182022-12-05 20:18:32 +010028# Toolchain files need to exist before first call to project
29include(toolchain)
30
31project(${APP_TARGET} LANGUAGES C CXX ASM)
32
33include(sdk)
34
Artur Tynecki0efd3182022-12-05 20:18:32 +010035add_executable(${APP_TARGET})
36
Artur Tyneckifb928732023-06-27 17:08:34 +020037# Application CHIP build configuration
Artur Tynecki0efd3182022-12-05 20:18:32 +010038set(CONFIG_CHIP_LIB_SHELL YES)
39include(chip)
40
41add_subdirectory(${OPEN_IOT_SDK_EXAMPLE_COMMON}/app ./app_build)
42
Artur Tynecki58699c82023-05-16 04:56:13 +020043target_compile_definitions(openiotsdk-startup
44 PRIVATE
45 IOT_SDK_APP_SERIAL_BAUDRATE=9600
46)
47
48target_compile_definitions(openiotsdk-startup
49 PRIVATE
50 IOT_SDK_APP_MAIN_STACK_SIZE=8192
51)
52
Artur Tyneckifb928732023-06-27 17:08:34 +020053target_include_directories(${APP_TARGET}
Artur Tynecki0efd3182022-12-05 20:18:32 +010054 PRIVATE
55 main/include
56 ${SHELL_COMMON}/include
57)
58
Artur Tyneckifb928732023-06-27 17:08:34 +020059target_sources(${APP_TARGET}
Artur Tynecki0efd3182022-12-05 20:18:32 +010060 PRIVATE
Artur Tynecki4f24db42023-01-29 01:50:10 +010061 main/main_ns.cpp
Artur Tynecki0efd3182022-12-05 20:18:32 +010062 ${SHELL_COMMON}/cmd_misc.cpp
63 ${SHELL_COMMON}/globals.cpp
64)
65
66target_link_libraries(${APP_TARGET}
Artur Tynecki58699c82023-05-16 04:56:13 +020067 openiotsdk-startup
Artur Tynecki0efd3182022-12-05 20:18:32 +010068 openiotsdk-app
69)
70
71include(linker)
72set_target_link(${APP_TARGET})
Artur Tynecki4f24db42023-01-29 01:50:10 +010073
74sdk_post_build(${APP_TARGET})