blob: 4cd56e433c1719112d07b13e87548cec5f935f13 [file] [log] [blame]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -08001# 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
15import("perfetto.gni")
16
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000017# Used in production targets (i.e. testonly == false) for the FRIEND_TEST_*
18# macros.
19group("gtest_prod_config") {
20 if (!build_with_chromium) {
21 public_configs = [ "//buildtools:googletest_prod_config" ]
22 } else {
23 public_configs = [ ":gtest_config" ]
24 }
25}
26
27config("gtest_config") {
28 if (build_with_chromium) {
29 include_dirs = [ "//testing/gtest/include" ]
30 }
31}
32
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080033group("gtest_deps") {
34 testonly = true
35
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000036 public_configs = [ ":gtest_config" ]
37
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080038 if (!build_with_chromium) {
39 public_deps = [
40 "//buildtools:gmock",
41 "//buildtools:gtest",
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080042 ]
43 } else {
44 public_deps = [
45 "//testing/gmock",
46 "//testing/gtest",
Florian Mayerd8bd81b2018-01-25 12:49:15 +000047 ]
48 }
49}
50
51group("gtest_main") {
52 testonly = true
53
54 if (!build_with_chromium) {
55 public_deps = [
56 "//buildtools:gtest_main",
57 ]
58 } else {
59 public_deps = [
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080060 "//testing/gtest:gtest_main",
61 ]
62 }
63}
64
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000065# protoc compiler library, for building protoc plugins on the host.
66if (current_toolchain == host_toolchain) {
67 group("protoc_lib_deps") {
68 if (!build_with_chromium) {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080069 public_deps = [
70 "//buildtools:protoc_lib",
71 ]
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000072 } else {
73 public_deps = [
74 "//third_party/protobuf:protoc_lib",
75 ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080076 }
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080077 }
78}
79
80group("protobuf_full_deps") {
Oystein Eftevaag917e1a22018-01-08 14:03:55 -080081 testonly = true
82
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080083 if (!build_with_chromium) {
84 public_deps = [
85 "//buildtools:protobuf_full",
86 ]
87 } else {
88 public_deps = [
89 "//third_party/protobuf:protobuf_full",
90 ]
91 }
92}
93
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000094# All targets should depend on this target to inherit the right flags and
95# include directories.
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080096group("default_deps") {
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000097 public_configs = [ ":default_config" ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080098 if (!build_with_chromium) {
99 public_deps = [
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000100 "//gn/standalone/libc++:deps",
101 "//gn/standalone/sanitizers:deps",
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800102 ]
Oystein Eftevaag08591712017-12-12 10:59:57 -0800103 } else {
104 public_deps = [
105 "//build/config:exe_and_shlib_deps",
106 ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800107 }
108}
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000109
110config("default_config") {
Oystein Eftevaaga812a942018-03-23 11:52:32 -0700111 defines = [ "PERFETTO_IMPLEMENTATION" ]
112
Oystein Eftevaagf7a0d7e2018-01-12 13:02:43 -0800113 if (build_with_chromium) {
Oystein Eftevaaga812a942018-03-23 11:52:32 -0700114 if (is_component_build) {
115 defines += [ "PERFETTO_SHARED_LIBRARY" ]
116 }
117
118 defines += [ "PERFETTO_BUILD_WITH_CHROMIUM" ]
Oystein Eftevaagf7a0d7e2018-01-12 13:02:43 -0800119
120 if (is_android) {
121 # Included for __android_log_print
122 libs = [ "log" ]
123 }
124 }
125
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000126 include_dirs = [
127 "..",
128 "../include",
129 ]
130}
Oystein Eftevaag5e8a4eb2018-01-09 11:41:58 -0800131
132config("public_config") {
Primiano Tucci20b760c2018-01-19 12:36:12 +0000133 include_dirs = [
134 "../include",
135
136 # The below are needed due to generated protobuf headers including other
137 # headers with a path relative to the perfetto root.
138 "${root_gen_dir}/${perfetto_root_path}/protos",
139 ]
Oystein Eftevaag5e8a4eb2018-01-09 11:41:58 -0800140}
Florian Mayer3a3974e2018-01-24 11:37:29 +0000141
142config("fuzzer_config") {
Florian Mayer94aaf692018-01-29 16:29:02 +0000143 ldflags = [ "-fsanitize=fuzzer" ]
Florian Mayer3a3974e2018-01-24 11:37:29 +0000144}