| # Copyright (C) 2017 The Android Open Source Project |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| import("../gn/perfetto.gni") |
| import("//build_overrides/build.gni") |
| |
| if (!build_with_chromium) { |
| import("//build/proto_library.gni") |
| } else { |
| import("//third_party/protobuf/proto_library.gni") |
| } |
| |
| import("../gn/perfetto.gni") |
| import("protozero_library.gni") |
| |
| config("protozero_config") { |
| include_dirs = [ "include" ] |
| } |
| |
| source_set("protozero") { |
| all_dependent_configs = [ ":protozero_config" ] |
| |
| deps = [ |
| "../perfetto_base", |
| ] |
| |
| if (!build_with_chromium) { |
| configs += [ "//buildtools:googletest_prod_config" ] |
| } |
| |
| sources = [ |
| "include/protozero/contiguous_memory_range.h", |
| "include/protozero/proto_field_descriptor.h", |
| "include/protozero/protozero_message.h", |
| "include/protozero/protozero_message_handle.h", |
| "include/protozero/scattered_stream_writer.h", |
| "src/proto_utils.cc", |
| "src/protozero_message.cc", |
| "src/protozero_message_handle.cc", |
| "src/scattered_stream_writer.cc", |
| ] |
| } |
| |
| executable("protozero_unittests") { |
| testonly = true |
| deps = [ |
| ":protozero", |
| ":testing_messages_lite", |
| ":testing_messages_zero", |
| "../gn:default_deps", |
| "../gn:gtest_deps", |
| "../perfetto_base", |
| ] |
| |
| sources = [ |
| "src/proto_utils_unittest.cc", |
| "src/protozero_message_unittest.cc", |
| "src/scattered_stream_writer_unittest.cc", |
| "src/test/fake_scattered_buffer.cc", |
| "src/test/fake_scattered_buffer.h", |
| "src/test/protozero_conformance_unittest.cc", |
| ] |
| } |
| |
| # Generates both xxx.pbzero.h and xxx.pb.h (official proto). |
| |
| testing_proto_sources = [ |
| "src/test/example_proto/library.proto", |
| "src/test/example_proto/library_internals/galaxies.proto", |
| "src/test/example_proto/test_messages.proto", |
| "src/test/example_proto/upper_import.proto", |
| ] |
| |
| protozero_library("testing_messages_zero") { |
| #include_dirs = [ "include" ] |
| sources = testing_proto_sources |
| proto_in_dir = perfetto_root_path |
| proto_out_dir = "protos_zero" |
| generator_plugin_options = "wrapper_namespace=pbzero" |
| } |
| |
| proto_library("testing_messages_lite") { |
| #include_dirs = [ "include" ] |
| sources = testing_proto_sources |
| proto_in_dir = perfetto_root_path |
| proto_out_dir = "protos_lite" |
| } |