Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 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 | |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 15 | import("//build/proto_library.gni") |
Primiano Tucci | fd48423 | 2017-10-25 00:15:39 +0100 | [diff] [blame] | 16 | import("protozero_library.gni") |
| 17 | |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 18 | config("protozero_config") { |
| 19 | include_dirs = [ "include" ] |
| 20 | } |
| 21 | |
| 22 | source_set("protozero") { |
| 23 | all_dependent_configs = [ ":protozero_config" ] |
Primiano Tucci | 2a29ac7 | 2017-10-24 17:47:19 +0100 | [diff] [blame] | 24 | configs += [ "//buildtools:googletest_prod_config" ] |
Primiano Tucci | d7d1be0 | 2017-10-30 17:41:34 +0000 | [diff] [blame] | 25 | deps += [ "//base" ] |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 26 | sources = [ |
Primiano Tucci | d7d1be0 | 2017-10-30 17:41:34 +0000 | [diff] [blame] | 27 | "include/protozero/contiguous_memory_range.h", |
| 28 | "include/protozero/proto_field_descriptor.h", |
Primiano Tucci | d7d1be0 | 2017-10-30 17:41:34 +0000 | [diff] [blame] | 29 | "include/protozero/protozero_message.h", |
| 30 | "include/protozero/protozero_message_handle.h", |
| 31 | "include/protozero/scattered_stream_writer.h", |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 32 | "src/proto_utils.cc", |
Primiano Tucci | 2a29ac7 | 2017-10-24 17:47:19 +0100 | [diff] [blame] | 33 | "src/protozero_message.cc", |
| 34 | "src/protozero_message_handle.cc", |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 35 | "src/scattered_stream_writer.cc", |
| 36 | ] |
| 37 | } |
| 38 | |
| 39 | executable("protozero_unittests") { |
| 40 | testonly = true |
| 41 | deps += [ |
| 42 | ":protozero", |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 43 | ":testing_messages_lite", |
| 44 | ":testing_messages_zero", |
Primiano Tucci | d7d1be0 | 2017-10-30 17:41:34 +0000 | [diff] [blame] | 45 | "//base", |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 46 | "//buildtools:gmock", |
| 47 | "//buildtools:gtest", |
| 48 | "//buildtools:gtest_main", |
| 49 | ] |
| 50 | sources = [ |
| 51 | "src/proto_utils_unittest.cc", |
Primiano Tucci | 2a29ac7 | 2017-10-24 17:47:19 +0100 | [diff] [blame] | 52 | "src/protozero_message_unittest.cc", |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 53 | "src/scattered_stream_writer_unittest.cc", |
| 54 | "src/test/fake_scattered_buffer.cc", |
Primiano Tucci | d7d1be0 | 2017-10-30 17:41:34 +0000 | [diff] [blame] | 55 | "src/test/fake_scattered_buffer.h", |
Primiano Tucci | fd48423 | 2017-10-25 00:15:39 +0100 | [diff] [blame] | 56 | "src/test/protozero_conformance_unittest.cc", |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 57 | ] |
| 58 | } |
Primiano Tucci | fd48423 | 2017-10-25 00:15:39 +0100 | [diff] [blame] | 59 | |
| 60 | # Generates both xxx.pbzero.h and xxx.pb.h (official proto). |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 61 | |
| 62 | testing_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 | |
| 69 | protozero_library("testing_messages_zero") { |
Primiano Tucci | fd48423 | 2017-10-25 00:15:39 +0100 | [diff] [blame] | 70 | include_dirs = [ "include" ] |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 71 | sources = testing_proto_sources |
| 72 | proto_out_dir = "protos_zero" |
Primiano Tucci | 5f48d7b | 2017-11-27 16:57:13 +0000 | [diff] [blame] | 73 | generator_plugin_options = "wrapper_namespace=pbzero" |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | proto_library("testing_messages_lite") { |
| 77 | include_dirs = [ "include" ] |
| 78 | sources = testing_proto_sources |
| 79 | proto_out_dir = "protos_lite" |
Primiano Tucci | fd48423 | 2017-10-25 00:15:39 +0100 | [diff] [blame] | 80 | } |