1# Copyright (c) 2022-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("hitrace_osal_inner_config") { 18 visibility = [ ":*" ] 19 include_dirs = [ 20 "include", 21 "$hitrace_interfaces_path/native/innerkits/include/hitrace_meter", 22 "$hitrace_interfaces_path/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 subsystem_name = "hiviewdfx" 31 part_name = "hitrace" 32} 33 34ohos_executable("hitrace") { 35 install_enable = true 36 37 include_dirs = [ 38 "include", 39 "$hitrace_frameworks_path/include/", 40 "$hitrace_interfaces_path/native/innerkits/include/hitrace_meter", 41 ] 42 43 sources = [ 44 "$hitrace_frameworks_path/native/common_utils.cpp", 45 "src/hitrace_cmd.cpp", 46 ] 47 48 deps = [ 49 ":hitrace_osal_inner", 50 "$hitrace_config_path:hitrace_tags", 51 ] 52 53 external_deps = [ 54 "bounds_checking_function:libsec_shared", 55 "cJSON:cjson", 56 "zlib:libz", 57 ] 58 59 if (defined(ohos_lite)) { 60 external_deps += [ "hilog_lite:hilog_lite" ] 61 } else { 62 external_deps += [ "hilog:libhilog" ] 63 } 64 65 if (device_company != "qemu" && hitrace_support_executable_file) { 66 external_deps += [ "hiview:libucollection_client" ] 67 } 68 69 symlink_target_name = [ "bytrace" ] 70 71 subsystem_name = "hiviewdfx" 72 part_name = "hitrace" 73} 74 75ohos_prebuilt_etc("hitrace.cfg") { 76 source = "config/hitrace.cfg" 77 relative_install_dir = "init" 78 subsystem_name = "hiviewdfx" 79 part_name = "hitrace" 80} 81 82ohos_executable("hitrace_example") { 83 sources = [ "example/hitrace_example.cpp" ] 84 deps = [ "$hitrace_interfaces_path/native/innerkits:hitrace_meter" ] 85 86 if (defined(ohos_lite)) { 87 external_deps = [ "hilog_lite:hilog_lite" ] 88 } else { 89 external_deps = [ "hilog:libhilog" ] 90 } 91 install_enable = false 92 subsystem_name = "hiviewdfx" 93 part_name = "hitrace" 94} 95 96ohos_rust_executable("hitrace_example_rust") { 97 sources = [ "example/rust/main.rs" ] 98 99 deps = [ 100 "$hitrace_interfaces_path/rust/innerkits/hitrace_meter:hitrace_meter_rust", 101 ] 102 install_enable = false 103 subsystem_name = "hiviewdfx" 104 part_name = "hitrace" 105} 106 107group("hitrace_target") { 108 if (device_company != "qemu" && hitrace_support_executable_file) { 109 deps = [ 110 ":hitrace", 111 ":hitrace_example", 112 ] 113 } 114} 115