1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//base/hiviewdfx/hitrace/hitrace.gni")
15import("//build/ohos.gni")
16
17config("libhitrace_pub_config") {
18  visibility = [ ":*" ]
19
20  include_dirs = [ "include" ]
21}
22
23ohos_shared_library("libhitracechain") {
24  branch_protector_ret = "pac_ret"
25  public_configs = [ ":libhitrace_pub_config" ]
26
27  deps = [ "$hitrace_frameworks_path/native:hitracechain_source" ]
28
29  cflags = [ "-fstack-protector-strong" ]
30
31  if (defined(ohos_lite)) {
32    external_deps = [ "hilog_lite:hilog_lite" ]
33  } else {
34    external_deps = [ "hilog:libhilog" ]
35  }
36
37  output_extension = "so"
38  if (build_public_version) {
39    install_enable = true
40  } else {
41    install_enable = false
42  }
43
44  innerapi_tags = [
45    "chipsetsdk_indirect",
46    "platformsdk",
47  ]
48
49  version_script = "libhitracechain.map"
50
51  install_images = [
52    "system",
53    "updater",
54  ]
55
56  part_name = "hitrace"
57  subsystem_name = "hiviewdfx"
58}
59
60config("hitrace_meter_config") {
61  visibility = [ ":*" ]
62  include_dirs = [ "include/hitrace_meter" ]
63}
64
65ohos_static_library("hitrace_inner") {
66  branch_protector_ret = "pac_ret"
67  include_dirs = [
68    "include/hitrace_meter",
69    "include",
70    "$hitrace_frameworks_path/include/",
71  ]
72  sources = [
73    "src/hitrace_meter.cpp",
74    "src/hitrace_meter_c.c",
75    "src/hitrace_meter_wrapper.cpp",
76  ]
77
78  external_deps = [
79    "bounds_checking_function:libsec_shared",
80    "init:libbeget_proxy",
81    "init:libbegetutil",
82  ]
83
84  if (defined(ohos_lite)) {
85    external_deps += [ "hilog_lite:hilog_lite" ]
86  } else {
87    external_deps += [ "hilog:libhilog" ]
88  }
89
90  part_name = "hitrace"
91  subsystem_name = "hiviewdfx"
92}
93
94config("hitrace_dump_config") {
95  visibility = [ ":*" ]
96  include_dirs = [ "include" ]
97}
98
99ohos_shared_library("hitrace_dump") {
100  include_dirs = [
101    "include",
102    "$hitrace_cmd_path/include",
103    "$hitrace_frameworks_path/include",
104    "$hitrace_utils_path",
105  ]
106  public_configs = [ ":hitrace_dump_config" ]
107  sources = [
108    "$hitrace_cmd_path/src/hitrace_osal.cpp",
109    "$hitrace_frameworks_path/native/common_utils.cpp",
110    "$hitrace_frameworks_path/native/dynamic_buffer.cpp",
111    "src/hitrace_dump.cpp",
112  ]
113
114  if (hitrace_double_tracebuffer_size) {
115    defines = [ "DOUBLE_TRACEBUFFER_ENABLE" ]
116  }
117
118  deps = [
119    ":hitrace_meter",
120    "$hitrace_config_path:hitrace_tags",
121    "$hitrace_utils_path:hitrace_utils",
122  ]
123
124  external_deps = [
125    "bounds_checking_function:libsec_shared",
126    "cJSON:cjson",
127    "init:libbegetutil",
128  ]
129
130  if (defined(ohos_lite)) {
131    external_deps += [ "hilog_lite:hilog_lite" ]
132  } else {
133    external_deps += [ "hilog:libhilog" ]
134  }
135  version_script = "hitrace.map"
136  innerapi_tags = [ "platformsdk" ]
137  part_name = "hitrace"
138  subsystem_name = "hiviewdfx"
139}
140
141ohos_shared_library("hitrace_meter") {
142  branch_protector_ret = "pac_ret"
143  public_configs = [ ":hitrace_meter_config" ]
144  deps = [
145    ":hitrace_etc",
146    ":hitrace_inner",
147    ":libhitracechain",
148  ]
149
150  external_deps = [ "bounds_checking_function:libsec_shared" ]
151  if (defined(ohos_lite)) {
152    external_deps += [ "hilog_lite:hilog_lite" ]
153  } else {
154    external_deps += [ "hilog:libhilog" ]
155  }
156  version_script = "hitrace.map"
157  output_extension = "so"
158
159  innerapi_tags = [
160    "chipsetsdk",
161    "platformsdk",
162    "sasdk",
163  ]
164  part_name = "hitrace"
165  install_images = [
166    "system",
167    "updater",
168  ]
169  subsystem_name = "hiviewdfx"
170}
171
172ohos_prebuilt_etc("hitrace.para") {
173  source = "hitrace.para"
174  install_images = [
175    "system",
176    "updater",
177  ]
178  module_install_dir = "etc/param"
179  part_name = "hitrace"
180  subsystem_name = "hiviewdfx"
181}
182
183ohos_prebuilt_etc("hitrace.para.dac") {
184  source = "hitrace.para.dac"
185  install_images = [
186    "system",
187    "updater",
188  ]
189  module_install_dir = "etc/param"
190  part_name = "hitrace"
191  subsystem_name = "hiviewdfx"
192}
193
194group("hitrace_etc") {
195  deps = [
196    ":hitrace.para",
197    ":hitrace.para.dac",
198  ]
199}
200