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