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.
13import("//build/ohos.gni")
14import("//foundation/distributeddatamgr/relational_store/relational_store.gni")
15
16config("appdatafwk_config") {
17  visibility = [ ":*" ]
18  include_dirs = [
19    "include",
20    "${relational_store_innerapi_path}/rdb/include",
21    "${relational_store_common_path}/include",
22  ]
23  if (!is_mingw && !is_mac) {
24    cflags_cc = [ "-fvisibility=hidden" ]
25  }
26}
27
28config("appdatafwk_public_config") {
29  visibility = [ ":*" ]
30  include_dirs = [
31    "include",
32    "${relational_store_innerapi_path}/rdb/include",
33    "${relational_store_common_path}/include",
34  ]
35}
36
37config("common_public_config") {
38  visibility = [ ":*" ]
39  include_dirs = [
40    "include",
41    "${relational_store_common_path}/include",
42    "//third_party/json/single_include",
43  ]
44}
45
46if (is_android || is_ios) {
47  ohos_source_set("relational_common_base") {
48    sources =
49        [ "${relational_store_native_path}/appdatafwk/src/serializable.cpp" ]
50
51    if (is_mingw || is_mac || is_ios) {
52      sources +=
53          [ "${relational_store_native_path}/appdatafwk/src/mingw_endian.cpp" ]
54    } else if (is_ohos || is_android) {
55      sources += [
56        "${relational_store_native_path}/appdatafwk/src/general_endian.cpp",
57      ]
58      cflags_cc = [ "-fvisibility=hidden" ]
59    }
60
61    configs = [
62      ":common_public_config",
63      ":appdatafwk_public_config",
64    ]
65
66    subsystem_name = "distributeddatamgr"
67    part_name = "relational_store"
68
69    public_configs = [ ":common_public_config" ]
70  }
71} else {
72  ohos_shared_library("relational_common_base") {
73    if (is_ohos) {
74      branch_protector_ret = "pac_ret"
75      sanitize = {
76        boundary_sanitize = true
77        ubsan = true
78        cfi = true
79        cfi_cross_dso = true
80        debug = false
81      }
82    }
83
84    sources =
85        [ "${relational_store_native_path}/appdatafwk/src/serializable.cpp" ]
86
87    if (is_mingw || is_mac || is_ios) {
88      sources +=
89          [ "${relational_store_native_path}/appdatafwk/src/mingw_endian.cpp" ]
90    } else if (is_ohos || is_android) {
91      sources += [
92        "${relational_store_native_path}/appdatafwk/src/general_endian.cpp",
93      ]
94      cflags_cc = [ "-fvisibility=hidden" ]
95    }
96
97    configs = [
98      ":common_public_config",
99      ":appdatafwk_public_config",
100    ]
101
102    subsystem_name = "distributeddatamgr"
103    part_name = "relational_store"
104
105    public_configs = [ ":common_public_config" ]
106  }
107}
108
109ohos_shared_library("native_appdatafwk") {
110  branch_protector_ret = "pac_ret"
111  sanitize = {
112    boundary_sanitize = true
113    ubsan = true
114    cfi = true
115    cfi_cross_dso = true
116    debug = false
117  }
118
119  sources =
120      [ "${relational_store_native_path}/appdatafwk/src/shared_block.cpp" ]
121
122  configs = [ ":appdatafwk_config" ]
123
124  subsystem_name = "distributeddatamgr"
125  innerapi_tags = [ "platformsdk_indirect" ]
126  part_name = "relational_store"
127
128  external_deps = [
129    "c_utils:utils",
130    "hilog:libhilog",
131    "ipc:ipc_single",
132  ]
133
134  public_configs = [ ":appdatafwk_public_config" ]
135}
136