blob: c7f3d95364fe0852b01615c8c24a99061f509863 [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
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 = [
Hector Dearmane1e56b62018-02-21 19:11:58 +000030 "message.cc",
31 "message_handle.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000032 "proto_utils.cc",
Hector Dearman9a5a0e92018-03-27 17:52:24 +010033 "scattered_stream_null_delegate.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000034 "scattered_stream_writer.cc",
35 ]
36}
37
Hector Dearman6cfec8a2018-03-14 16:54:09 +000038source_set("unittests") {
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000039 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 = [
Hector Dearmane1e56b62018-02-21 19:11:58 +000049 "message_handle_unittest.cc",
50 "message_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000051 "proto_utils_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000052 "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
Oystein Eftevaag51e06e52018-01-18 11:28:49 -080071 proto_out_dir = perfetto_root_path
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000072 generator_plugin_options = "wrapper_namespace=pbzero"
73}
74
75proto_library("testing_messages_lite") {
Primiano Tucci20b760c2018-01-19 12:36:12 +000076 generate_python = false
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000077 sources = testing_proto_sources
78 proto_in_dir = perfetto_root_path
Oystein Eftevaag51e06e52018-01-18 11:28:49 -080079 proto_out_dir = perfetto_root_path
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000080}