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("shared_memory_config") {
18  include_dirs = [
19    "include",
20    "../../base/include",
21    "${OHOS_PROFILER_DIR}/interfaces/kits",
22  ]
23}
24
25ohos_source_set("shared_memory_source") {
26  sources = [
27    "src/share_memory_allocator.cpp",
28    "src/share_memory_block.cpp",
29  ]
30  public_configs = [
31    ":shared_memory_config",
32    "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config",
33  ]
34
35  if (current_toolchain != host_toolchain) {
36    defines = [ "HAVE_HILOG" ]
37    external_deps = [
38      "bounds_checking_function:libsec_shared",
39      "c_utils:utils",
40      "hilog:libhilog_base",
41      "protobuf:protobuf_lite",
42    ]
43  }
44  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
45  part_name = "${OHOS_PROFILER_PART_NAME}"
46}
47
48ohos_shared_library("shared_memory") {
49  deps = [ ":shared_memory_source" ]
50  if (current_toolchain != host_toolchain) {
51    defines = [ "HAVE_HILOG" ]
52    external_deps = [
53      "c_utils:utils",
54      "hilog:libhilog_base",
55      "protobuf:protobuf_lite",
56    ]
57  }
58  install_enable = true
59  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
60  part_name = "${OHOS_PROFILER_PART_NAME}"
61}
62
63ohos_static_library("shared_memory_lite") {
64  sources = [
65    "src/share_memory_allocator.cpp",
66    "src/share_memory_block.cpp",
67  ]
68  public_configs = [
69    ":shared_memory_config",
70    "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config",
71  ]
72
73  defines = [ "NO_PROTOBUF" ]
74
75  if (current_toolchain != host_toolchain) {
76    defines += [ "HAVE_HILOG" ]
77    external_deps = [
78      "c_utils:utils",
79      "hilog:libhilog_base",
80    ]
81  }
82
83  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
84  part_name = "${OHOS_PROFILER_PART_NAME}"
85}
86