blob: b11a56944faa31917dac1442b9e508376bc8a568 [file] [log] [blame]
Primiano Tucci4f9b6d72017-12-05 20:59:16 +00001# 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
Primiano Tuccic1678872019-03-20 11:30:54 +000015import("../../gn/fuzzer.gni")
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000016import("../../gn/perfetto.gni")
Lalit Maganti2939c082021-03-11 17:25:44 +000017import("../../gn/perfetto_cc_proto_descriptor.gni")
Primiano Tucci916f4e52020-10-16 20:40:33 +020018import("../../gn/perfetto_component.gni")
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000019import("../../gn/proto_library.gni")
Primiano Tucci02c11762019-08-30 00:57:59 +020020import("../../gn/test.gni")
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000021
Primiano Tucci916f4e52020-10-16 20:40:33 +020022perfetto_component("protozero") {
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000023 public_configs = [ "../../gn:default_config" ]
24 public_deps = [
Lalit Magantibc508732019-12-09 13:46:07 +000025 "../../include/perfetto/base",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000026 "../../include/perfetto/protozero",
27 ]
28 deps = [
29 "../../gn:default_deps",
Lalit Magantibc508732019-12-09 13:46:07 +000030 "../base",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000031 ]
32 sources = [
Primiano Tucci6a7813d2019-11-19 11:08:50 +000033 "field.cc",
Hector Dearmane1e56b62018-02-21 19:11:58 +000034 "message.cc",
Primiano Tucciacb6ca32020-08-19 13:27:52 +020035 "message_arena.cc",
Hector Dearmane1e56b62018-02-21 19:11:58 +000036 "message_handle.cc",
Primiano Tucci03ac8332019-11-06 13:30:36 +000037 "packed_repeated_fields.cc",
Lalit Maganti45172a82018-06-01 03:04:43 +010038 "proto_decoder.cc",
Eric Seckler76311202019-01-07 12:20:25 +000039 "scattered_heap_buffer.cc",
Hector Dearman9a5a0e92018-03-27 17:52:24 +010040 "scattered_stream_null_delegate.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000041 "scattered_stream_writer.cc",
Primiano Tucci6a7fa5f2019-11-19 11:09:20 +000042 "static_buffer.cc",
Primiano Tuccicb8cea22019-11-22 11:05:35 +000043 "virtual_destructors.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000044 ]
45}
46
Lalit Maganti7d4b92b2021-05-20 17:16:51 +010047source_set("proto_ring_buffer") {
48 deps = [
49 ":protozero",
50 "../../gn:default_deps",
51 "../base",
52 ]
53 sources = [
54 "proto_ring_buffer.cc",
55 "proto_ring_buffer.h",
56 ]
57}
58
Primiano Tucci02c11762019-08-30 00:57:59 +020059perfetto_unittest_source_set("unittests") {
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000060 testonly = true
61 deps = [
Lalit Maganti7d4b92b2021-05-20 17:16:51 +010062 ":proto_ring_buffer",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000063 ":protozero",
Primiano Tucci6a7813d2019-11-19 11:08:50 +000064 ":testing_messages_cpp",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000065 ":testing_messages_lite",
66 ":testing_messages_zero",
67 "../../gn:default_deps",
Primiano Tucci13ae72f2019-06-06 10:53:02 +010068 "../../gn:gtest_and_gmock",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000069 "../base",
Eric Seckler2643c8f2019-01-18 07:35:58 +000070 "../base:test_support",
Primiano Tuccid4b49cb2021-05-13 09:53:46 +010071 "filtering:unittests",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000072 ]
73 sources = [
Primiano Tuccie4144b72019-11-07 16:10:19 +000074 "copyable_ptr_unittest.cc",
Hector Dearmane1e56b62018-02-21 19:11:58 +000075 "message_handle_unittest.cc",
76 "message_unittest.cc",
Lalit Maganti45172a82018-06-01 03:04:43 +010077 "proto_decoder_unittest.cc",
Lalit Maganti7d4b92b2021-05-20 17:16:51 +010078 "proto_ring_buffer_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000079 "proto_utils_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000080 "scattered_stream_writer_unittest.cc",
Primiano Tucci6a7813d2019-11-19 11:08:50 +000081 "test/cppgen_conformance_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000082 "test/fake_scattered_buffer.cc",
83 "test/fake_scattered_buffer.h",
84 "test/protozero_conformance_unittest.cc",
85 ]
86}
87
88# Generates both xxx.pbzero.h and xxx.pb.h (official proto).
89
Primiano Tucci2cf8b532019-08-29 01:14:01 +020090perfetto_proto_library("testing_messages_@TYPE@") {
91 sources = [
Andrew Shulaev4cfa3962020-06-15 17:16:18 +010092 "test/example_proto/extensions.proto",
Primiano Tucci2cf8b532019-08-29 01:14:01 +020093 "test/example_proto/library.proto",
94 "test/example_proto/library_internals/galaxies.proto",
95 "test/example_proto/test_messages.proto",
96 "test/example_proto/upper_import.proto",
97 ]
98 proto_path = perfetto_root_path
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000099}
Primiano Tuccic1678872019-03-20 11:30:54 +0000100
Lalit Maganti2939c082021-03-11 17:25:44 +0000101perfetto_proto_library("test_messages_descriptor") {
102 proto_generators = [ "descriptor" ]
103 generate_descriptor = "test_messages.descriptor"
104 sources = [ "test/example_proto/test_messages.proto" ]
105 deps = [ ":testing_messages_source_set" ]
106}
107
Primiano Tuccic1678872019-03-20 11:30:54 +0000108perfetto_fuzzer_test("protozero_decoder_fuzzer") {
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000109 sources = [ "proto_decoder_fuzzer.cc" ]
Primiano Tuccic1678872019-03-20 11:30:54 +0000110 deps = [
111 ":protozero",
112 "../../gn:default_deps",
Primiano Tucci2c5488f2019-06-01 03:27:28 +0100113 "../base",
Primiano Tuccic1678872019-03-20 11:30:54 +0000114 ]
115}
Primiano Tuccidf3ab202020-05-21 14:20:57 +0100116
117if (enable_perfetto_benchmarks) {
118 source_set("benchmarks") {
119 testonly = true
120 deps = [
121 ":protozero",
122 ":testing_messages_lite",
123 ":testing_messages_zero",
124 "../../gn:benchmark",
125 "../../gn:default_deps",
126 ]
127 sources = [ "test/protozero_benchmark.cc" ]
128 }
129}