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 | |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 15 | import("../gn/perfetto.gni") |
| 16 | import("//build_overrides/build.gni") |
| 17 | |
| 18 | if (!build_with_chromium) { |
| 19 | import("//build/proto_library.gni") |
| 20 | } else { |
| 21 | import("//third_party/protobuf/proto_library.gni") |
| 22 | } |
| 23 | |
| 24 | import("../gn/perfetto.gni") |
Primiano Tucci | fd48423 | 2017-10-25 00:15:39 +0100 | [diff] [blame] | 25 | import("protozero_library.gni") |
| 26 | |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 27 | config("protozero_config") { |
| 28 | include_dirs = [ "include" ] |
| 29 | } |
| 30 | |
| 31 | source_set("protozero") { |
| 32 | all_dependent_configs = [ ":protozero_config" ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 33 | |
| 34 | deps = [ |
| 35 | "../perfetto_base", |
| 36 | ] |
| 37 | |
| 38 | if (!build_with_chromium) { |
| 39 | configs += [ "//buildtools:googletest_prod_config" ] |
| 40 | } |
| 41 | |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 42 | sources = [ |
Primiano Tucci | d7d1be0 | 2017-10-30 17:41:34 +0000 | [diff] [blame] | 43 | "include/protozero/contiguous_memory_range.h", |
| 44 | "include/protozero/proto_field_descriptor.h", |
Primiano Tucci | d7d1be0 | 2017-10-30 17:41:34 +0000 | [diff] [blame] | 45 | "include/protozero/protozero_message.h", |
| 46 | "include/protozero/protozero_message_handle.h", |
| 47 | "include/protozero/scattered_stream_writer.h", |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 48 | "src/proto_utils.cc", |
Primiano Tucci | 2a29ac7 | 2017-10-24 17:47:19 +0100 | [diff] [blame] | 49 | "src/protozero_message.cc", |
| 50 | "src/protozero_message_handle.cc", |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 51 | "src/scattered_stream_writer.cc", |
| 52 | ] |
| 53 | } |
| 54 | |
| 55 | executable("protozero_unittests") { |
| 56 | testonly = true |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 57 | deps = [ |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 58 | ":protozero", |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 59 | ":testing_messages_lite", |
| 60 | ":testing_messages_zero", |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 61 | "../gn:default_deps", |
| 62 | "../gn:gtest_deps", |
| 63 | "../perfetto_base", |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 64 | ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 65 | |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 66 | sources = [ |
| 67 | "src/proto_utils_unittest.cc", |
Primiano Tucci | 2a29ac7 | 2017-10-24 17:47:19 +0100 | [diff] [blame] | 68 | "src/protozero_message_unittest.cc", |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 69 | "src/scattered_stream_writer_unittest.cc", |
| 70 | "src/test/fake_scattered_buffer.cc", |
Primiano Tucci | d7d1be0 | 2017-10-30 17:41:34 +0000 | [diff] [blame] | 71 | "src/test/fake_scattered_buffer.h", |
Primiano Tucci | fd48423 | 2017-10-25 00:15:39 +0100 | [diff] [blame] | 72 | "src/test/protozero_conformance_unittest.cc", |
Primiano Tucci | 97440f4 | 2017-10-24 13:27:18 +0100 | [diff] [blame] | 73 | ] |
| 74 | } |
Primiano Tucci | fd48423 | 2017-10-25 00:15:39 +0100 | [diff] [blame] | 75 | |
| 76 | # Generates both xxx.pbzero.h and xxx.pb.h (official proto). |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 77 | |
| 78 | testing_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 | |
| 85 | protozero_library("testing_messages_zero") { |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 86 | #include_dirs = [ "include" ] |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 87 | sources = testing_proto_sources |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 88 | proto_in_dir = perfetto_root_path |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 89 | proto_out_dir = "protos_zero" |
Primiano Tucci | 5f48d7b | 2017-11-27 16:57:13 +0000 | [diff] [blame] | 90 | generator_plugin_options = "wrapper_namespace=pbzero" |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | proto_library("testing_messages_lite") { |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 94 | #include_dirs = [ "include" ] |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 95 | sources = testing_proto_sources |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 96 | proto_in_dir = perfetto_root_path |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 97 | proto_out_dir = "protos_lite" |
Primiano Tucci | fd48423 | 2017-10-25 00:15:39 +0100 | [diff] [blame] | 98 | } |