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 proto_path = perfetto_root_path 108} 109 110perfetto_proto_library("testing_messages_other_package_@TYPE@") { 111 sources = [ "test/example_proto/other_package/test_messages.proto" ] 112 proto_path = perfetto_root_path 113} 114 115perfetto_proto_library("testing_messages_subpackage_@TYPE@") { 116 sources = [ "test/example_proto/subpackage/test_messages.proto" ] 117 proto_path = perfetto_root_path 118} 119 120perfetto_proto_library("test_messages_descriptor") { 121 proto_generators = [ "descriptor" ] 122 generate_descriptor = "test_messages.descriptor" 123 sources = [ "test/example_proto/test_messages.proto" ] 124 deps = [ ":testing_messages_source_set" ] 125} 126 127perfetto_fuzzer_test("protozero_decoder_fuzzer") { 128 sources = [ "proto_decoder_fuzzer.cc" ] 129 deps = [ 130 ":protozero", 131 "../../gn:default_deps", 132 "../base", 133 ] 134} 135 136if (enable_perfetto_benchmarks) { 137 source_set("benchmarks") { 138 testonly = true 139 deps = [ 140 ":proto_ring_buffer", 141 ":protozero", 142 ":testing_messages_lite", 143 ":testing_messages_zero", 144 "../../gn:benchmark", 145 "../../gn:default_deps", 146 "../base", 147 "../base:test_support", 148 ] 149 sources = [ 150 "test/proto_ring_buffer_benchmark.cc", 151 "test/protozero_benchmark.cc", 152 ] 153 } 154} 155