1# Copyright (c) 2021 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("//build/ohos.gni") 15import("../../base/config.gni") 16 17config("profiler_service_config") { 18 include_dirs = [ 19 "//commonlibrary/c_utils/base/include", 20 "../../plugins/api/include", 21 "../plugin_service/include", 22 "include", 23 "src", 24 "${OHOS_PROFILER_DIR}/device/services/ipc/include", 25 "${OHOS_PROFILER_DIR}/device/base/include", 26 "${OHOS_PROFILER_DIR}/interfaces/kits", 27 ] 28 if (current_toolchain != host_toolchain) { 29 cflags = [ "-DHAVE_HILOG" ] 30 } 31} 32 33ohos_source_set("profiler_service") { 34 part_name = "profiler" 35 sources = [ 36 "src/profiler_capability_manager.cpp", 37 "src/profiler_data_repeater.cpp", 38 "src/profiler_service.cpp", 39 "src/result_demuxer.cpp", 40 "src/trace_file_helper.cpp", 41 "src/trace_file_reader.cpp", 42 "src/trace_file_writer.cpp", 43 ] 44 public_deps = [ 45 "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source", 46 "${OHOS_PROFILER_DIR}/protos/services:profiler_service_proto", 47 "${OHOS_PROFILER_DIR}/protos/types/plugins/hiperf_data:hiperf_data_cpp", 48 "${OHOS_PROFILER_DIR}/protos/types/plugins/native_hook:native_hook_cpp", 49 ] 50 public_configs = [ 51 ":profiler_service_config", 52 "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config", 53 ] 54 if (current_toolchain != host_toolchain) { 55 if (build_l2) { 56 external_deps = [ "hilog:libhilog" ] 57 } else { 58 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 59 } 60 } 61} 62 63ohos_prebuilt_etc("hiprofilerd.cfg") { 64 source = "../../etc/hiprofilerd.cfg" 65 relative_install_dir = "init" 66 part_name = "${OHOS_PROFILER_PART_NAME}" 67 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 68} 69 70ohos_prebuilt_etc("hiprofiler.para") { 71 source = "../../etc/hiprofiler.para" 72 relative_install_dir = "param" 73 part_name = "${OHOS_PROFILER_PART_NAME}" 74 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 75} 76 77ohos_prebuilt_etc("hiprofiler.para.dac") { 78 source = "../../etc/hiprofiler.para.dac" 79 relative_install_dir = "param" 80 part_name = "${OHOS_PROFILER_PART_NAME}" 81 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 82} 83 84ohos_executable("hiprofilerd") { 85 sources = [ "src/main.cpp" ] 86 deps = [ 87 ":hiprofiler.para", 88 ":hiprofiler.para.dac", 89 ":hiprofilerd.cfg", 90 ":profiler_service", 91 "../../base:hiprofiler_base", 92 "../plugin_service:hiprofiler_plugin_service", 93 ] 94 if (current_toolchain != host_toolchain) { 95 if (build_l2) { 96 external_deps = [ "shared_library:libhilog" ] 97 } else { 98 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 99 } 100 } 101 install_enable = true 102 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 103 part_name = "${OHOS_PROFILER_PART_NAME}" 104} 105