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("distributeddb.gni")
15
16config("distrdb_config") {
17  visibility = [ ":*" ]
18  include_dirs = [
19    "include",
20    "interfaces/include",
21    "interfaces/include/cloud",
22    "interfaces/src",
23    "interfaces/src/relational",
24    "common/include",
25    "common/include/cloud",
26    "common/include/relational",
27    "common/src/cloud",
28    "communicator/include",
29    "storage/include",
30    "storage/src",
31    "storage/src/multiver",
32    "storage/src/operation",
33    "storage/src/gaussdb_rd",
34    "storage/src/sqlite",
35    "storage/src/sqlite/kv",
36    "storage/src/sqlite/relational",
37    "storage/src/upgrader",
38    "storage/src/cloud",
39    "storage/src/kv",
40    "storage/src/relational",
41    "syncer/include",
42    "syncer/src",
43    "syncer/src/cloud",
44    "syncer/src/device",
45    "syncer/src/device/multiver",
46    "syncer/src/device/singlever",
47    "//third_party/openssl/include/",
48  ]
49
50  defines = [
51    "_LARGEFILE64_SOURCE",
52    "_FILE_OFFSET_BITS=64",
53    "SQLITE_HAS_CODEC",
54    "SQLITE_ENABLE_JSON1",
55    "USING_HILOG_LOGGER",
56    "USE_SQLITE_SYMBOLS",
57    "USING_DB_JSON_EXTRACT_AUTOMATICALLY",
58    "JSONCPP_USE_BUILDER",
59    "OMIT_FLATBUFFER",
60    "OMIT_MULTI_VER",
61    "RELATIONAL_STORE",
62    "SQLITE_DISTRIBUTE_RELATIONAL",
63    "USE_DFX_ABILITY",
64    "SQLITE_ENABLE_DROPTABLE_CALLBACK",
65    "OPENSSL_SUPPRESS_DEPRECATED",
66  ]
67  if (is_debug) {
68    defines += [ "TRACE_SQLITE_EXECUTE" ]
69  }
70  if (is_ohos) {
71    defines += [ "USE_FFRT" ]
72  }
73}
74
75config("distrdb_public_config") {
76  visibility = [ "*:*" ]
77  include_dirs = [
78    "interfaces/include",
79    "interfaces/include/relational",
80    "include",
81    "gaussdb_rd/include",
82    "gaussdb_rd/include/grd_base",
83    "gaussdb_rd/include/grd_document",
84    "gaussdb_rd/include/grd_kv",
85  ]
86}
87
88group("build_module") {
89  deps = [ ":distributeddb" ]
90}
91
92ohos_shared_library("distributeddb") {
93  branch_protector_ret = "pac_ret"
94  sanitize = {
95    ubsan = true
96    boundary_sanitize = true
97    cfi = true
98    cfi_cross_dso = true
99    debug = false
100  }
101  sources = distributeddb_src
102
103  configs = [ ":distrdb_config" ]
104  public_configs = [ ":distrdb_public_config" ]
105
106  cflags_cc = [ "-fvisibility=hidden" ]
107  deps = [ "gaussdb_rd:gaussdb_rd" ]
108
109  external_deps = [
110    "c_utils:utils",
111    "ffrt:libffrt",
112    "hilog:libhilog",
113    "hisysevent:libhisysevent",
114    "hitrace:hitrace_meter",
115  ]
116
117  public_external_deps = [
118    "jsoncpp:jsoncpp",
119    "openssl:libcrypto_shared",
120    "sqlite:sqlite",
121    "zlib:shared_libz",
122  ]
123
124  subsystem_name = "distributeddatamgr"
125  innerapi_tags = [ "platformsdk_indirect" ]
126  part_name = "kv_store"
127}
128