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(NRFCONNECT_COMMON ${CHIP_ROOT}/examples/platform/nrfconnect REALPATH)
20 set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo")
22 include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake)
24 # Load NCS/Zephyr build system
25 set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf)
26 if(${BOARD} STREQUAL "nrf52840dongle_nrf52840")
27 list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-usb_support.conf)
29 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module)
30 find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
32 project(chip-nrf52840-pigweed-example)
34 target_compile_options(app PRIVATE -Werror)
36 include(${PIGWEED_ROOT}/pw_build/pigweed.cmake)
37 include(${PIGWEED_ROOT}/pw_protobuf_compiler/proto.cmake)
39 pw_set_backend(pw_log pw_log_basic)
40 pw_set_backend(pw_assert pw_assert_log)
41 pw_set_backend(pw_sys_io pw_sys_io.nrfconnect)
42 set(dir_pw_third_party_nanopb PRESENT CACHE STRING ${CHIP_ROOT}/third_party/nanopb/repo FORCE)
44 add_subdirectory(third_party/connectedhomeip/examples/platform/nrfconnect/pw_sys_io)
45 add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo)
46 add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo)
48 target_include_directories(app PRIVATE main/include
49 ${ZEPHYR_BASE}/subsys // required to get access to `log_output_std.h`
50 ${NRFCONNECT_COMMON}/util/include
51 ${CHIP_ROOT}/src/lib/support
52 ${PIGWEED_ROOT}/pw_sys_io/public
53 ${PIGWEED_ROOT}/pw_span/public_overrides
54 ${PIGWEED_ROOT}/pw_span/public
55 ${PIGWEED_ROOT}/pw_polyfill/public
56 ${PIGWEED_ROOT}/pw_polyfill/standard_library_public
57 ${PIGWEED_ROOT}/pw_polyfill/public_overrides
58 ${PIGWEED_ROOT}/pw_rpc/public
59 ${PIGWEED_ROOT}/pw_status/public
60 ${PIGWEED_ROOT}/pw_preprocessor/public
62 ../../common/pigweed/nrfconnect
63 ${NRFCONNECT_COMMON}/pw_sys_io/public)
65 target_sources(app PRIVATE main/main.cpp
66 ../../common/pigweed/RpcService.cpp
67 ../../common/pigweed/nrfconnect/PigweedLoggerMutex.cpp
68 ${NRFCONNECT_COMMON}/util/LEDWidget.cpp
69 ${NRFCONNECT_COMMON}/util/PigweedLogger.cpp
72 target_link_libraries(app PUBLIC
76 pw_rpc.nanopb.echo_service