Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 1 | # 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 | |
| 15 | import("perfetto.gni") |
| 16 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 17 | # Used in production targets (i.e. testonly == false) for the FRIEND_TEST_* |
| 18 | # macros. |
| 19 | group("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 | |
| 27 | config("gtest_config") { |
| 28 | if (build_with_chromium) { |
| 29 | include_dirs = [ "//testing/gtest/include" ] |
| 30 | } |
| 31 | } |
| 32 | |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 33 | group("gtest_deps") { |
| 34 | testonly = true |
| 35 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 36 | public_configs = [ ":gtest_config" ] |
| 37 | |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 38 | if (!build_with_chromium) { |
| 39 | public_deps = [ |
| 40 | "//buildtools:gmock", |
| 41 | "//buildtools:gtest", |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 42 | ] |
| 43 | } else { |
| 44 | public_deps = [ |
| 45 | "//testing/gmock", |
| 46 | "//testing/gtest", |
Florian Mayer | d8bd81b | 2018-01-25 12:49:15 +0000 | [diff] [blame] | 47 | ] |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | group("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 Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 60 | "//testing/gtest:gtest_main", |
| 61 | ] |
| 62 | } |
| 63 | } |
| 64 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 65 | # protoc compiler library, for building protoc plugins on the host. |
| 66 | if (current_toolchain == host_toolchain) { |
| 67 | group("protoc_lib_deps") { |
| 68 | if (!build_with_chromium) { |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 69 | public_deps = [ |
| 70 | "//buildtools:protoc_lib", |
| 71 | ] |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 72 | } else { |
| 73 | public_deps = [ |
| 74 | "//third_party/protobuf:protoc_lib", |
| 75 | ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 76 | } |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 77 | } |
| 78 | } |
| 79 | |
| 80 | group("protobuf_full_deps") { |
Oystein Eftevaag | 917e1a2 | 2018-01-08 14:03:55 -0800 | [diff] [blame] | 81 | testonly = true |
| 82 | |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 83 | 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 Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 94 | # All targets should depend on this target to inherit the right flags and |
| 95 | # include directories. |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 96 | group("default_deps") { |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 97 | public_configs = [ ":default_config" ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 98 | if (!build_with_chromium) { |
| 99 | public_deps = [ |
Primiano Tucci | 7a40e4d | 2017-12-06 09:51:09 +0000 | [diff] [blame] | 100 | "//gn/standalone/libc++:deps", |
| 101 | "//gn/standalone/sanitizers:deps", |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 102 | ] |
Oystein Eftevaag | 0859171 | 2017-12-12 10:59:57 -0800 | [diff] [blame] | 103 | } else { |
| 104 | public_deps = [ |
| 105 | "//build/config:exe_and_shlib_deps", |
| 106 | ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 107 | } |
| 108 | } |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 109 | |
| 110 | config("default_config") { |
Oystein Eftevaag | a812a94 | 2018-03-23 11:52:32 -0700 | [diff] [blame] | 111 | defines = [ "PERFETTO_IMPLEMENTATION" ] |
| 112 | |
Oystein Eftevaag | f7a0d7e | 2018-01-12 13:02:43 -0800 | [diff] [blame] | 113 | if (build_with_chromium) { |
Oystein Eftevaag | a812a94 | 2018-03-23 11:52:32 -0700 | [diff] [blame] | 114 | if (is_component_build) { |
| 115 | defines += [ "PERFETTO_SHARED_LIBRARY" ] |
| 116 | } |
| 117 | |
| 118 | defines += [ "PERFETTO_BUILD_WITH_CHROMIUM" ] |
Oystein Eftevaag | f7a0d7e | 2018-01-12 13:02:43 -0800 | [diff] [blame] | 119 | |
| 120 | if (is_android) { |
| 121 | # Included for __android_log_print |
| 122 | libs = [ "log" ] |
| 123 | } |
| 124 | } |
| 125 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 126 | include_dirs = [ |
| 127 | "..", |
| 128 | "../include", |
| 129 | ] |
| 130 | } |
Oystein Eftevaag | 5e8a4eb | 2018-01-09 11:41:58 -0800 | [diff] [blame] | 131 | |
| 132 | config("public_config") { |
Primiano Tucci | 20b760c | 2018-01-19 12:36:12 +0000 | [diff] [blame] | 133 | 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 Eftevaag | 5e8a4eb | 2018-01-09 11:41:58 -0800 | [diff] [blame] | 140 | } |
Florian Mayer | 3a3974e | 2018-01-24 11:37:29 +0000 | [diff] [blame] | 141 | |
| 142 | config("fuzzer_config") { |
Florian Mayer | 94aaf69 | 2018-01-29 16:29:02 +0000 | [diff] [blame] | 143 | ldflags = [ "-fsanitize=fuzzer" ] |
Florian Mayer | 3a3974e | 2018-01-24 11:37:29 +0000 | [diff] [blame] | 144 | } |