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") |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 16 | import("proto_library.gni") |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 17 | |
Eric Seckler | 57c89d9 | 2018-10-26 15:11:55 +0100 | [diff] [blame] | 18 | # Used by base/gtest_prod_util.h for the FRIEND_TEST_* macros. Note that other |
| 19 | # production targets (i.e. testonly == false) should use base/gtest_prod_util.h |
| 20 | # instead. |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 21 | group("gtest_prod_config") { |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 22 | if (perfetto_build_standalone || perfetto_build_with_android) { |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 23 | public_configs = [ "//buildtools:googletest_prod_config" ] |
| 24 | } else { |
| 25 | public_configs = [ ":gtest_config" ] |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | config("gtest_config") { |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 30 | if (perfetto_build_with_embedder) { |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 31 | include_dirs = [ "//testing/gtest/include" ] |
| 32 | } |
| 33 | } |
| 34 | |
Eric Seckler | 57c89d9 | 2018-10-26 15:11:55 +0100 | [diff] [blame] | 35 | config("gmock_config") { |
| 36 | if (perfetto_build_with_embedder) { |
| 37 | include_dirs = [ "//testing/gmock/include" ] |
| 38 | } |
| 39 | } |
| 40 | |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 41 | group("gtest_deps") { |
| 42 | testonly = true |
| 43 | |
Eric Seckler | 57c89d9 | 2018-10-26 15:11:55 +0100 | [diff] [blame] | 44 | public_configs = [ |
| 45 | ":gtest_config", |
| 46 | ":gmock_config", |
| 47 | ] |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 48 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 49 | if (perfetto_build_standalone || perfetto_build_with_android) { |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 50 | public_deps = [ |
| 51 | "//buildtools:gmock", |
| 52 | "//buildtools:gtest", |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 53 | ] |
| 54 | } else { |
| 55 | public_deps = [ |
| 56 | "//testing/gmock", |
| 57 | "//testing/gtest", |
Florian Mayer | d8bd81b | 2018-01-25 12:49:15 +0000 | [diff] [blame] | 58 | ] |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | group("gtest_main") { |
| 63 | testonly = true |
| 64 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 65 | if (perfetto_build_standalone || perfetto_build_with_android) { |
Florian Mayer | d8bd81b | 2018-01-25 12:49:15 +0000 | [diff] [blame] | 66 | public_deps = [ |
| 67 | "//buildtools:gtest_main", |
| 68 | ] |
Eric Seckler | a6ba179 | 2019-01-02 12:51:00 +0000 | [diff] [blame] | 69 | } else if (build_with_chromium) { |
| 70 | public_deps = [ |
| 71 | "//base/test:run_all_unittests", |
| 72 | ] |
Florian Mayer | d8bd81b | 2018-01-25 12:49:15 +0000 | [diff] [blame] | 73 | } else { |
| 74 | public_deps = [ |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 75 | "//testing/gtest:gtest_main", |
| 76 | ] |
| 77 | } |
| 78 | } |
| 79 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 80 | # protoc compiler library, for building protoc plugins on the host. |
| 81 | if (current_toolchain == host_toolchain) { |
| 82 | group("protoc_lib_deps") { |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 83 | public_deps = [ |
| 84 | "${perfetto_protobuf_target_prefix}:protoc_lib", |
| 85 | ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 86 | } |
| 87 | } |
| 88 | |
| 89 | group("protobuf_full_deps") { |
Primiano Tucci | 20dc8f7 | 2018-10-23 12:28:29 +0100 | [diff] [blame] | 90 | testonly = true |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 91 | public_deps = [ |
| 92 | "${perfetto_protobuf_target_prefix}:protobuf_full", |
| 93 | ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 94 | } |
| 95 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 96 | # All targets should depend on this target to inherit the right flags and |
| 97 | # include directories. |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 98 | group("default_deps") { |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 99 | public_configs = [ ":default_config" ] |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 100 | if (perfetto_build_standalone || perfetto_build_with_android) { |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 101 | public_deps = [ |
Primiano Tucci | 7a40e4d | 2017-12-06 09:51:09 +0000 | [diff] [blame] | 102 | "//gn/standalone/libc++:deps", |
| 103 | "//gn/standalone/sanitizers:deps", |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 104 | ] |
| 105 | } |
| 106 | } |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 107 | |
| 108 | config("default_config") { |
Oystein Eftevaag | a812a94 | 2018-03-23 11:52:32 -0700 | [diff] [blame] | 109 | defines = [ "PERFETTO_IMPLEMENTATION" ] |
| 110 | |
Oystein Eftevaag | f7a0d7e | 2018-01-12 13:02:43 -0800 | [diff] [blame] | 111 | if (build_with_chromium) { |
Oystein Eftevaag | a812a94 | 2018-03-23 11:52:32 -0700 | [diff] [blame] | 112 | if (is_component_build) { |
| 113 | defines += [ "PERFETTO_SHARED_LIBRARY" ] |
| 114 | } |
| 115 | |
| 116 | defines += [ "PERFETTO_BUILD_WITH_CHROMIUM" ] |
Oystein Eftevaag | f7a0d7e | 2018-01-12 13:02:43 -0800 | [diff] [blame] | 117 | |
| 118 | if (is_android) { |
| 119 | # Included for __android_log_print |
| 120 | libs = [ "log" ] |
| 121 | } |
| 122 | } |
| 123 | |
Sami Kyostila | b16cb47 | 2018-11-13 16:10:02 +0000 | [diff] [blame] | 124 | # Disable debug log spam if we're embedded in a third-party project. |
| 125 | if (!perfetto_build_with_embedder) { |
| 126 | defines += [ "PERFETTO_ENABLE_DLOG" ] |
| 127 | } |
| 128 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 129 | include_dirs = [ |
| 130 | "..", |
| 131 | "../include", |
| 132 | ] |
| 133 | } |
Oystein Eftevaag | 5e8a4eb | 2018-01-09 11:41:58 -0800 | [diff] [blame] | 134 | |
| 135 | config("public_config") { |
Primiano Tucci | 20b760c | 2018-01-19 12:36:12 +0000 | [diff] [blame] | 136 | include_dirs = [ |
| 137 | "../include", |
| 138 | |
| 139 | # The below are needed due to generated protobuf headers including other |
| 140 | # headers with a path relative to the perfetto root. |
| 141 | "${root_gen_dir}/${perfetto_root_path}/protos", |
| 142 | ] |
Oystein Eftevaag | 5e8a4eb | 2018-01-09 11:41:58 -0800 | [diff] [blame] | 143 | } |
Florian Mayer | 3a3974e | 2018-01-24 11:37:29 +0000 | [diff] [blame] | 144 | |
Primiano Tucci | 0d72a31 | 2018-08-07 14:42:45 +0100 | [diff] [blame] | 145 | # For now JsonCpp is supported only in standalone builds outside of Android or |
| 146 | # Chromium. |
| 147 | group("jsoncpp_deps") { |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 148 | if (perfetto_build_standalone) { |
Primiano Tucci | 0d72a31 | 2018-08-07 14:42:45 +0100 | [diff] [blame] | 149 | public_configs = [ "//buildtools:jsoncpp_config" ] |
| 150 | public_deps = [ |
| 151 | "//buildtools:jsoncpp", |
| 152 | ] |
| 153 | } |
| 154 | } |