1# Copyright (c) 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("hitrace_osal_inner_config") { 18 visibility = [ ":*" ] 19 include_dirs = [ 20 "./include", 21 "../interfaces/native/innerkits/include/hitrace_meter", 22 "../interfaces/native/innerkits/include/", 23 ] 24} 25 26ohos_static_library("hitrace_osal_inner") { 27 sources = [ "./src/hitrace_osal.cpp" ] 28 public_configs = [ ":hitrace_osal_inner_config" ] 29 external_deps = [ "init:libbegetutil" ] 30 31 subsystem_name = "hiviewdfx" 32 part_name = "hitrace" 33} 34 35ohos_executable("hitrace") { 36 install_enable = true 37 38 sources = [ 39 "../frameworks/native/common_utils.cpp", 40 "./src/hitrace_cmd.cpp", 41 ] 42 43 deps = [ 44 ":hitrace_osal_inner", 45 "../config:hitrace_utils", 46 ] 47 48 external_deps = [] 49 50 if (defined(ohos_lite)) { 51 external_deps += [ "hilog_lite:hilog_lite" ] 52 } else { 53 external_deps += [ "hilog:libhilog" ] 54 } 55 56 if (device_company != "qemu" && support_executable_file) { 57 external_deps += [ "hiview:libucollection_client" ] 58 } 59 external_deps += [ 60 "bounds_checking_function:libsec_static", 61 "cJSON:cjson", 62 "zlib:libz", 63 ] 64 65 include_dirs = [ 66 "./include", 67 "../frameworks/include/", 68 "../interfaces/native/innerkits/include/hitrace_meter", 69 ] 70 subsystem_name = "hiviewdfx" 71 part_name = "hitrace" 72} 73 74ohos_executable("bytrace") { 75 install_enable = true 76 sources = [ 77 "../frameworks/native/common_utils.cpp", 78 "./src/hitrace_cmd.cpp", 79 ] 80 81 deps = [ 82 ":hitrace_osal_inner", 83 "../config:hitrace_utils", 84 ] 85 86 external_deps = [] 87 88 if (defined(ohos_lite)) { 89 external_deps += [ "hilog_lite:hilog_lite" ] 90 } else { 91 external_deps += [ "hilog:libhilog" ] 92 } 93 94 if (device_company != "qemu" && support_executable_file) { 95 external_deps += [ "hiview:libucollection_client" ] 96 } 97 external_deps += [ 98 "bounds_checking_function:libsec_static", 99 "cJSON:cjson", 100 "zlib:libz", 101 ] 102 103 include_dirs = [ 104 "./include", 105 "../frameworks/include/", 106 "../interfaces/native/innerkits/include/hitrace_meter", 107 ] 108 subsystem_name = "hiviewdfx" 109 part_name = "hitrace" 110} 111 112ohos_prebuilt_etc("hitrace.cfg") { 113 source = "./config/hitrace.cfg" 114 relative_install_dir = "init" 115 subsystem_name = "hiviewdfx" 116 part_name = "hitrace" 117} 118 119ohos_executable("hitrace_example") { 120 sources = [ "example/hitrace_example.cpp" ] 121 deps = [ "../interfaces/native/innerkits:hitrace_meter" ] 122 123 external_deps = [] 124 if (defined(ohos_lite)) { 125 external_deps += [ "hilog_lite:hilog_lite" ] 126 } else { 127 external_deps += [ "hilog:libhilog" ] 128 } 129 install_enable = false 130 subsystem_name = "hiviewdfx" 131 part_name = "hitrace" 132} 133 134ohos_rust_executable("hitrace_example_rust") { 135 sources = [ "example/rust/main.rs" ] 136 137 deps = [ "../interfaces/rust/innerkits/hitrace_meter:hitrace_meter_rust" ] 138 install_enable = false 139 subsystem_name = "hiviewdfx" 140 part_name = "hitrace" 141} 142 143group("hitrace_target") { 144 if (device_company != "qemu" && support_executable_file) { 145 deps = [ 146 ":bytrace", 147 ":hitrace", 148 ":hitrace_example", 149 ] 150 } 151} 152