1# Copyright 2021 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/target_types.gni") 18import("$dir_pw_docgen/docs.gni") 19import("$dir_pw_protobuf_compiler/proto.gni") 20import("$dir_pw_unit_test/test.gni") 21 22config("public_include_path") { 23 include_dirs = [ "public" ] 24 visibility = [ ":*" ] 25} 26 27pw_source_set("uuid") { 28 public_configs = [ ":public_include_path" ] 29 public = [ "public/pw_snapshot/uuid.h" ] 30 public_deps = [ 31 dir_pw_bytes, 32 dir_pw_result, 33 dir_pw_span, 34 dir_pw_status, 35 ] 36 deps = [ 37 ":metadata_proto.pwpb", 38 dir_pw_protobuf, 39 ] 40 sources = [ "uuid.cc" ] 41} 42 43group("pw_snapshot") { 44 deps = [ 45 ":metadata_proto", 46 ":snapshot_proto", 47 ] 48} 49 50# This proto library only contains the snapshot_metadata.proto. Typically this 51# should be a dependency of snapshot-like protos. 52pw_proto_library("metadata_proto") { 53 sources = [ "pw_snapshot_protos/snapshot_metadata.proto" ] 54 strip_prefix = "pw_snapshot_protos" 55 prefix = "pw_snapshot_metadata_proto" 56 deps = [ "$dir_pw_tokenizer:proto" ] 57} 58 59# This proto provides the complete "Snapshot" proto, which depends on various 60# proto libraries throughout Pigweed. This is the proto library to use when 61# building/reading snapshots. 62pw_proto_library("snapshot_proto") { 63 sources = [ "pw_snapshot_protos/snapshot.proto" ] 64 deps = [ 65 ":metadata_proto", 66 "$dir_pw_chrono:protos", 67 "$dir_pw_cpu_exception_cortex_m:cpu_state_protos", 68 "$dir_pw_cpu_exception_risc_v:cpu_state_protos", 69 "$dir_pw_log:protos", 70 "$dir_pw_thread:protos", 71 ] 72} 73 74pw_doc_group("docs") { 75 sources = [ 76 "design_discussion.rst", 77 "docs.rst", 78 "module_usage.rst", 79 "proto_format.rst", 80 "setup.rst", 81 ] 82} 83 84pw_test_group("tests") { 85 tests = [ 86 ":cpp_compile_test", 87 ":uuid_test", 88 ] 89} 90 91# An empty test to ensure the proto libraries compile correctly. 92pw_test("cpp_compile_test") { 93 sources = [ "cpp_compile_test.cc" ] 94 deps = [ 95 ":snapshot_proto.pwpb", 96 dir_pw_protobuf, 97 ] 98} 99 100pw_test("uuid_test") { 101 sources = [ "uuid_test.cc" ] 102 deps = [ 103 ":metadata_proto.pwpb", 104 ":uuid", 105 dir_pw_bytes, 106 dir_pw_protobuf, 107 dir_pw_result, 108 dir_pw_status, 109 ] 110} 111