1 // 2 // Copyright (C) 2018 The Android Open Source Project 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 cc_defaults { 18 name: "libquipper_defaults", 19 20 cflags: [ 21 "-Wno-unused", 22 "-Wno-unused-parameter", 23 "-Wno-missing-field-initializers", 24 "-O3", 25 "-g", 26 ], 27 28 srcs: [ 29 "address_mapper.cc", 30 "binary_data_utils.cc", 31 "buffer_reader.cc", 32 "buffer_writer.cc", 33 "data_reader.cc", 34 "data_writer.cc", 35 "dso_android.cc", // Android-modified, rely on simpleperf/LLVM. 36 "file_reader.cc", 37 "file_utils.cc", 38 "huge_page_deducer.cc", 39 "androidbase/base/logging.cc", 40 "perf_option_parser.cc", 41 "perf_data_utils.cc", 42 "perf_parser.cc", 43 "perf_protobuf_io.cc", 44 "perf_reader.cc", 45 "perf_recorder.cc", 46 "perf_serializer.cc", 47 "perf_stat_parser.cc", 48 "run_command.cc", 49 "sample_info_reader.cc", 50 "scoped_temp_path.cc", 51 "string_utils.cc", 52 // Protos. 53 "perf_data.proto", 54 "perf_stat.proto", 55 ], 56 local_include_dirs: [ 57 "compat/non_cros", 58 "androidbase", 59 ], 60 static_libs: [ 61 "libbase", 62 "libsimpleperf_elf_read", 63 ], 64 whole_static_libs: [ 65 "libcrypto", // For MD5. 66 ], 67 68 export_include_dirs: [ 69 ".", 70 "androidbase", 71 ], 72 proto: { 73 canonical_path_from_root: true, 74 export_proto_headers: true, 75 }, 76 77 target: { 78 darwin: { 79 enabled: false, 80 }, 81 }, 82 } 83 84 cc_library_static { 85 name: "libquipper", 86 defaults: [ "libquipper_defaults" ], 87 host_supported: true, 88 89 proto: { 90 type: "lite", 91 canonical_path_from_root: false, 92 }, 93 static_libs: [ 94 "libprotobuf-cpp-lite", 95 ], 96 } 97 98 cc_library_static { 99 name: "libquipper-full", 100 defaults: [ "libquipper_defaults" ], 101 host_supported: true, 102 103 srcs: [ 104 "conversion_utils.cc", 105 ], 106 107 proto: { 108 type: "full", 109 }, 110 shared_libs: [ 111 "libprotobuf-cpp-full", 112 ], 113 } 114 115 cc_defaults { 116 name: "quipper_test_defaults", 117 host_supported: true, 118 srcs: [ 119 // Independent test infra. 120 "perf_test_files.cc", 121 "test_perf_data.cc", 122 "test_runner.cc", 123 ], 124 local_include_dirs: [ 125 "compat/non_cros", 126 ], 127 cflags: [ 128 "-Wno-ignored-qualifiers", 129 "-Wno-missing-field-initializers", 130 "-Wno-sign-compare", 131 "-Wno-unused", 132 "-Wno-unused-parameter", 133 ], 134 static_libs: [ 135 "libsimpleperf_elf_read", 136 ], 137 target: { 138 darwin: { 139 enabled: false, 140 }, 141 windows: { 142 enabled: false, 143 } 144 }, 145 } 146 147 cc_defaults { 148 name: "quipper_android_test_defaults", 149 defaults: ["quipper_test_defaults"], 150 srcs: [ 151 // Independent tests. 152 "address_mapper_test.cc", 153 "binary_data_utils_test.cc", 154 "buffer_reader_test.cc", 155 "buffer_writer_test.cc", 156 "file_reader_test.cc", 157 "perf_data_utils_test.cc", 158 "perf_option_parser_test.cc", 159 "perf_stat_parser_test.cc", 160 "run_command_test.cc", 161 "sample_info_reader_test.cc", 162 "scoped_temp_path_test.cc", 163 ], 164 } 165 166 cc_test { 167 name: "quipper_unit_tests", 168 defaults: [ "quipper_android_test_defaults" ], 169 host_supported: true, 170 171 static_libs: [ 172 "libbase", 173 "liblog", 174 "libprotobuf-cpp-lite", 175 "libquipper", 176 ], 177 } 178 179 cc_test { 180 name: "quipper-full_unit_tests", 181 defaults: [ "quipper_android_test_defaults" ], 182 host_supported: true, 183 184 srcs: [ 185 "test_utils.cc", 186 187 "conversion_utils_test.cc", 188 "perf_reader_test.cc", 189 "perf_serializer_test.cc", 190 ], 191 192 static_libs: [ 193 "libquipper-full", 194 "libutils", 195 ], 196 shared_libs: [ 197 "libbase", 198 "libprotobuf-cpp-full", 199 ], 200 201 target: { 202 // Required for LLVM in libsimpleperf_elf_read. 203 linux_glibc: { 204 host_ldlibs: [ 205 "-lncurses", 206 ], 207 }, 208 }, 209 } 210 211 cc_test { 212 name: "quipper_libelf_test", 213 defaults: [ "quipper_test_defaults" ], 214 device_supported: false, 215 enabled: false, 216 217 srcs: [ 218 "dso_test_utils.cc", 219 "test_utils.cc", 220 221 "dso_test.cc", 222 "perf_parser_test.cc", 223 ], 224 225 static_libs: [ 226 "libcap", // For cap_get_proc etc. 227 "libelf", // For gelf.h, elf_version, ... 228 "libquipper-full", 229 "libutils", 230 "libz", // For libelf. 231 ], 232 shared_libs: [ 233 "libbase", 234 "libprotobuf-cpp-full", 235 ], 236 237 target: { 238 // Required for LLVM in libsimpleperf_elf_read. 239 linux_glibc: { 240 host_ldlibs: [ 241 "-lncurses", 242 ], 243 }, 244 }, 245 } 246 247