| # 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("perfetto.gni") |
| import("proto_library.gni") |
| |
| # Used by base/gtest_prod_util.h for the FRIEND_TEST_* macros. Note that other |
| # production targets (i.e. testonly == false) should use base/gtest_prod_util.h |
| # instead. |
| group("gtest_prod_config") { |
| if (perfetto_build_standalone || perfetto_build_with_android) { |
| public_configs = [ "//buildtools:googletest_prod_config" ] |
| } else { |
| public_configs = [ ":gtest_config" ] |
| } |
| } |
| |
| config("gtest_config") { |
| if (perfetto_build_with_embedder) { |
| include_dirs = [ "//testing/gtest/include" ] |
| } |
| } |
| |
| config("gmock_config") { |
| if (perfetto_build_with_embedder) { |
| include_dirs = [ "//testing/gmock/include" ] |
| } |
| } |
| |
| group("gtest_deps") { |
| testonly = true |
| |
| public_configs = [ |
| ":gtest_config", |
| ":gmock_config", |
| ] |
| |
| if (perfetto_build_standalone || perfetto_build_with_android) { |
| public_deps = [ |
| "//buildtools:gmock", |
| "//buildtools:gtest", |
| ] |
| } else { |
| public_deps = [ |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| } |
| } |
| |
| group("gtest_main") { |
| testonly = true |
| |
| if (perfetto_build_standalone || perfetto_build_with_android) { |
| public_deps = [ |
| "//buildtools:gtest_main", |
| ] |
| } else if (build_with_chromium) { |
| public_deps = [ |
| "//base/test:run_all_unittests", |
| ] |
| } else { |
| public_deps = [ |
| "//testing/gtest:gtest_main", |
| ] |
| } |
| } |
| |
| # protoc compiler library, for building protoc plugins on the host. |
| if (current_toolchain == host_toolchain) { |
| group("protoc_lib_deps") { |
| public_deps = [ |
| "${perfetto_protobuf_target_prefix}:protoc_lib", |
| ] |
| } |
| } |
| |
| group("protobuf_full_deps") { |
| testonly = true |
| public_deps = [ |
| "${perfetto_protobuf_target_prefix}:protobuf_full", |
| ] |
| } |
| |
| # All targets should depend on this target to inherit the right flags and |
| # include directories. |
| group("default_deps") { |
| public_configs = [ ":default_config" ] |
| if (perfetto_build_standalone || perfetto_build_with_android) { |
| public_deps = [ |
| "//gn/standalone/libc++:deps", |
| "//gn/standalone/sanitizers:deps", |
| ] |
| } |
| } |
| |
| config("default_config") { |
| defines = [ "PERFETTO_IMPLEMENTATION" ] |
| |
| if (build_with_chromium) { |
| if (is_component_build) { |
| defines += [ "PERFETTO_SHARED_LIBRARY" ] |
| } |
| |
| defines += [ "PERFETTO_BUILD_WITH_CHROMIUM" ] |
| |
| if (is_android) { |
| # Included for __android_log_print |
| libs = [ "log" ] |
| } |
| } |
| |
| if (perfetto_force_dlog == "on") { |
| defines += [ "PERFETTO_FORCE_DLOG=1" ] |
| } else if (perfetto_force_dlog == "off") { |
| defines += [ "PERFETTO_FORCE_DLOG=0" ] |
| } |
| |
| include_dirs = [ |
| "..", |
| "../include", |
| ] |
| } |
| |
| config("public_config") { |
| include_dirs = [ |
| "../include", |
| |
| # The below are needed due to generated protobuf headers including other |
| # headers with a path relative to the perfetto root. |
| "${root_gen_dir}/${perfetto_root_path}/protos", |
| ] |
| } |
| |
| # For now JsonCpp is supported only in standalone builds outside of Android or |
| # Chromium. |
| group("jsoncpp_deps") { |
| if (perfetto_build_standalone) { |
| public_configs = [ "//buildtools:jsoncpp_config" ] |
| public_deps = [ |
| "//buildtools:jsoncpp", |
| ] |
| } |
| } |