Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 1 | # |
Artur Tynecki | 58699c8 | 2023-05-16 04:56:13 +0200 | [diff] [blame] | 2 | # Copyright (c) 2022-2023 Project CHIP Authors |
Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 3 | # |
| 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 | |
| 17 | cmake_minimum_required(VERSION 3.21) |
| 18 | |
| 19 | get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../.. REALPATH) |
| 20 | get_filename_component(OPEN_IOT_SDK_CONFIG ${CHIP_ROOT}/config/openiotsdk REALPATH) |
| 21 | get_filename_component(OPEN_IOT_SDK_EXAMPLE_COMMON ${CHIP_ROOT}/examples/platform/openiotsdk REALPATH) |
| 22 | get_filename_component(SHELL_COMMON ${CHIP_ROOT}/examples/shell/shell_common REALPATH) |
| 23 | |
| 24 | list(APPEND CMAKE_MODULE_PATH ${OPEN_IOT_SDK_CONFIG}/cmake) |
| 25 | |
Artur Tynecki | 4f24db4 | 2023-01-29 01:50:10 +0100 | [diff] [blame] | 26 | set(APP_TARGET chip-openiotsdk-shell-example_ns) |
| 27 | |
Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 28 | # Toolchain files need to exist before first call to project |
| 29 | include(toolchain) |
| 30 | |
| 31 | project(${APP_TARGET} LANGUAGES C CXX ASM) |
| 32 | |
| 33 | include(sdk) |
| 34 | |
Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 35 | add_executable(${APP_TARGET}) |
| 36 | |
Artur Tynecki | fb92873 | 2023-06-27 17:08:34 +0200 | [diff] [blame] | 37 | # Application CHIP build configuration |
Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 38 | set(CONFIG_CHIP_LIB_SHELL YES) |
| 39 | include(chip) |
| 40 | |
| 41 | add_subdirectory(${OPEN_IOT_SDK_EXAMPLE_COMMON}/app ./app_build) |
| 42 | |
Artur Tynecki | 58699c8 | 2023-05-16 04:56:13 +0200 | [diff] [blame] | 43 | target_compile_definitions(openiotsdk-startup |
| 44 | PRIVATE |
| 45 | IOT_SDK_APP_SERIAL_BAUDRATE=9600 |
| 46 | ) |
| 47 | |
| 48 | target_compile_definitions(openiotsdk-startup |
| 49 | PRIVATE |
| 50 | IOT_SDK_APP_MAIN_STACK_SIZE=8192 |
| 51 | ) |
| 52 | |
Artur Tynecki | fb92873 | 2023-06-27 17:08:34 +0200 | [diff] [blame] | 53 | target_include_directories(${APP_TARGET} |
Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 54 | PRIVATE |
| 55 | main/include |
| 56 | ${SHELL_COMMON}/include |
| 57 | ) |
| 58 | |
Artur Tynecki | fb92873 | 2023-06-27 17:08:34 +0200 | [diff] [blame] | 59 | target_sources(${APP_TARGET} |
Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 60 | PRIVATE |
Artur Tynecki | 4f24db4 | 2023-01-29 01:50:10 +0100 | [diff] [blame] | 61 | main/main_ns.cpp |
Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 62 | ${SHELL_COMMON}/cmd_misc.cpp |
| 63 | ${SHELL_COMMON}/globals.cpp |
| 64 | ) |
| 65 | |
| 66 | target_link_libraries(${APP_TARGET} |
Artur Tynecki | 58699c8 | 2023-05-16 04:56:13 +0200 | [diff] [blame] | 67 | openiotsdk-startup |
Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 68 | openiotsdk-app |
| 69 | ) |
| 70 | |
| 71 | include(linker) |
| 72 | set_target_link(${APP_TARGET}) |
Artur Tynecki | 4f24db4 | 2023-01-29 01:50:10 +0100 | [diff] [blame] | 73 | |
| 74 | sdk_post_build(${APP_TARGET}) |