2 # Copyright (c) 2020 Project CHIP Authors
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 cmake_minimum_required(VERSION 3.13.1)
18 get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH)
19 get_filename_component(APP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/.. REALPATH)
21 include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake)
23 # Load NCS/Zephyr build system
24 set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf)
25 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module)
26 find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
28 project(chip-nrfconnect-shell-example)
30 target_compile_options(app PRIVATE -Werror)
32 target_include_directories(app PRIVATE
33 ${CMAKE_CURRENT_SOURCE_DIR}
34 ${APP_ROOT}/shell_common/include)
36 target_sources(app PRIVATE
37 ${APP_ROOT}/shell_common/cmd_base64.cpp
38 ${APP_ROOT}/shell_common/cmd_device.cpp
39 ${APP_ROOT}/shell_common/cmd_misc.cpp
40 ${APP_ROOT}/shell_common/cmd_otcli.cpp
41 ${APP_ROOT}/shell_common/cmd_btp.cpp
42 ${APP_ROOT}/standalone/main.cpp
45 # 1) The example needs be linked with openthread command line interpreter (required by cmd_otcli.cpp)
46 # 2) Zephyr shell must be disabled not to interfere with the example
47 # We can't achieve 1 and 2 with Kconfig since CONFIG_OPENTHREAD_SHELL implies CONFIG_SHELL.
48 # Hence the workaround below.
49 if(CONFIG_OPENTHREAD_FTD)
50 target_link_libraries(app INTERFACE openthread-cli-ftd)
51 elseif(CONFIG_OPENTHREAD_MTD)
52 target_link_libraries(app INTERFACE openthread-cli-mtd)