1# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. 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 "../../plugins/api/include", 20 "../plugin_service/include", 21 "include", 22 "src", 23 "${OHOS_PROFILER_DIR}/device/services/ipc/include", 24 "${OHOS_PROFILER_DIR}/device/base/include", 25 "${OHOS_PROFILER_DIR}/interfaces/kits", 26 ] 27 if (current_toolchain != host_toolchain) { 28 cflags = [ "-DHAVE_HILOG" ] 29 } 30} 31 32ohos_source_set("profiler_service") { 33 part_name = "${OHOS_PROFILER_PART_NAME}" 34 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 35 sources = [ 36 "src/profiler_capability_manager.cpp", 37 "src/profiler_service.cpp", 38 "src/trace_file_helper.cpp", 39 "src/trace_file_reader.cpp", 40 "src/trace_file_writer.cpp", 41 ] 42 public_deps = [ 43 "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source", 44 "${OHOS_PROFILER_DIR}/protos/services:profiler_service_proto", 45 "${OHOS_PROFILER_DIR}/protos/types/plugins/hiperf_data:hiperf_data_cpp", 46 "${OHOS_PROFILER_DIR}/protos/types/plugins/native_hook:native_hook_cpp", 47 ] 48 public_configs = [ 49 ":profiler_service_config", 50 "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config", 51 ] 52 external_deps = [ 53 "abseil-cpp:absl_sync", 54 "bounds_checking_function:libsec_shared", 55 "c_utils:utils", 56 "grpc:grpc", 57 "grpc:grpcxx", 58 "openssl:libcrypto_shared", 59 "protobuf:protobuf_lite", 60 ] 61 if (current_toolchain != host_toolchain) { 62 external_deps += [ "hilog:libhilog_base" ] 63 } 64 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 65} 66 67ohos_prebuilt_etc("hiprofilerd.cfg") { 68 source = "../../etc/hiprofilerd.cfg" 69 relative_install_dir = "init" 70 part_name = "${OHOS_PROFILER_PART_NAME}" 71 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 72} 73 74ohos_prebuilt_etc("hiprofiler.para") { 75 source = "../../etc/hiprofiler.para" 76 relative_install_dir = "param" 77 part_name = "${OHOS_PROFILER_PART_NAME}" 78 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 79} 80 81ohos_prebuilt_etc("hiprofiler.para.dac") { 82 source = "../../etc/hiprofiler.para.dac" 83 relative_install_dir = "param" 84 part_name = "${OHOS_PROFILER_PART_NAME}" 85 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 86} 87 88ohos_executable("hiprofilerd") { 89 sources = [ "src/main.cpp" ] 90 deps = [ 91 ":hiprofiler.para", 92 ":hiprofiler.para.dac", 93 ":hiprofilerd.cfg", 94 ":profiler_service", 95 "../../base:hiprofiler_base", 96 "../plugin_service:hiprofiler_plugin_service", 97 ] 98 if (current_toolchain != host_toolchain) { 99 external_deps = [ 100 "abseil-cpp:absl_cord", 101 "abseil-cpp:absl_log", 102 "abseil-cpp:absl_sync", 103 "bounds_checking_function:libsec_shared", 104 "c_utils:utils", 105 "grpc:gpr", 106 "grpc:grpc", 107 "grpc:grpcxx", 108 "hilog:libhilog_base", 109 "openssl:libcrypto_shared", 110 "protobuf:protobuf_lite", 111 ] 112 } 113 install_enable = true 114 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 115 part_name = "${OHOS_PROFILER_PART_NAME}" 116} 117