blob: 0f01f26801c661f7bd047abb822063716bdfd1e6 [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
Primiano Tucci782374f2017-11-27 16:25:20 +000015import("//build/proto_library.gni")
Primiano Tuccifd484232017-10-25 00:15:39 +010016import("protozero_library.gni")
17
Primiano Tucci97440f42017-10-24 13:27:18 +010018config("protozero_config") {
19 include_dirs = [ "include" ]
20}
21
22source_set("protozero") {
23 all_dependent_configs = [ ":protozero_config" ]
Primiano Tucci2a29ac72017-10-24 17:47:19 +010024 configs += [ "//buildtools:googletest_prod_config" ]
Primiano Tuccid7d1be02017-10-30 17:41:34 +000025 deps += [ "//base" ]
Primiano Tucci97440f42017-10-24 13:27:18 +010026 sources = [
Primiano Tuccid7d1be02017-10-30 17:41:34 +000027 "include/protozero/contiguous_memory_range.h",
28 "include/protozero/proto_field_descriptor.h",
Primiano Tuccid7d1be02017-10-30 17:41:34 +000029 "include/protozero/protozero_message.h",
30 "include/protozero/protozero_message_handle.h",
31 "include/protozero/scattered_stream_writer.h",
Primiano Tucci97440f42017-10-24 13:27:18 +010032 "src/proto_utils.cc",
Primiano Tucci2a29ac72017-10-24 17:47:19 +010033 "src/protozero_message.cc",
34 "src/protozero_message_handle.cc",
Primiano Tucci97440f42017-10-24 13:27:18 +010035 "src/scattered_stream_writer.cc",
36 ]
37}
38
39executable("protozero_unittests") {
40 testonly = true
41 deps += [
42 ":protozero",
Primiano Tucci782374f2017-11-27 16:25:20 +000043 ":testing_messages_lite",
44 ":testing_messages_zero",
Primiano Tuccid7d1be02017-10-30 17:41:34 +000045 "//base",
Primiano Tucci97440f42017-10-24 13:27:18 +010046 "//buildtools:gmock",
47 "//buildtools:gtest",
48 "//buildtools:gtest_main",
49 ]
50 sources = [
51 "src/proto_utils_unittest.cc",
Primiano Tucci2a29ac72017-10-24 17:47:19 +010052 "src/protozero_message_unittest.cc",
Primiano Tucci97440f42017-10-24 13:27:18 +010053 "src/scattered_stream_writer_unittest.cc",
54 "src/test/fake_scattered_buffer.cc",
Primiano Tuccid7d1be02017-10-30 17:41:34 +000055 "src/test/fake_scattered_buffer.h",
Primiano Tuccifd484232017-10-25 00:15:39 +010056 "src/test/protozero_conformance_unittest.cc",
Primiano Tucci97440f42017-10-24 13:27:18 +010057 ]
58}
Primiano Tuccifd484232017-10-25 00:15:39 +010059
60# Generates both xxx.pbzero.h and xxx.pb.h (official proto).
Primiano Tucci782374f2017-11-27 16:25:20 +000061
62testing_proto_sources = [
63 "src/test/example_proto/library.proto",
64 "src/test/example_proto/library_internals/galaxies.proto",
65 "src/test/example_proto/test_messages.proto",
66 "src/test/example_proto/upper_import.proto",
67]
68
69protozero_library("testing_messages_zero") {
Primiano Tuccifd484232017-10-25 00:15:39 +010070 include_dirs = [ "include" ]
Primiano Tucci782374f2017-11-27 16:25:20 +000071 sources = testing_proto_sources
72 proto_out_dir = "protos_zero"
Primiano Tucci5f48d7b2017-11-27 16:57:13 +000073 generator_plugin_options = "wrapper_namespace=pbzero"
Primiano Tucci782374f2017-11-27 16:25:20 +000074}
75
76proto_library("testing_messages_lite") {
77 include_dirs = [ "include" ]
78 sources = testing_proto_sources
79 proto_out_dir = "protos_lite"
Primiano Tuccifd484232017-10-25 00:15:39 +010080}