• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/proto_library.gni")
18import("../../gn/test.gni")
19
20source_set("protozero") {
21  public_configs = [ "../../gn:default_config" ]
22  public_deps = [
23    "../../include/perfetto/base",
24    "../../include/perfetto/protozero",
25  ]
26  deps = [
27    "../../gn:default_deps",
28    "../base",
29  ]
30  sources = [
31    "field.cc",
32    "message.cc",
33    "message_handle.cc",
34    "packed_repeated_fields.cc",
35    "proto_decoder.cc",
36    "scattered_heap_buffer.cc",
37    "scattered_stream_null_delegate.cc",
38    "scattered_stream_writer.cc",
39    "static_buffer.cc",
40    "virtual_destructors.cc",
41  ]
42}
43
44static_library("libprotozero") {
45  complete_static_lib = true
46  deps = [ ":protozero" ]
47}
48
49perfetto_unittest_source_set("unittests") {
50  testonly = true
51  deps = [
52    ":protozero",
53    ":testing_messages_cpp",
54    ":testing_messages_lite",
55    ":testing_messages_zero",
56    "../../gn:default_deps",
57    "../../gn:gtest_and_gmock",
58    "../base",
59    "../base:test_support",
60  ]
61  sources = [
62    "copyable_ptr_unittest.cc",
63    "message_handle_unittest.cc",
64    "message_unittest.cc",
65    "proto_decoder_unittest.cc",
66    "proto_utils_unittest.cc",
67    "scattered_stream_writer_unittest.cc",
68    "test/cppgen_conformance_unittest.cc",
69    "test/fake_scattered_buffer.cc",
70    "test/fake_scattered_buffer.h",
71    "test/protozero_conformance_unittest.cc",
72  ]
73}
74
75# Generates both xxx.pbzero.h and xxx.pb.h (official proto).
76
77perfetto_proto_library("testing_messages_@TYPE@") {
78  sources = [
79    "test/example_proto/library.proto",
80    "test/example_proto/library_internals/galaxies.proto",
81    "test/example_proto/test_messages.proto",
82    "test/example_proto/upper_import.proto",
83  ]
84  proto_path = perfetto_root_path
85}
86
87perfetto_fuzzer_test("protozero_decoder_fuzzer") {
88  sources = [ "proto_decoder_fuzzer.cc" ]
89  deps = [
90    ":protozero",
91    "../../gn:default_deps",
92    "../base",
93  ]
94}
95
96if (enable_perfetto_benchmarks) {
97  source_set("benchmarks") {
98    testonly = true
99    deps = [
100      ":protozero",
101      ":testing_messages_lite",
102      ":testing_messages_zero",
103      "../../gn:benchmark",
104      "../../gn:default_deps",
105    ]
106    sources = [ "test/protozero_benchmark.cc" ]
107  }
108}
109