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