xref: /aosp_15_r20/external/perfetto/src/android_internal/BUILD.gn (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
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.cc",
36      "statsd_logging.cc",
37      "tracing_service_proxy.cc",
38    ]
39    libs = [
40      "[email protected]",
41      "android.hardware.health-V2-ndk",
42      "[email protected]",
43      "android.hardware.power.stats-V1-cpp",
44      "[email protected]",
45      "statslog_perfetto",
46      "statssocket",
47      "cutils",
48      "base",
49      "binder",
50      "binder_ndk",
51      "log",
52      "hidlbase",
53      "incident",
54      "services",
55      "tracingproxy",
56      "utils",
57      "statspull",
58    ]
59
60    # This target should never depend on any other perfetto target to avoid ODR
61    # violation by doubly linking code in two .so(s) loaded in the same exe.
62    assert_no_deps = [
63      "../../include/*",
64      "../../src/base/*",
65      "../../src/tracing/*",
66    ]
67  }
68}  # if (perfetto_build_with_android)
69
70source_set("headers") {
71  deps = [
72    "../../gn:default_deps",
73    "../android_stats:perfetto_atoms",
74  ]
75  sources = [
76    "atrace_hal.h",
77    "health_hal.h",
78    "incident_service.h",
79    "power_stats.h",
80    "statsd.h",
81    "statsd_logging.h",
82    "tracing_service_proxy.h",
83  ]
84}
85
86source_set("lazy_library_loader") {
87  public_deps = [ ":headers" ]
88  deps = [
89    "../../gn:default_deps",
90    "../../src/base",
91  ]
92  sources = [
93    "lazy_library_loader.cc",
94    "lazy_library_loader.h",
95  ]
96  if (!is_win) {
97    libs = [ "dl" ]
98  }
99}
100