• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 = "profiler"
34  include_dirs = [
35    "./include",
36    "../../base/include/",
37    "${OHOS_PROFILER_DIR}/interfaces/kits",
38    "//third_party/bounds_checking_function/include",
39    "//third_party/openssl/include",
40  ]
41  sources = [
42    "src/buffer_writer.cpp",
43    "src/command_poller.cpp",
44    "src/plugin_manager.cpp",
45    "src/plugin_module.cpp",
46    "src/plugin_watcher.cpp",
47    "src/writer_adapter.cpp",
48  ]
49  public_deps = [
50    "${OHOS_PROFILER_DIR}/device/services/shared_memory:shared_memory",
51    "${OHOS_PROFILER_DIR}/protos/services:plugin_service_proto",
52    "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source",
53    "../../base:hiprofiler_base",
54    "//third_party/bounds_checking_function:libsec_static",
55    "//third_party/openssl:libcrypto_shared",
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    if (build_l2) {
63      external_deps = [ "shared_library:libhilog" ]
64    } else {
65      external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
66    }
67  }
68}
69
70ohos_prebuilt_etc("hiprofiler_plugins.cfg") {
71  source = "../../etc/hiprofiler_plugins.cfg"
72  relative_install_dir = "init"
73  part_name = "${OHOS_PROFILER_PART_NAME}"
74  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
75}
76
77ohos_executable("hiprofiler_plugins") {
78  deps = [
79    ":hiprofiler_plugins.cfg",
80    ":plugins_sources",
81  ]
82  sources = [ "src/main.cpp" ]
83  if (current_toolchain != host_toolchain) {
84    defines = [ "HAVE_HILOG" ]
85    if (build_l2) {
86      external_deps = [ "shared_library:libhilog" ]
87    } else {
88      external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
89    }
90  }
91  install_enable = true
92  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
93  part_name = "${OHOS_PROFILER_PART_NAME}"
94}
95