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("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 "//third_party/bounds_checking_function/include", 40 "//third_party/openssl/include", 41 ] 42 sources = [ 43 "src/buffer_writer.cpp", 44 "src/command_poller.cpp", 45 "src/plugin_manager.cpp", 46 "src/plugin_module.cpp", 47 "src/plugin_watcher.cpp", 48 "src/writer_adapter.cpp", 49 ] 50 public_deps = [ 51 "${OHOS_PROFILER_DIR}/device/services/shared_memory:shared_memory", 52 "${OHOS_PROFILER_DIR}/protos/services:plugin_service_proto", 53 "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source", 54 "../../base:hiprofiler_base", 55 "//third_party/bounds_checking_function:libsec_static", 56 "//third_party/openssl:libcrypto_shared", 57 ] 58 public_configs = [ 59 ":hiprofiler_plugins_config", 60 "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config", 61 ] 62 if (current_toolchain != host_toolchain) { 63 external_deps = [ "hilog:libhilog" ] 64 } 65 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 66} 67 68ohos_prebuilt_etc("hiprofiler_plugins.cfg") { 69 source = "../../etc/hiprofiler_plugins.cfg" 70 relative_install_dir = "init" 71 part_name = "${OHOS_PROFILER_PART_NAME}" 72 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 73} 74 75ohos_executable("hiprofiler_plugins") { 76 deps = [ 77 ":hiprofiler_plugins.cfg", 78 ":plugins_sources", 79 ] 80 sources = [ "src/main.cpp" ] 81 if (current_toolchain != host_toolchain) { 82 defines = [ "HAVE_HILOG" ] 83 external_deps = [ "hilog:libhilog" ] 84 } 85 install_enable = true 86 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 87 part_name = "${OHOS_PROFILER_PART_NAME}" 88} 89