Home | History | Annotate | Download | only in quipper
      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 filegroup {
     18     name: "quipper_data_proto",
     19     srcs: [
     20         "perf_data.proto",
     21     ],
     22 }
     23 filegroup {
     24     name: "quipper_stat_proto",
     25     srcs: [
     26         "perf_stat.proto",
     27     ],
     28 }
     29 
     30 cc_defaults {
     31     name: "libquipper_defaults",
     32     defaults: ["libsimpleperf_elf_read_static_reqs_defaults"],
     33 
     34     cflags: [
     35         "-Wno-unused",
     36         "-Wno-unused-parameter",
     37         "-Wno-missing-field-initializers",
     38         "-O3",
     39         "-g",
     40     ],
     41 
     42     srcs: [
     43         "address_mapper.cc",
     44         "binary_data_utils.cc",
     45         "buffer_reader.cc",
     46         "buffer_writer.cc",
     47         "data_reader.cc",
     48         "data_writer.cc",
     49         "dso_android.cc",               // Android-modified, rely on simpleperf/LLVM.
     50         "file_reader.cc",
     51         "file_utils.cc",
     52         "huge_page_deducer.cc",
     53         "androidbase/base/logging.cc",
     54         "perf_option_parser.cc",
     55         "perf_data_utils.cc",
     56         "perf_parser.cc",
     57         "perf_protobuf_io.cc",
     58         "perf_reader.cc",
     59         "perf_recorder.cc",
     60         "perf_serializer.cc",
     61         "perf_stat_parser.cc",
     62         "run_command.cc",
     63         "sample_info_reader.cc",
     64         "scoped_temp_path.cc",
     65         "string_utils.cc",
     66         // Protos.
     67         ":quipper_data_proto",
     68         ":quipper_stat_proto",
     69     ],
     70     local_include_dirs: [
     71         "compat/non_cros",
     72         "androidbase",
     73     ],
     74     static_libs: [
     75         "libbase",
     76         "libsimpleperf_elf_read",
     77     ],
     78     whole_static_libs: [
     79         "libcrypto",  // For MD5.
     80     ],
     81 
     82     export_include_dirs: [
     83         ".",
     84         "androidbase",
     85     ],
     86     proto: {
     87         canonical_path_from_root: true,
     88         export_proto_headers: true,
     89     },
     90 
     91     target: {
     92         darwin: {
     93             enabled: false,
     94         },
     95     },
     96 }
     97 
     98 cc_library_static {
     99     name: "libquipper",
    100     defaults: [ "libquipper_defaults" ],
    101     host_supported: true,
    102 
    103     proto: {
    104         type: "lite",
    105         canonical_path_from_root: false,
    106     },
    107     static_libs: [
    108         "libprotobuf-cpp-lite",
    109     ],
    110 }
    111 
    112 cc_library_static {
    113     name: "libquipper-full",
    114     defaults: [ "libquipper_defaults" ],
    115     host_supported: true,
    116 
    117     srcs: [
    118         "conversion_utils.cc",
    119     ],
    120 
    121     proto: {
    122         type: "full",
    123     },
    124     shared_libs: [
    125         "libprotobuf-cpp-full",
    126     ],
    127 }
    128 
    129 cc_defaults {
    130     name: "quipper_test_defaults",
    131     defaults: ["libsimpleperf_elf_read_static_reqs_defaults"],
    132     host_supported: true,
    133     srcs: [
    134         // Independent test infra.
    135         "perf_test_files.cc",
    136         "test_perf_data.cc",
    137         "test_runner.cc",
    138     ],
    139     local_include_dirs: [
    140         "compat/non_cros",
    141     ],
    142     cflags: [
    143         "-Wno-ignored-qualifiers",
    144         "-Wno-missing-field-initializers",
    145         "-Wno-sign-compare",
    146         "-Wno-unused",
    147         "-Wno-unused-parameter",
    148     ],
    149     static_libs: [
    150         "libsimpleperf_elf_read",
    151     ],
    152     target: {
    153         darwin: {
    154             enabled: false,
    155         },
    156         windows: {
    157             enabled: false,
    158         }
    159     },
    160 }
    161 
    162 cc_defaults {
    163     name: "quipper_android_test_defaults",
    164     defaults: ["quipper_test_defaults"],
    165     srcs: [
    166         // Independent tests.
    167         "address_mapper_test.cc",
    168         "binary_data_utils_test.cc",
    169         "buffer_reader_test.cc",
    170         "buffer_writer_test.cc",
    171         "file_reader_test.cc",
    172         "perf_data_utils_test.cc",
    173         "perf_option_parser_test.cc",
    174         "perf_stat_parser_test.cc",
    175         "run_command_test.cc",
    176         "sample_info_reader_test.cc",
    177         "scoped_temp_path_test.cc",
    178     ],
    179 }
    180 
    181 cc_test {
    182     name: "quipper_unit_tests",
    183     defaults: [ "quipper_android_test_defaults" ],
    184     host_supported: true,
    185 
    186     static_libs: [
    187         "libbase",
    188         "liblog",
    189         "libprotobuf-cpp-lite",
    190         "libquipper",
    191     ],
    192 }
    193 
    194 cc_test {
    195     name: "quipper-full_unit_tests",
    196     defaults: [ "quipper_android_test_defaults" ],
    197     host_supported: true,
    198 
    199     srcs: [
    200         "test_utils.cc",
    201 
    202         "conversion_utils_test.cc",
    203         "perf_reader_test.cc",
    204         "perf_serializer_test.cc",
    205     ],
    206 
    207     static_libs: [
    208         "libquipper-full",
    209         "libutils",
    210     ],
    211     shared_libs: [
    212         "libbase",
    213         "liblog",
    214         "libprotobuf-cpp-full",
    215     ],
    216 
    217     target: {
    218         // Required for LLVM in libsimpleperf_elf_read.
    219         linux_glibc: {
    220             host_ldlibs: [
    221                 "-lncurses",
    222             ],
    223         },
    224     },
    225 }
    226 
    227 cc_test {
    228     name: "quipper_libelf_test",
    229     defaults: [ "quipper_test_defaults" ],
    230     device_supported: false,
    231     enabled: false,
    232 
    233     srcs: [
    234         "dso_test_utils.cc",
    235         "test_utils.cc",
    236 
    237         "dso_test.cc",
    238         "perf_parser_test.cc",
    239     ],
    240 
    241     static_libs: [
    242         "libcap",           // For cap_get_proc etc.
    243         "libelf",           // For gelf.h, elf_version, ...
    244         "libquipper-full",
    245         "libutils",
    246         "libz",             // For libelf.
    247     ],
    248     shared_libs: [
    249         "libbase",
    250         "libprotobuf-cpp-full",
    251     ],
    252 
    253     target: {
    254         // Required for LLVM in libsimpleperf_elf_read.
    255         linux_glibc: {
    256             host_ldlibs: [
    257                 "-lncurses",
    258             ],
    259         },
    260     },
    261 }
    262 
    263