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", 60 "protobuf:protobuf_lite", 61 ] 62 if (current_toolchain != host_toolchain) { 63 external_deps += [ "hilog:libhilog_base" ] 64 } 65 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 66} 67 68ohos_prebuilt_etc("hiprofilerd.cfg") { 69 source = "../../etc/hiprofilerd.cfg" 70 relative_install_dir = "init" 71 part_name = "${OHOS_PROFILER_PART_NAME}" 72 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 73} 74 75ohos_prebuilt_etc("hiprofiler.para") { 76 source = "../../etc/hiprofiler.para" 77 relative_install_dir = "param" 78 part_name = "${OHOS_PROFILER_PART_NAME}" 79 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 80} 81 82ohos_prebuilt_etc("hiprofiler.para.dac") { 83 source = "../../etc/hiprofiler.para.dac" 84 relative_install_dir = "param" 85 part_name = "${OHOS_PROFILER_PART_NAME}" 86 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 87} 88 89ohos_executable("hiprofilerd") { 90 sources = [ "src/main.cpp" ] 91 deps = [ 92 ":hiprofiler.para", 93 ":hiprofiler.para.dac", 94 ":hiprofilerd.cfg", 95 ":profiler_service", 96 "../../base:hiprofiler_base", 97 "../plugin_service:hiprofiler_plugin_service", 98 ] 99 if (current_toolchain != host_toolchain) { 100 external_deps = [ 101 "abseil-cpp:absl_sync", 102 "bounds_checking_function:libsec_shared", 103 "c_utils:utils", 104 "grpc:gpr", 105 "grpc:grpc", 106 "grpc:grpcxx", 107 "hilog:libhilog_base", 108 "openssl:libcrypto_shared", 109 "protobuf:protobuf_lite", 110 ] 111 } 112 install_enable = true 113 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 114 part_name = "${OHOS_PROFILER_PART_NAME}" 115} 116