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