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