1# Copyright (c) 2023 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.
13import("//build/ohos.gni")
14import("//build/ohos/ace/ace.gni")
15import("//foundation/distributeddatamgr/preferences/preferences.gni")
16
17base_include = [
18  "${preferences_napi_path}/sendable_preferences/include",
19  "${preferences_base_path}/frameworks/common/include",
20]
21
22base_sources = [
23  "${preferences_napi_path}/sendable_preferences/src/entry_point.cpp",
24  "${preferences_napi_path}/sendable_preferences/src/napi_preferences.cpp",
25  "${preferences_napi_path}/sendable_preferences/src/napi_preferences_helper.cpp",
26]
27
28if (is_ohos) {
29  ohos_copy("preferences_declaration") {
30    sources = [ "./api" ]
31    outputs = [ target_out_dir + "/$target_name/" ]
32    module_source_dir = target_out_dir + "/$target_name"
33    module_install_name = ""
34    subsystem_name = "distributeddatamgr"
35    part_name = "preferences"
36  }
37
38  ohos_shared_library("sendablepreferences") {
39    branch_protector_ret = "pac_ret"
40    sanitize = {
41      boundary_sanitize = true
42      ubsan = true
43      cfi = true
44      cfi_cross_dso = true
45      debug = false
46    }
47    include_dirs = base_include
48    sources = base_sources
49    cflags_cc = [
50      "-std=c++17",
51      "-stdlib=libc++",
52    ]
53
54    deps = [
55      "${preferences_base_path}/interfaces/inner_api:native_preferences",
56      "${preferences_napi_path}/common:preferences_jscommon",
57    ]
58
59    external_deps = [
60      "ability_runtime:abilitykit_native",
61      "ability_runtime:napi_base_context",
62      "c_utils:utils",
63      "hilog:libhilog",
64      "napi:ace_napi",
65    ]
66
67    subsystem_name = "distributeddatamgr"
68    part_name = "preferences"
69    relative_install_dir = "module/data"
70  }
71}
72