• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  ]
48
49  defines = [
50    "_LARGEFILE64_SOURCE",
51    "_FILE_OFFSET_BITS=64",
52    "SQLITE_HAS_CODEC",
53    "SQLITE_ENABLE_JSON1",
54    "USING_HILOG_LOGGER",
55    "USE_SQLITE_SYMBOLS",
56    "USING_DB_JSON_EXTRACT_AUTOMATICALLY",
57    "JSONCPP_USE_BUILDER",
58    "OMIT_FLATBUFFER",
59    "OMIT_MULTI_VER",
60    "RELATIONAL_STORE",
61    "SQLITE_DISTRIBUTE_RELATIONAL",
62    "USE_DFX_ABILITY",
63    "SQLITE_ENABLE_DROPTABLE_CALLBACK",
64    "OPENSSL_SUPPRESS_DEPRECATED",
65  ]
66  if (is_debug) {
67    defines += [ "TRACE_SQLITE_EXECUTE" ]
68  }
69  if (is_ohos) {
70    defines += [ "USE_FFRT" ]
71  }
72  if (kv_store_cloud) {
73    defines += [ "USE_DISTRIBUTEDDB_CLOUD" ]
74  }
75}
76
77config("distrdb_public_config") {
78  visibility = [ "*:*" ]
79  include_dirs = [
80    "interfaces/include",
81    "interfaces/include/relational",
82    "include",
83    "gaussdb_rd/include",
84    "gaussdb_rd/include/grd_base",
85    "gaussdb_rd/include/grd_document",
86    "gaussdb_rd/include/grd_kv",
87  ]
88}
89
90group("build_module") {
91  deps = [
92    ":customtokenizer",
93    ":distributeddb",
94    ":distributeddb_client",
95  ]
96}
97
98ohos_shared_library("distributeddb") {
99  branch_protector_ret = "pac_ret"
100  sanitize = {
101    ubsan = true
102    boundary_sanitize = true
103    cfi = true
104    cfi_cross_dso = true
105    debug = false
106  }
107  sources = distributeddb_src
108  if (kv_store_cloud) {
109    sources += distributeddb_cloud_src
110  }
111
112  configs = [ ":distrdb_config" ]
113  public_configs = [ ":distrdb_public_config" ]
114
115  cflags_cc = [
116    "-fvisibility=hidden",
117    "-Os",
118    "-D_FORTIFY_SOURCE=2",
119    "-flto",
120  ]
121  deps = [ "gaussdb_rd:gaussdb_rd" ]
122
123  external_deps = [
124    "c_utils:utils",
125    "ffrt:libffrt",
126    "hilog:libhilog",
127    "hisysevent:libhisysevent",
128    "hitrace:hitrace_meter",
129    "jsoncpp:jsoncpp",
130    "zlib:shared_libz",
131  ]
132
133  public_external_deps = [
134    "openssl:libcrypto_shared",
135    "sqlite:sqlite",
136  ]
137
138  subsystem_name = "distributeddatamgr"
139  innerapi_tags = [ "platformsdk_indirect" ]
140  part_name = "kv_store"
141}
142
143tokenizer_path = "."
144
145config("tokenizer_config") {
146  visibility = [ ":*" ]
147  include_dirs = [
148    "$tokenizer_path/sqlite_adapter/include",
149    "$tokenizer_path/sqlite_adapter/src",
150  ]
151  defines = [ "HARMONY_OS" ]
152}
153
154config("tokenizer_public_config") {
155  visibility = [ ":*" ]
156  include_dirs = [ "$tokenizer_path/sqlite_adapter/include" ]
157}
158
159ohos_shared_library("customtokenizer") {
160  branch_protector_ret = "pac_ret"
161  sanitize = {
162    ubsan = true
163    boundary_sanitize = true
164    cfi = true
165    cfi_cross_dso = true
166    debug = false
167  }
168  sources = [
169    "$tokenizer_path/sqlite_adapter/src/tokenizer_api.cpp",
170    "$tokenizer_path/sqlite_adapter/src/tokenizer_api_mgr.cpp",
171    "$tokenizer_path/sqlite_adapter/src/tokenizer_sqlite.cpp",
172  ]
173
174  configs = [ ":tokenizer_config" ]
175  public_configs = [ ":tokenizer_public_config" ]
176
177  cflags_cc = [
178    "-fvisibility=hidden",
179    "-Os",
180    "-D_FORTIFY_SOURCE=2",
181  ]
182
183  external_deps = [
184    "c_utils:utils",
185    "hilog:libhilog",
186  ]
187
188  public_external_deps = [ "sqlite:sqlite" ]
189
190  subsystem_name = "distributeddatamgr"
191  innerapi_tags = [ "platformsdk_indirect" ]
192  part_name = "kv_store"
193}
194
195config("distributeddb_client_public_config") {
196  visibility = [ "*:*" ]
197  include_dirs = [
198    "interfaces/include/relational",
199    "interfaces/include",
200    "include",
201  ]
202}
203
204config("distributeddb_client_config") {
205  visibility = [ ":*" ]
206  include_dirs = [
207    "interfaces/src/relational",
208    "common/include/cloud",
209    "common/include",
210    "interfaces/include",
211    "interfaces/include/cloud",
212    "include",
213    "storage/include",
214    "communicator/include",
215    "common/include/relational",
216    "storage/src/sqlite",
217    "storage/src",
218    "storage/src/kv",
219    "syncer/src",
220    "syncer/src/device",
221    "storage/src/sqlite/relational",
222    "storage/src/relational",
223  ]
224
225  defines = [
226    "_LARGEFILE64_SOURCE",
227    "_FILE_OFFSET_BITS=64",
228    "SQLITE_HAS_CODEC",
229    "SQLITE_ENABLE_JSON1",
230    "USING_HILOG_LOGGER",
231    "USE_SQLITE_SYMBOLS",
232    "USING_DB_JSON_EXTRACT_AUTOMATICALLY",
233    "JSONCPP_USE_BUILDER",
234    "OMIT_FLATBUFFER",
235    "OMIT_MULTI_VER",
236    "RELATIONAL_STORE",
237    "SQLITE_DISTRIBUTE_RELATIONAL",
238    "USE_DFX_ABILITY",
239    "SQLITE_ENABLE_DROPTABLE_CALLBACK",
240    "OPENSSL_SUPPRESS_DEPRECATED",
241  ]
242  if (is_debug) {
243    defines += [ "TRACE_SQLITE_EXECUTE" ]
244  }
245  if (is_ohos) {
246    defines += [ "USE_FFRT" ]
247    defines += [ "RDB_CLIENT" ]
248  }
249  if (kv_store_cloud) {
250    defines += [ "USE_DISTRIBUTEDDB_CLOUD" ]
251  }
252}
253
254ohos_shared_library("distributeddb_client") {
255  branch_protector_ret = "pac_ret"
256  sanitize = {
257    ubsan = true
258    boundary_sanitize = true
259    cfi = true
260    cfi_cross_dso = true
261    debug = false
262  }
263
264  sources = distributeddb_client_src
265  sources += distributeddb_base_src
266  configs = [ ":distributeddb_client_config" ]
267  public_configs = [ ":distributeddb_client_public_config" ]
268
269  cflags_cc = [
270    "-fvisibility=hidden",
271    "-Os",
272    "-D_FORTIFY_SOURCE=2",
273    "-flto",
274  ]
275
276  external_deps = [
277    "cJSON:cjson",
278    "c_utils:utils",
279    "ffrt:libffrt",
280    "hilog:libhilog",
281    "jsoncpp:jsoncpp",
282  ]
283
284  public_external_deps = [
285    "openssl:libcrypto_shared",
286    "sqlite:sqlite",
287  ]
288
289  subsystem_name = "distributeddatamgr"
290  innerapi_tags = [ "platformsdk_indirect" ]
291  part_name = "kv_store"
292}
293