blob: d7e81a167dec3ce666f9a6e719def7f3aa7b3701 [file] [log] [blame]
Hector Dearman2c650f82017-11-08 10:51:45 +00001# 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("../../protozero/protozero_library.gni")
Hector Dearman37e05532017-11-14 15:35:22 +000017import("all_protos.gni")
18
19# Create a copy of all the protos listed in all_protos.gni with the
20# "option optimize_for = LITE_RUNTIME" bit removed so we can generate
21# full proto .h/.cc files.
Primiano Tucci782374f2017-11-27 16:25:20 +000022full_protos_base_dir = "${root_gen_dir}/protos_full"
Primiano Tucci2ee254a2017-11-15 00:38:48 +000023full_protos_target_dir =
24 "$full_protos_base_dir/" + rebase_path(target_gen_dir, root_gen_dir)
25
Hector Dearman37e05532017-11-14 15:35:22 +000026action_foreach("generate_full_protos") {
27 visibility = [ ":*" ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080028 script = "../../build/generate_full_protos.py"
Hector Dearman37e05532017-11-14 15:35:22 +000029 sources = ftrace_proto_names
30
31 # TODO(hjd): Add support for subdirectories.
Primiano Tucci2ee254a2017-11-15 00:38:48 +000032 output_directory = full_protos_target_dir
Hector Dearman37e05532017-11-14 15:35:22 +000033 outputs = [
34 "$output_directory/{{source_name_part}}.proto",
35 ]
36
37 args = [
38 "{{source}}",
39 rebase_path(output_directory, root_build_dir) +
40 "/{{source_name_part}}.proto",
41 ]
42}
43
Primiano Tucci782374f2017-11-27 16:25:20 +000044proto_library("full") {
45 testonly = true
Hector Dearman37e05532017-11-14 15:35:22 +000046 deps = [
47 ":generate_full_protos",
48 ]
49 sources = []
Primiano Tucci782374f2017-11-27 16:25:20 +000050 use_protobuf_full = true
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080051 proto_in_dir = "$full_protos_base_dir/" + perfetto_root_path
Primiano Tucci782374f2017-11-27 16:25:20 +000052 proto_out_dir = "protos_full"
Hector Dearman37e05532017-11-14 15:35:22 +000053 foreach(proto, ftrace_proto_names) {
Primiano Tucci2ee254a2017-11-15 00:38:48 +000054 sources += [ "$full_protos_target_dir/$proto" ]
Hector Dearman37e05532017-11-14 15:35:22 +000055 }
Hector Dearman37e05532017-11-14 15:35:22 +000056}
Hector Dearman2c650f82017-11-08 10:51:45 +000057
Primiano Tucci782374f2017-11-27 16:25:20 +000058proto_library("lite") {
Hector Dearman37e05532017-11-14 15:35:22 +000059 sources = ftrace_proto_names
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080060 proto_in_dir = perfetto_root_path
Primiano Tucci782374f2017-11-27 16:25:20 +000061 proto_out_dir = "protos_lite"
62}
63
64protozero_library("zero") {
65 sources = ftrace_proto_names
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080066 proto_in_dir = perfetto_root_path
Primiano Tucci782374f2017-11-27 16:25:20 +000067 proto_out_dir = "protos_zero"
Primiano Tucci5f48d7b2017-11-27 16:57:13 +000068 generator_plugin_options = "wrapper_namespace=pbzero"
Hector Dearman2c650f82017-11-08 10:51:45 +000069}