1# Copyright (c) 2021-2024 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 = [ 21 "include", 22 "include/hitrace", 23 ] 24} 25 26ohos_shared_library("libhitracechain") { 27 branch_protector_ret = "pac_ret" 28 public_configs = [ ":libhitrace_pub_config" ] 29 30 deps = [ "$hitrace_frameworks_path/native:hitracechain_source" ] 31 32 cflags = [ "-fstack-protector-strong" ] 33 34 if (defined(ohos_lite)) { 35 external_deps = [ "hilog_lite:hilog_lite" ] 36 } else { 37 external_deps = [ "hilog:libhilog" ] 38 } 39 40 output_extension = "so" 41 install_enable = true 42 43 innerapi_tags = [ 44 "chipsetsdk", 45 "platformsdk", 46 ] 47 48 version_script = "libhitracechain.map" 49 50 install_images = [ 51 "system", 52 "updater", 53 ] 54 55 part_name = "hitrace" 56 subsystem_name = "hiviewdfx" 57} 58 59config("hitrace_meter_config") { 60 visibility = [ ":*" ] 61 include_dirs = [ 62 "include/hitrace_meter", 63 "$hitrace_utils_path", 64 ] 65} 66 67ohos_static_library("hitrace_inner") { 68 branch_protector_ret = "pac_ret" 69 include_dirs = [ 70 "$hitrace_common_path", 71 "include/hitrace_meter", 72 "include", 73 "$hitrace_frameworks_path/include/", 74 "$hitrace_utils_path", 75 ] 76 sources = [ 77 "src/hitrace_meter.cpp", 78 "src/hitrace_meter_c.c", 79 "src/hitrace_meter_wrapper.cpp", 80 ] 81 82 external_deps = [ 83 "bounds_checking_function:libsec_shared", 84 "init:libbeget_proxy", 85 "init:libbegetutil", 86 ] 87 88 if (defined(ohos_lite)) { 89 external_deps += [ "hilog_lite:hilog_lite" ] 90 } else { 91 external_deps += [ "hilog:libhilog" ] 92 } 93 94 part_name = "hitrace" 95 subsystem_name = "hiviewdfx" 96} 97 98config("hitrace_dump_config") { 99 visibility = [ ":*" ] 100 include_dirs = [ "include" ] 101} 102 103ohos_shared_library("hitrace_dump") { 104 include_dirs = [ 105 "include", 106 "$hitrace_common_path", 107 "$hitrace_cmd_path/include", 108 "$hitrace_frameworks_path/include", 109 "$hitrace_utils_path", 110 ] 111 public_configs = [ ":hitrace_dump_config" ] 112 sources = [ 113 "$hitrace_frameworks_path/native/dynamic_buffer.cpp", 114 "src/hitrace_dump.cpp", 115 ] 116 defines = [] 117 118 if (hitrace_snapshot_tracebuffer_size != 0) { 119 defines += 120 [ "SNAPSHOT_TRACEBUFFER_SIZE=${hitrace_snapshot_tracebuffer_size}" ] 121 } 122 if (hitrace_snapshot_file_limit != 0) { 123 defines += [ "SNAPSHOT_FILE_LIMIT=${hitrace_snapshot_file_limit}" ] 124 } 125 if (hitrace_record_file_limit != 0) { 126 defines += [ "RECORD_FILE_LIMIT=${hitrace_record_file_limit}" ] 127 } 128 129 deps = [ 130 ":hitrace_meter", 131 "$hitrace_config_path:hitrace_tags", 132 "$hitrace_utils_path:hitrace_common_utils", 133 "$hitrace_utils_path:hitrace_file_utils", 134 "$hitrace_utils_path:hitrace_json_parser", 135 ] 136 137 external_deps = [ 138 "bounds_checking_function:libsec_shared", 139 "init:libbegetutil", 140 ] 141 142 if (defined(ohos_lite)) { 143 external_deps += [ "hilog_lite:hilog_lite" ] 144 } else { 145 external_deps += [ "hilog:libhilog" ] 146 } 147 version_script = "hitrace.map" 148 innerapi_tags = [ "platformsdk" ] 149 part_name = "hitrace" 150 subsystem_name = "hiviewdfx" 151} 152 153ohos_shared_library("hitrace_meter") { 154 branch_protector_ret = "pac_ret" 155 public_configs = [ ":hitrace_meter_config" ] 156 deps = [ 157 ":hitrace_etc", 158 ":hitrace_inner", 159 ":libhitracechain", 160 "$hitrace_utils_path:hitrace_common_utils", 161 ] 162 163 external_deps = [ "bounds_checking_function:libsec_shared" ] 164 if (defined(ohos_lite)) { 165 external_deps += [ "hilog_lite:hilog_lite" ] 166 } else { 167 external_deps += [ "hilog:libhilog" ] 168 } 169 version_script = "hitrace.map" 170 output_extension = "so" 171 172 innerapi_tags = [ 173 "chipsetsdk", 174 "platformsdk", 175 "sasdk", 176 ] 177 part_name = "hitrace" 178 install_images = [ 179 "system", 180 "updater", 181 ] 182 subsystem_name = "hiviewdfx" 183} 184 185ohos_prebuilt_etc("hitrace.para") { 186 source = "hitrace.para" 187 install_images = [ 188 "system", 189 "updater", 190 ] 191 module_install_dir = "etc/param" 192 part_name = "hitrace" 193 subsystem_name = "hiviewdfx" 194} 195 196ohos_prebuilt_etc("hitrace.para.dac") { 197 source = "hitrace.para.dac" 198 install_images = [ 199 "system", 200 "updater", 201 ] 202 module_install_dir = "etc/param" 203 part_name = "hitrace" 204 subsystem_name = "hiviewdfx" 205} 206 207group("hitrace_etc") { 208 deps = [ 209 ":hitrace.para", 210 ":hitrace.para.dac", 211 ] 212} 213