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/perfetto.gni")
16import("../../gn/proto_library.gni")
17import("protozero_library.gni")
18
19source_set("protozero") {
20  public_configs = [ "../../gn:default_config" ]
21  public_deps = [
22    "../../include/perfetto/protozero",
23  ]
24  deps = [
25    "../../gn:default_deps",
26    "../../gn:gtest_prod_config",
27    "../base",
28  ]
29  sources = [
30    "message.cc",
31    "message_handle.cc",
32    "proto_utils.cc",
33    "scattered_stream_null_delegate.cc",
34    "scattered_stream_writer.cc",
35  ]
36}
37
38source_set("unittests") {
39  testonly = true
40  deps = [
41    ":protozero",
42    ":testing_messages_lite",
43    ":testing_messages_zero",
44    "../../gn:default_deps",
45    "../../gn:gtest_deps",
46    "../base",
47  ]
48  sources = [
49    "message_handle_unittest.cc",
50    "message_unittest.cc",
51    "proto_utils_unittest.cc",
52    "scattered_stream_writer_unittest.cc",
53    "test/fake_scattered_buffer.cc",
54    "test/fake_scattered_buffer.h",
55    "test/protozero_conformance_unittest.cc",
56  ]
57}
58
59# Generates both xxx.pbzero.h and xxx.pb.h (official proto).
60
61testing_proto_sources = [
62  "test/example_proto/library.proto",
63  "test/example_proto/library_internals/galaxies.proto",
64  "test/example_proto/test_messages.proto",
65  "test/example_proto/upper_import.proto",
66]
67
68protozero_library("testing_messages_zero") {
69  sources = testing_proto_sources
70  proto_in_dir = perfetto_root_path
71  proto_out_dir = perfetto_root_path
72  generator_plugin_options = "wrapper_namespace=pbzero"
73}
74
75proto_library("testing_messages_lite") {
76  generate_python = false
77  sources = testing_proto_sources
78  proto_in_dir = perfetto_root_path
79  proto_out_dir = perfetto_root_path
80}
81