1# Copyright (C) 2017 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://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, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15import("../../gn/fuzzer.gni") 16import("../../gn/perfetto.gni") 17import("../../gn/perfetto_cc_proto_descriptor.gni") 18import("../../gn/perfetto_component.gni") 19import("../../gn/proto_library.gni") 20import("../../gn/test.gni") 21 22perfetto_component("protozero") { 23 public_configs = [ "../../gn:default_config" ] 24 public_deps = [ 25 "../../include/perfetto/base", 26 "../../include/perfetto/protozero", 27 ] 28 deps = [ 29 "../../gn:default_deps", 30 "../base", 31 ] 32 sources = [ 33 "field.cc", 34 "gen_field_helpers.cc", 35 "message.cc", 36 "message_arena.cc", 37 "packed_repeated_fields.cc", 38 "proto_decoder.cc", 39 "scattered_heap_buffer.cc", 40 "scattered_stream_null_delegate.cc", 41 "scattered_stream_writer.cc", 42 "static_buffer.cc", 43 "virtual_destructors.cc", 44 ] 45} 46 47source_set("proto_ring_buffer") { 48 public_deps = [ "../../include/perfetto/ext/protozero" ] 49 deps = [ 50 ":protozero", 51 "../../gn:default_deps", 52 "../base", 53 ] 54 sources = [ "proto_ring_buffer.cc" ] 55} 56 57perfetto_unittest_source_set("unittests") { 58 testonly = true 59 deps = [ 60 ":proto_ring_buffer", 61 ":protozero", 62 ":testing_messages_cpp", 63 ":testing_messages_lite", 64 ":testing_messages_other_package_cpp", 65 ":testing_messages_other_package_lite", 66 ":testing_messages_other_package_zero", 67 ":testing_messages_subpackage_cpp", 68 ":testing_messages_subpackage_lite", 69 ":testing_messages_subpackage_zero", 70 ":testing_messages_zero", 71 "../../gn:default_deps", 72 "../../gn:gtest_and_gmock", 73 "../base", 74 "../base:test_support", 75 "filtering:unittests", 76 ] 77 sources = [ 78 "copyable_ptr_unittest.cc", 79 "message_arena_unittest.cc", 80 "message_handle_unittest.cc", 81 "message_unittest.cc", 82 "proto_decoder_unittest.cc", 83 "proto_ring_buffer_unittest.cc", 84 "proto_utils_unittest.cc", 85 "scattered_stream_writer_unittest.cc", 86 "test/cppgen_conformance_unittest.cc", 87 "test/fake_scattered_buffer.cc", 88 "test/fake_scattered_buffer.h", 89 "test/protozero_conformance_unittest.cc", 90 ] 91} 92 93# Generates both xxx.pbzero.h and xxx.pb.h (official proto). 94 95perfetto_proto_library("testing_messages_@TYPE@") { 96 deps = [ 97 ":testing_messages_other_package_@TYPE@", 98 ":testing_messages_subpackage_@TYPE@", 99 ] 100 sources = [ 101 "test/example_proto/extensions.proto", 102 "test/example_proto/library.proto", 103 "test/example_proto/library_internals/galaxies.proto", 104 "test/example_proto/test_messages.proto", 105 "test/example_proto/upper_import.proto", 106 ] 107 generate_descriptor = "test_messages.descriptor" 108 descriptor_root_source = "test/example_proto/test_messages.proto" 109 proto_path = perfetto_root_path 110} 111 112perfetto_proto_library("testing_messages_other_package_@TYPE@") { 113 sources = [ "test/example_proto/other_package/test_messages.proto" ] 114 proto_path = perfetto_root_path 115} 116 117perfetto_proto_library("testing_messages_subpackage_@TYPE@") { 118 sources = [ "test/example_proto/subpackage/test_messages.proto" ] 119 proto_path = perfetto_root_path 120} 121 122perfetto_fuzzer_test("protozero_decoder_fuzzer") { 123 sources = [ "proto_decoder_fuzzer.cc" ] 124 deps = [ 125 ":protozero", 126 "../../gn:default_deps", 127 "../base", 128 ] 129} 130 131if (enable_perfetto_benchmarks) { 132 source_set("benchmarks") { 133 testonly = true 134 deps = [ 135 ":proto_ring_buffer", 136 ":protozero", 137 ":testing_messages_lite", 138 ":testing_messages_zero", 139 "../../gn:benchmark", 140 "../../gn:default_deps", 141 "../base", 142 "../base:test_support", 143 ] 144 sources = [ 145 "test/proto_ring_buffer_benchmark.cc", 146 "test/protozero_benchmark.cc", 147 ] 148 } 149} 150