1# Copyright (c) 2022 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("//build/ohos/ndk/ndk.gni")
16
17config("libpurgeable_config") {
18  include_dirs = [
19    "c/include",
20    "common/include",
21    "cpp/include",
22    "interfaces/kits/c",
23  ]
24  cflags_cc = [ "-fexceptions" ]
25}
26
27ohos_shared_library("libpurgeablemem") {
28  sources = [
29    "c/src/purgeable_mem_builder_c.c",
30    "c/src/purgeable_mem_c.c",
31    "c/src/purgeable_memory.c",
32    "common/src/pm_state_c.c",
33    "common/src/ux_page_table_c.c",
34    "cpp/src/purgeable_ashmem.cpp",
35    "cpp/src/purgeable_mem.cpp",
36    "cpp/src/purgeable_mem_base.cpp",
37    "cpp/src/purgeable_mem_builder.cpp",
38    "cpp/src/ux_page_table.cpp",
39  ]
40  include_dirs = [ "include" ]
41  external_deps = [
42    "c_utils:utils",
43    "hilog:libhilog",
44    "hitrace:hitrace_meter",
45    "init:libbegetutil",
46    "ipc:ipc_core",
47  ]
48  public_configs = [ ":libpurgeable_config" ]
49  subsystem_name = "commonlibrary"
50  part_name = "memory_utils"
51
52  sanitize = {
53    cfi = true
54    cfi_cross_dso = true
55    debug = false
56  }
57  branch_protector_ret = "pac_ret"
58}
59
60ohos_shared_library("purgeable_memory_ndk") {
61  include_dirs = [ "interfaces/kits/c" ]
62
63  sources = [ "c/src/purgeable_memory.c" ]
64  deps = [ ":libpurgeablemem" ]
65  external_deps = [
66    "c_utils:utils",
67    "hilog:libhilog",
68  ]
69
70  relative_install_dir = "ndk"
71  subsystem_name = "commonlibrary"
72  part_name = "memory_utils"
73
74  sanitize = {
75    cfi = true
76    cfi_cross_dso = true
77    debug = false
78  }
79  branch_protector_ret = "pac_ret"
80}
81