blob: 184248fc0babee38bf24ef5dafa6415593862cee [file] [log] [blame]
# Copyright 2022 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
cmake_minimum_required(VERSION 3.20)
set(BOARD native_posix)
set(NO_BUILD_TYPE_WARNING ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
# Use this copy of Pigweed
get_filename_component(PW_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../pigweed" ABSOLUTE)
set(ENV{PW_ROOT} ${PW_ROOT})
set(pw_third_party_nanopb_ADD_SUBDIRECTORY ON CACHE BOOL "" FORCE)
list(APPEND ZEPHYR_EXTRA_MODULES
${PW_ROOT}
)
find_package(Zephyr REQUIRED PATHS $ENV{ZEPHYR_BASE})
project(rpc_demo)
add_definitions(-DVERSION=5)
add_definitions(-DCONFIG_RPC_BUFFER_SIZE=1024)
add_definitions(-DPW_LOG_LEVEL=PW_LOG_LEVEL_INFO)
add_definitions(-DPW_LOG_SHOW_MODULE=1)
# Define the proto library
include($ENV{PW_ROOT}/pw_protobuf_compiler/proto.cmake)
pw_proto_library(
rpc_demo.protos
SOURCES proto/demo.proto
)
file(GLOB app_sources src/*.cc)
target_sources(app
PRIVATE
${app_sources}
)
zephyr_include_directories(include)
zephyr_link_libraries(
rpc_demo.protos.nanopb
rpc_demo.protos.nanopb_rpc
)
target_link_libraries(app
PRIVATE
rpc_demo.protos.nanopb
rpc_demo.protos.nanopb_rpc
)