| # 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") |
| |
| # Used in production targets (i.e. testonly == false) for the FRIEND_TEST_* |
| # macros. |
| group("gtest_prod_config") { |
| if (!build_with_chromium) { |
| public_configs = [ "//buildtools:googletest_prod_config" ] |
| } else { |
| public_configs = [ ":gtest_config" ] |
| } |
| } |
| |
| config("gtest_config") { |
| if (build_with_chromium) { |
| include_dirs = [ "//testing/gtest/include" ] |
| } |
| } |
| |
| group("gtest_deps") { |
| testonly = true |
| |
| public_configs = [ ":gtest_config" ] |
| |
| if (!build_with_chromium) { |
| public_deps = [ |
| "//buildtools:gmock", |
| "//buildtools:gtest", |
| ] |
| } else { |
| public_deps = [ |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| } |
| } |
| |
| group("gtest_main") { |
| testonly = true |
| |
| if (!build_with_chromium) { |
| public_deps = [ |
| "//buildtools:gtest_main", |
| ] |
| } 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") { |
| if (!build_with_chromium) { |
| public_deps = [ |
| "//buildtools:protoc_lib", |
| ] |
| } else { |
| public_deps = [ |
| "//third_party/protobuf:protoc_lib", |
| ] |
| } |
| } |
| } |
| |
| group("protobuf_full_deps") { |
| testonly = true |
| |
| if (!build_with_chromium) { |
| public_deps = [ |
| "//buildtools:protobuf_full", |
| ] |
| } else { |
| public_deps = [ |
| "//third_party/protobuf: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 (!build_with_chromium) { |
| public_deps = [ |
| "//gn/standalone/libc++:deps", |
| "//gn/standalone/sanitizers:deps", |
| ] |
| } else { |
| public_deps = [ |
| "//build/config:exe_and_shlib_deps", |
| ] |
| } |
| } |
| |
| config("default_config") { |
| if (build_with_chromium) { |
| defines = [ "PERFETTO_BUILD_WITH_CHROMIUM" ] |
| |
| if (is_android) { |
| # Included for __android_log_print |
| libs = [ "log" ] |
| } |
| } |
| |
| 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", |
| ] |
| } |
| |
| config("fuzzer_config") { |
| ldflags = [ "-fsanitize=fuzzer" ] |
| } |