blob: 1ebfaca6d5261a33548228d890393ac23224adad [file] [log] [blame]
Primiano Tucci97440f42017-10-24 13:27:18 +01001# 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
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080015import("../gn/perfetto.gni")
16import("//build_overrides/build.gni")
17
18if (!build_with_chromium) {
19 import("//build/proto_library.gni")
20} else {
21 import("//third_party/protobuf/proto_library.gni")
22}
23
24import("../gn/perfetto.gni")
Primiano Tuccifd484232017-10-25 00:15:39 +010025import("protozero_library.gni")
26
Primiano Tucci97440f42017-10-24 13:27:18 +010027config("protozero_config") {
28 include_dirs = [ "include" ]
29}
30
31source_set("protozero") {
32 all_dependent_configs = [ ":protozero_config" ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080033
34 deps = [
35 "../perfetto_base",
36 ]
37
38 if (!build_with_chromium) {
39 configs += [ "//buildtools:googletest_prod_config" ]
40 }
41
Primiano Tucci97440f42017-10-24 13:27:18 +010042 sources = [
Primiano Tuccid7d1be02017-10-30 17:41:34 +000043 "include/protozero/contiguous_memory_range.h",
44 "include/protozero/proto_field_descriptor.h",
Primiano Tuccid7d1be02017-10-30 17:41:34 +000045 "include/protozero/protozero_message.h",
46 "include/protozero/protozero_message_handle.h",
47 "include/protozero/scattered_stream_writer.h",
Primiano Tucci97440f42017-10-24 13:27:18 +010048 "src/proto_utils.cc",
Primiano Tucci2a29ac72017-10-24 17:47:19 +010049 "src/protozero_message.cc",
50 "src/protozero_message_handle.cc",
Primiano Tucci97440f42017-10-24 13:27:18 +010051 "src/scattered_stream_writer.cc",
52 ]
53}
54
55executable("protozero_unittests") {
56 testonly = true
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080057 deps = [
Primiano Tucci97440f42017-10-24 13:27:18 +010058 ":protozero",
Primiano Tucci782374f2017-11-27 16:25:20 +000059 ":testing_messages_lite",
60 ":testing_messages_zero",
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080061 "../gn:default_deps",
62 "../gn:gtest_deps",
63 "../perfetto_base",
Primiano Tucci97440f42017-10-24 13:27:18 +010064 ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080065
Primiano Tucci97440f42017-10-24 13:27:18 +010066 sources = [
67 "src/proto_utils_unittest.cc",
Primiano Tucci2a29ac72017-10-24 17:47:19 +010068 "src/protozero_message_unittest.cc",
Primiano Tucci97440f42017-10-24 13:27:18 +010069 "src/scattered_stream_writer_unittest.cc",
70 "src/test/fake_scattered_buffer.cc",
Primiano Tuccid7d1be02017-10-30 17:41:34 +000071 "src/test/fake_scattered_buffer.h",
Primiano Tuccifd484232017-10-25 00:15:39 +010072 "src/test/protozero_conformance_unittest.cc",
Primiano Tucci97440f42017-10-24 13:27:18 +010073 ]
74}
Primiano Tuccifd484232017-10-25 00:15:39 +010075
76# Generates both xxx.pbzero.h and xxx.pb.h (official proto).
Primiano Tucci782374f2017-11-27 16:25:20 +000077
78testing_proto_sources = [
79 "src/test/example_proto/library.proto",
80 "src/test/example_proto/library_internals/galaxies.proto",
81 "src/test/example_proto/test_messages.proto",
82 "src/test/example_proto/upper_import.proto",
83]
84
85protozero_library("testing_messages_zero") {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080086 #include_dirs = [ "include" ]
Primiano Tucci782374f2017-11-27 16:25:20 +000087 sources = testing_proto_sources
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080088 proto_in_dir = perfetto_root_path
Primiano Tucci782374f2017-11-27 16:25:20 +000089 proto_out_dir = "protos_zero"
Primiano Tucci5f48d7b2017-11-27 16:57:13 +000090 generator_plugin_options = "wrapper_namespace=pbzero"
Primiano Tucci782374f2017-11-27 16:25:20 +000091}
92
93proto_library("testing_messages_lite") {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080094 #include_dirs = [ "include" ]
Primiano Tucci782374f2017-11-27 16:25:20 +000095 sources = testing_proto_sources
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080096 proto_in_dir = perfetto_root_path
Primiano Tucci782374f2017-11-27 16:25:20 +000097 proto_out_dir = "protos_lite"
Primiano Tuccifd484232017-10-25 00:15:39 +010098}