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("hiprofiler_plugins_config") { 18 include_dirs = [ 19 "./include", 20 "./src", 21 "../../base/include/", 22 "${OHOS_PROFILER_DIR}/device/services/ipc/include", 23 "${OHOS_PROFILER_DIR}/device/services/shared_memory/include", 24 "${OHOS_PROFILER_DIR}/interfaces/kits", 25 ] 26 cflags = [ "-pthread" ] 27 if (current_toolchain != host_toolchain) { 28 cflags += [ "-DHAVE_HILOG" ] 29 } 30} 31 32ohos_source_set("plugins_sources") { 33 part_name = "${OHOS_PROFILER_PART_NAME}" 34 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 35 include_dirs = [ 36 "./include", 37 "../../base/include/", 38 "${OHOS_PROFILER_DIR}/interfaces/kits", 39 ] 40 sources = [ 41 "src/buffer_writer.cpp", 42 "src/command_poller.cpp", 43 "src/plugin_manager.cpp", 44 "src/plugin_module.cpp", 45 "src/plugin_watcher.cpp", 46 "src/writer_adapter.cpp", 47 ] 48 public_deps = [ 49 "${OHOS_PROFILER_DIR}/device/plugins/ffrt_profiler/service:ffrt_profiler_service", 50 "${OHOS_PROFILER_DIR}/device/plugins/network_profiler/service:network_profiler_service", 51 "${OHOS_PROFILER_DIR}/device/services/shared_memory:shared_memory_source", 52 "${OHOS_PROFILER_DIR}/proto_encoder:proto_encoder_source", 53 "${OHOS_PROFILER_DIR}/protos/services:plugin_service_proto", 54 "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source", 55 "../../base:hiprofiler_base", 56 ] 57 public_configs = [ 58 ":hiprofiler_plugins_config", 59 "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config", 60 ] 61 if (current_toolchain != host_toolchain) { 62 external_deps = [ 63 "bounds_checking_function:libsec_shared", 64 "hilog:libhilog", 65 "openssl:libcrypto_shared", 66 "protobuf:protobuf_lite", 67 ] 68 } 69 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 70} 71 72ohos_prebuilt_etc("hiprofiler_plugins.cfg") { 73 source = "../../etc/hiprofiler_plugins.cfg" 74 relative_install_dir = "init" 75 part_name = "${OHOS_PROFILER_PART_NAME}" 76 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 77} 78 79ohos_executable("hiprofiler_plugins") { 80 deps = [ 81 ":hiprofiler_plugins.cfg", 82 ":plugins_sources", 83 ] 84 sources = [ "src/main.cpp" ] 85 if (current_toolchain != host_toolchain) { 86 defines = [ "HAVE_HILOG" ] 87 external_deps = [ 88 "bounds_checking_function:libsec_shared", 89 "hilog:libhilog", 90 "openssl:libcrypto_shared", 91 "protobuf:protobuf_lite", 92 ] 93 } 94 install_enable = true 95 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 96 part_name = "${OHOS_PROFILER_PART_NAME}" 97} 98