You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 lines
3.5 KiB

# Copyright 2021 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.
import("//build_overrides/pigweed.gni")
import("$dir_pw_build/python.gni")
import("$dir_pw_build/target_types.gni")
import("$dir_pw_docgen/docs.gni")
import("$dir_pw_unit_test/test.gni")
config("default_config") {
include_dirs = [ "public" ]
}
group("pw_hdlc") {
public_deps = [
":decoder",
":encoder",
]
}
pw_source_set("common") {
public_configs = [ ":default_config" ]
public = [ "public/pw_hdlc/internal/protocol.h" ]
public_deps = [ dir_pw_varint ]
visibility = [ ":*" ]
}
pw_source_set("decoder") {
public_configs = [ ":default_config" ]
public = [ "public/pw_hdlc/decoder.h" ]
sources = [ "decoder.cc" ]
public_deps = [
":common",
dir_pw_bytes,
dir_pw_checksum,
dir_pw_result,
dir_pw_status,
]
deps = [ dir_pw_log ]
friend = [ ":*" ]
}
pw_source_set("encoder") {
public_configs = [ ":default_config" ]
public = [ "public/pw_hdlc/encoder.h" ]
sources = [
"encoder.cc",
"public/pw_hdlc/internal/encoder.h",
]
public_deps = [
":common",
dir_pw_bytes,
dir_pw_checksum,
dir_pw_status,
dir_pw_stream,
]
friend = [ ":*" ]
}
pw_source_set("rpc_channel_output") {
public_configs = [ ":default_config" ]
public = [ "public/pw_hdlc/rpc_channel.h" ]
public_deps = [
":pw_hdlc",
"$dir_pw_rpc:server",
]
}
pw_source_set("pw_rpc") {
public_configs = [ ":default_config" ]
public = [ "public/pw_hdlc/rpc_packets.h" ]
sources = [ "rpc_packets.cc" ]
public_deps = [
":pw_hdlc",
"$dir_pw_rpc:server",
dir_pw_sys_io,
]
}
pw_source_set("packet_parser") {
public_configs = [ ":default_config" ]
public = [ "public/pw_hdlc/wire_packet_parser.h" ]
sources = [ "wire_packet_parser.cc" ]
public_deps = [
":pw_hdlc",
"$dir_pw_router:packet_parser",
]
deps = [
dir_pw_bytes,
dir_pw_checksum,
]
}
pw_test_group("tests") {
tests = [
":encoder_test",
":decoder_test",
":rpc_channel_test",
":wire_packet_parser_test",
]
group_deps = [
"$dir_pw_preprocessor:tests",
"$dir_pw_status:tests",
"$dir_pw_stream:tests",
]
}
pw_test("encoder_test") {
deps = [ ":pw_hdlc" ]
sources = [ "encoder_test.cc" ]
}
pw_python_action("generate_decoder_test") {
outputs = [ "$target_gen_dir/generated_decoder_test.cc" ]
script = "py/decode_test.py"
args = [ "--generate-cc-test" ] + rebase_path(outputs)
python_deps = [
"$dir_pw_build/py",
"py",
]
}
pw_test("decoder_test") {
deps = [
":generate_decoder_test",
":pw_hdlc",
]
sources = [ "decoder_test.cc" ] + get_target_outputs(":generate_decoder_test")
}
pw_test("rpc_channel_test") {
deps = [
":pw_hdlc",
":rpc_channel_output",
]
sources = [ "rpc_channel_test.cc" ]
}
pw_test("wire_packet_parser_test") {
deps = [
":packet_parser",
dir_pw_bytes,
]
sources = [ "wire_packet_parser_test.cc" ]
}
pw_doc_group("docs") {
sources = [
"docs.rst",
"rpc_example/docs.rst",
]
inputs = [
"py/pw_hdlc/decode.py",
"py/pw_hdlc/encode.py",
]
}