1# Copyright (C) 2018 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("../../gn/perfetto.gni")
16
17# This GN file should not be referenced in chromium builds.
18assert(!build_with_chromium)
19
20# This target is supported only in in-tree builds of Android. It contains
21# code that is not NDK-clean and references other repos in the Android tree.
22# perfetto_build_with_android is only true when running the GN -> Android.bp
23# build file translator //tools/gen_android_bp .
24if (perfetto_build_with_android) {
25  shared_library("libperfetto_android_internal") {
26    deps = [
27      ":headers",
28      "../../gn:default_deps",
29    ]
30    sources = [
31      "atrace_hal.cc",
32      "health_hal.cc",
33      "incident_service.cc",
34      "power_stats.cc",
35      "statsd_logging.cc",
36      "tracing_service_proxy.cc",
37    ]
38    libs = [
39      "android.hardware.health@2.0",
40      "android.hardware.power.stats@1.0",
41      "android.hardware.power.stats-V1-cpp",
42      "android.hardware.atrace@1.0",
43      "statslog_perfetto",
44      "statssocket",
45      "cutils",
46      "base",
47      "binder",
48      "log",
49      "hidlbase",
50      "incident",
51      "services",
52      "tracingproxy",
53      "utils",
54    ]
55
56    # This target should never depend on any other perfetto target to avoid ODR
57    # violation by doubly linking code in two .so(s) loaded in the same exe.
58    assert_no_deps = [
59      "//include/*",
60      "//src/base/*",
61      "//src/tracing/*",
62    ]
63  }
64}  # if (perfetto_build_with_android)
65
66source_set("headers") {
67  deps = [
68    "../../gn:default_deps",
69    "../android_stats:perfetto_atoms",
70  ]
71  sources = [
72    "atrace_hal.h",
73    "health_hal.h",
74    "incident_service.h",
75    "power_stats.h",
76    "statsd_logging.h",
77    "tracing_service_proxy.h",
78  ]
79}
80
81source_set("lazy_library_loader") {
82  public_deps = [ ":headers" ]
83  deps = [
84    "../../gn:default_deps",
85    "../../src/base",
86  ]
87  sources = [
88    "lazy_library_loader.cc",
89    "lazy_library_loader.h",
90  ]
91  if (!is_win) {
92    libs = [ "dl" ]
93  }
94}
95