1# Copyright (c) Huawei Technologies Co., Ltd. 2023. 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("network_config") {
18  visibility = [ ":*" ]
19  include_dirs = [
20    "include",
21    "${OHOS_PROFILER_DIR}/device/plugins/network_profiler/service/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    "${OHOS_PROFILER_DIR}/device/plugins/api/include",
26    "${OHOS_PROFILER_DIR}/device/base/include",
27  ]
28  defines = [
29    "NO_PROTOBUF",
30    "HAVE_HILOG",
31  ]
32}
33
34ohos_shared_library("libnetwork_profiler") {
35  branch_protector_ret = "pac_ret"
36  output_name = "libnetwork_profiler"
37  public_configs = [ ":network_config" ]
38
39  sources = [
40    "src/network_profiler.cpp",
41    "src/network_profiler_socker_client.cpp",
42    "src/network_profiler_write.cpp",
43  ]
44
45  sources += [
46    "${OHOS_PROFILER_DIR}/device/base/src/epoll_event_poller.cpp",
47    "${OHOS_PROFILER_DIR}/device/base/src/event_notifier.cpp",
48    "${OHOS_PROFILER_DIR}/device/plugins/network_profiler/service/src/network_profiler_common.cpp",
49    "${OHOS_PROFILER_DIR}/device/services/ipc/src/client_connection.cpp",
50    "${OHOS_PROFILER_DIR}/device/services/ipc/src/service_entry.cpp",
51    "${OHOS_PROFILER_DIR}/device/services/ipc/src/socket_context.cpp",
52    "${OHOS_PROFILER_DIR}/device/services/ipc/src/unix_socket_client.cpp",
53    "${OHOS_PROFILER_DIR}/device/services/ipc/src/unix_socket_server.cpp",
54  ]
55
56  deps = [
57    "${OHOS_PROFILER_DIR}/device/services/shared_memory:shared_memory_lite",
58  ]
59
60  external_deps = [
61    "bounds_checking_function:libsec_shared",
62    "init:libbegetutil",
63  ]
64
65  defines = []
66  if (current_toolchain != host_toolchain) {
67    external_deps += [ "hilog:libhilog_base" ]
68  }
69
70  install_enable = true
71  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
72  part_name = "${OHOS_PROFILER_PART_NAME}"
73}
74