Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [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 | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 15 | import("perfetto.gni") |
| 16 | import("proto_library.gni") |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 17 | |
| 18 | # Equivalent to proto_library (generation of .h/.cc from .proto files) but |
| 19 | # enables also generation using the protozero plugin. |
| 20 | # The generated files will have the .pbzero.{cc,h} suffix, as opposed to the |
| 21 | # .pb.{cc,h} of the official proto library. |
| 22 | template("protozero_library") { |
| 23 | proto_library(target_name) { |
| 24 | perfetto_root_path = invoker.perfetto_root_path |
| 25 | |
| 26 | generate_cc = false |
Primiano Tucci | 20b760c | 2018-01-19 12:36:12 +0000 | [diff] [blame] | 27 | generate_python = false |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 28 | generator_plugin_label = perfetto_root_path + "src/protozero/protoc_plugin" |
| 29 | generator_plugin_suffix = ".pbzero" |
Oystein Eftevaag | 589fda4 | 2018-07-12 16:00:17 -0700 | [diff] [blame] | 30 | if (build_with_chromium) { |
| 31 | component_build_force_source_set = true |
| 32 | } |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 33 | |
| 34 | if (defined(invoker.deps)) { |
| 35 | deps = invoker.deps |
| 36 | } else { |
| 37 | deps = [] |
| 38 | } |
| 39 | |
| 40 | deps += [ perfetto_root_path + "src/protozero" ] |
| 41 | |
| 42 | forward_variables_from(invoker, |
| 43 | [ |
| 44 | "defines", |
| 45 | "generator_plugin_options", |
| 46 | "include_dirs", |
| 47 | "proto_in_dir", |
| 48 | "proto_out_dir", |
| 49 | "sources", |
| 50 | "testonly", |
| 51 | "visibility", |
| 52 | ]) |
| 53 | } |
| 54 | } |