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_data_repeater.cpp", 38 "src/profiler_service.cpp", 39 "src/trace_file_helper.cpp", 40 "src/trace_file_reader.cpp", 41 "src/trace_file_writer.cpp", 42 ] 43 public_deps = [ 44 "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source", 45 "${OHOS_PROFILER_DIR}/protos/services:profiler_service_proto", 46 "${OHOS_PROFILER_DIR}/protos/types/plugins/hiperf_data:hiperf_data_cpp", 47 "${OHOS_PROFILER_DIR}/protos/types/plugins/native_hook:native_hook_cpp", 48 ] 49 public_configs = [ 50 ":profiler_service_config", 51 "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config", 52 ] 53 external_deps = [ 54 "bounds_checking_function:libsec_shared", 55 "grpc:grpc", 56 "grpc:grpcxx", 57 "openssl:libcrypto_shared", 58 "protobuf:protobuf", 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_sync", 101 "bounds_checking_function:libsec_shared", 102 "grpc:gpr", 103 "grpc:grpc", 104 "grpc:grpcxx", 105 "hilog:libhilog_base", 106 "openssl:libcrypto_shared", 107 "protobuf:protobuf_lite", 108 ] 109 } 110 install_enable = true 111 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 112 part_name = "${OHOS_PROFILER_PART_NAME}" 113} 114