• 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("//foundation/distributeddatamgr/relational_store/relational_store.gni")
15
16base_sources = [
17  "${relational_store_native_path}/rdb/src/abs_predicates.cpp",
18  "${relational_store_native_path}/rdb/src/abs_rdb_predicates.cpp",
19  "${relational_store_native_path}/rdb/src/abs_result_set.cpp",
20  "${relational_store_native_path}/rdb/src/base_transaction.cpp",
21  "${relational_store_native_path}/rdb/src/cache_result_set.cpp",
22  "${relational_store_native_path}/rdb/src/raw_data_parser.cpp",
23  "${relational_store_native_path}/rdb/src/rdb_helper.cpp",
24  "${relational_store_native_path}/rdb/src/rdb_predicates.cpp",
25  "${relational_store_native_path}/rdb/src/rdb_sql_utils.cpp",
26  "${relational_store_native_path}/rdb/src/rdb_store_config.cpp",
27  "${relational_store_native_path}/rdb/src/rdb_store_impl.cpp",
28  "${relational_store_native_path}/rdb/src/rdb_store_manager.cpp",
29  "${relational_store_native_path}/rdb/src/sqlite_connection.cpp",
30  "${relational_store_native_path}/rdb/src/sqlite_connection_pool.cpp",
31  "${relational_store_native_path}/rdb/src/sqlite_global_config.cpp",
32  "${relational_store_native_path}/rdb/src/sqlite_sql_builder.cpp",
33  "${relational_store_native_path}/rdb/src/sqlite_statement.cpp",
34  "${relational_store_native_path}/rdb/src/sqlite_utils.cpp",
35  "${relational_store_native_path}/rdb/src/step_result_set.cpp",
36  "${relational_store_native_path}/rdb/src/string_utils.cpp",
37  "${relational_store_native_path}/rdb/src/value_object.cpp",
38  "${relational_store_native_path}/rdb/src/values_bucket.cpp",
39]
40
41if (is_ohos && !build_ohos_sdk) {
42  config("native_rdb_config") {
43    visibility = [ ":*" ]
44
45    include_dirs = [
46      "include",
47      "${relational_store_common_path}/include",
48      "${relational_store_native_path}/rdb/include",
49      "${relational_store_native_path}/rdb_device_manager_adapter/include",
50    ]
51
52    defines = [
53      "RELATIONAL_STORE",
54      "SQLITE_HAS_CODEC",
55    ]
56
57    if (relational_store_rdb_support_icu) {
58      include_dirs += [
59        "//third_party/icu/icu4c/source",
60        "//third_party/icu/icu4c/source/i18n",
61        "//third_party/icu/icu4c/source/common",
62      ]
63      defines += [ "RDB_SUPPORT_ICU" ]
64    }
65
66    defines += [ "SQLITE_DISTRIBUTE_RELATIONAL" ]
67    include_dirs += [
68      "${kvstore_path}/common",
69      "${kvstore_interface_path}",
70      "${distributedfile_path}/mod_securitylabel",
71    ]
72  }
73
74  config("native_rdb_public_config") {
75    visibility = [ ":*" ]
76
77    include_dirs = [
78      "include",
79      "${relational_store_native_path}/rdb/include",
80    ]
81  }
82
83  base_deps = [
84    "//third_party/icu/icu4c:shared_icui18n",
85    "//third_party/icu/icu4c:shared_icuuc",
86  ]
87
88  ohos_shared_library("native_rdb") {
89    branch_protector_ret = "pac_ret"
90    sanitize = {
91      cfi = true
92      cfi_cross_dso = true
93      debug = false
94    }
95
96    part_name = "relational_store"
97    sources = base_sources
98
99    configs = [ ":native_rdb_config" ]
100
101    deps = base_deps
102
103    deps += [ "//third_party/sqlite:sqlite" ]
104    ldflags = [ "-Wl,--exclude-libs,ALL" ]
105    cflags_cc = [ "-fvisibility=hidden" ]
106    sources += [
107      "${relational_store_native_path}/rdb/src/abs_shared_result_set.cpp",
108      "${relational_store_native_path}/rdb/src/delay_notify.cpp",
109      "${relational_store_native_path}/rdb/src/rdb_manager_impl.cpp",
110      "${relational_store_native_path}/rdb/src/rdb_notifier_stub.cpp",
111      "${relational_store_native_path}/rdb/src/rdb_security_manager.cpp",
112      "${relational_store_native_path}/rdb/src/rdb_service_proxy.cpp",
113      "${relational_store_native_path}/rdb/src/rdb_types_util.cpp",
114      "${relational_store_native_path}/rdb/src/result_set_proxy.cpp",
115      "${relational_store_native_path}/rdb/src/security_policy.cpp",
116      "${relational_store_native_path}/rdb/src/share_block.cpp",
117      "${relational_store_native_path}/rdb/src/shared_block_serializer_info.cpp",
118      "${relational_store_native_path}/rdb/src/sqlite_shared_result_set.cpp",
119      "${relational_store_native_path}/rdb/src/task_executor.cpp",
120      "${relational_store_native_path}/rdb_device_manager_adapter/src/rdb_device_manager_adapter.cpp",
121    ]
122
123    public_deps = [
124      "${relational_store_innerapi_path}/appdatafwk:native_appdatafwk",
125      "${relational_store_innerapi_path}/appdatafwk:relational_common_base",
126    ]
127
128    external_deps = [
129      "ability_base:zuri",
130      "ability_runtime:dataobs_manager",
131      "c_utils:utils",
132      "device_manager:devicemanagersdk",
133      "hilog:libhilog",
134      "hitrace:hitrace_meter",
135      "huks:libhukssdk",
136      "ipc:ipc_core",
137      "kv_store:distributeddb",
138      "samgr:samgr_proxy",
139    ]
140
141    public_configs = [ ":native_rdb_public_config" ]
142    innerapi_tags = [
143      "platformsdk",
144      "sasdk",
145    ]
146    subsystem_name = "distributeddatamgr"
147  }
148
149  ohos_static_library("native_rdb_static") {
150    branch_protector_ret = "pac_ret"
151    sanitize = {
152      cfi = true
153      cfi_cross_dso = true
154      debug = false
155    }
156
157    sources = base_sources
158
159    configs = [ ":native_rdb_config" ]
160
161    deps = base_deps
162
163    deps += [ "//third_party/sqlite:sqlite" ]
164    ldflags = [ "-Wl,--exclude-libs,ALL" ]
165
166    sources += [
167      "${relational_store_native_path}/rdb/src/abs_shared_result_set.cpp",
168      "${relational_store_native_path}/rdb/src/delay_notify.cpp",
169      "${relational_store_native_path}/rdb/src/rdb_manager_impl.cpp",
170      "${relational_store_native_path}/rdb/src/rdb_notifier_stub.cpp",
171      "${relational_store_native_path}/rdb/src/rdb_security_manager.cpp",
172      "${relational_store_native_path}/rdb/src/rdb_service_proxy.cpp",
173      "${relational_store_native_path}/rdb/src/rdb_types_util.cpp",
174      "${relational_store_native_path}/rdb/src/result_set_proxy.cpp",
175      "${relational_store_native_path}/rdb/src/security_policy.cpp",
176      "${relational_store_native_path}/rdb/src/share_block.cpp",
177      "${relational_store_native_path}/rdb/src/shared_block_serializer_info.cpp",
178      "${relational_store_native_path}/rdb/src/sqlite_shared_result_set.cpp",
179      "${relational_store_native_path}/rdb/src/task_executor.cpp",
180      "${relational_store_native_path}/rdb_device_manager_adapter/src/rdb_device_manager_adapter.cpp",
181    ]
182
183    public_deps = [
184      "${relational_store_innerapi_path}/appdatafwk:native_appdatafwk",
185      "${relational_store_innerapi_path}/appdatafwk:relational_common_base",
186    ]
187
188    external_deps = [
189      "ability_base:zuri",
190      "ability_runtime:dataobs_manager",
191      "c_utils:utils",
192      "device_manager:devicemanagersdk",
193      "hilog:libhilog",
194      "hitrace:hitrace_meter",
195      "huks:libhukssdk",
196      "ipc:ipc_core",
197      "kv_store:distributeddb",
198      "samgr:samgr_proxy",
199    ]
200
201    public_configs = [ ":native_rdb_public_config" ]
202
203    subsystem_name = "distributeddatamgr"
204    part_name = "relational_store"
205  }
206} else if (is_mingw) {
207  config("native_rdb_config") {
208    visibility = [ ":*" ]
209
210    include_dirs = [
211      "mock/include",
212      "${relational_store_common_path}/include",
213      "${relational_store_native_path}/rdb/mock/include",
214      "//commonlibrary/c_utils/base/include",
215      "include",
216      "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
217      "${relational_store_native_path}/rdb/include",
218      "//third_party/libuv/src/win",
219    ]
220
221    defines = [
222      "RELATIONAL_STORE",
223      "SQLITE_HAS_CODEC",
224    ]
225
226    if (relational_store_rdb_support_icu) {
227      include_dirs += [
228        "//third_party/icu/icu4c/source",
229        "//third_party/icu/icu4c/source/i18n",
230        "//third_party/icu/icu4c/source/common",
231      ]
232      defines += [ "RDB_SUPPORT_ICU" ]
233    }
234
235    defines += [ "WINDOWS_PLATFORM" ]
236    include_dirs += [
237      "//foundation/distributeddatamgr/kv_store/frameworks/common",
238      "//third_party/sqlite/include",
239    ]
240    libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libws2_32.a" ]
241  }
242
243  config("native_rdb_public_config") {
244    visibility = [ ":*" ]
245
246    include_dirs = [
247      "mock/include",
248      "include",
249      "//third_party/libuv/src/win",
250    ]
251  }
252
253  base_deps = [
254    "//third_party/icu/icu4c:shared_icui18n",
255    "//third_party/icu/icu4c:shared_icuuc",
256  ]
257
258  ohos_shared_library("native_rdb") {
259    part_name = "relational_store"
260    sources = base_sources
261
262    configs = [ ":native_rdb_config" ]
263
264    deps = base_deps
265
266    sources +=
267        [ "${relational_store_native_path}/rdb/mock/src/task_executor.cpp" ]
268
269    deps += [
270      "${relational_store_innerapi_path}/appdatafwk:relational_common_base",
271      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_windows",
272      "//third_party/sqlite:sqlite_sdk",
273    ]
274    cflags_cc = [ "-std=c++17" ]
275
276    public_configs = [ ":native_rdb_public_config" ]
277    innerapi_tags = [ "platformsdk" ]
278    subsystem_name = "distributeddatamgr"
279  }
280
281  ohos_static_library("native_rdb_static") {
282    sources = base_sources
283
284    configs = [ ":native_rdb_config" ]
285
286    deps = base_deps
287
288    sources +=
289        [ "${relational_store_native_path}/rdb/mock/src/task_executor.cpp" ]
290
291    deps += [
292      "${relational_store_innerapi_path}/appdatafwk:relational_common_base",
293      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_windows",
294      "//third_party/sqlite:sqlite_sdk",
295    ]
296    cflags_cc = [ "-std=c++17" ]
297
298    public_configs = [ ":native_rdb_public_config" ]
299
300    subsystem_name = "distributeddatamgr"
301    part_name = "relational_store"
302  }
303} else if (is_mac) {
304  config("native_rdb_config") {
305    visibility = [ ":*" ]
306
307    include_dirs = [
308      "mock/include",
309      "${relational_store_common_path}/include",
310      "${relational_store_native_path}/rdb/mock/include",
311      "//commonlibrary/c_utils/base/include",
312      "include",
313      "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
314      "${relational_store_native_path}/rdb/include",
315    ]
316
317    defines = [
318      "RELATIONAL_STORE",
319      "SQLITE_HAS_CODEC",
320    ]
321
322    if (relational_store_rdb_support_icu) {
323      include_dirs += [
324        "//third_party/icu/icu4c/source",
325        "//third_party/icu/icu4c/source/i18n",
326        "//third_party/icu/icu4c/source/common",
327      ]
328      defines += [ "RDB_SUPPORT_ICU" ]
329    }
330
331    defines += [ "MAC_PLATFORM" ]
332    include_dirs += [
333      "//foundation/distributeddatamgr/kv_store/frameworks/common",
334      "//third_party/sqlite/include",
335    ]
336  }
337
338  config("native_rdb_public_config") {
339    visibility = [ ":*" ]
340
341    include_dirs = [
342      "mock/include",
343      "include",
344    ]
345  }
346
347  base_deps = [
348    "//third_party/icu/icu4c:shared_icui18n",
349    "//third_party/icu/icu4c:shared_icuuc",
350  ]
351
352  ohos_shared_library("native_rdb") {
353    part_name = "relational_store"
354    sources = base_sources
355
356    configs = [ ":native_rdb_config" ]
357
358    deps = base_deps
359
360    sources +=
361        [ "${relational_store_native_path}/rdb/mock/src/task_executor.cpp" ]
362    deps += [
363      "${relational_store_innerapi_path}/appdatafwk:relational_common_base",
364      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_mac",
365      "//third_party/sqlite:sqlite_sdk",
366    ]
367    cflags_cc = [ "-std=c++17" ]
368
369    public_configs = [ ":native_rdb_public_config" ]
370    innerapi_tags = [ "platformsdk" ]
371    subsystem_name = "distributeddatamgr"
372  }
373
374  ohos_static_library("native_rdb_static") {
375    sources = base_sources
376
377    configs = [ ":native_rdb_config" ]
378
379    deps = base_deps
380
381    sources +=
382        [ "${relational_store_native_path}/rdb/mock/src/task_executor.cpp" ]
383    deps += [
384      "${relational_store_innerapi_path}/appdatafwk:relational_common_base",
385      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_mac",
386      "//third_party/sqlite:sqlite_sdk",
387    ]
388    cflags_cc = [ "-std=c++17" ]
389
390    public_configs = [ ":native_rdb_public_config" ]
391
392    subsystem_name = "distributeddatamgr"
393    part_name = "relational_store"
394  }
395} else if (is_android) {
396  config("native_rdb_config") {
397    visibility = [ ":*" ]
398
399    include_dirs = [
400      "${distributedfile_path}/mod_securitylabel",
401      "${relational_store_common_path}/include",
402      "${relational_store_innerapi_path}/rdb/mock/include",
403      "${relational_store_native_path}/rdb/mock/include",
404      "${relational_store_innerapi_path}/rdb/include",
405      "${relational_store_native_path}/rdb/include",
406    ]
407
408    defines = [
409      "RELATIONAL_STORE",
410      "SQLITE_HAS_CODEC",
411    ]
412
413    if (relational_store_rdb_support_icu) {
414      include_dirs += [
415        "//third_party/icu/icu4c/source",
416        "//third_party/icu/icu4c/source/i18n",
417        "//third_party/icu/icu4c/source/common",
418      ]
419      defines += [ "RDB_SUPPORT_ICU" ]
420    }
421  }
422
423  config("native_rdb_public_config") {
424    visibility = [ ":*" ]
425
426    include_dirs = [
427      "mock/include",
428      "include",
429      "${relational_store_native_path}/mock/rdb/include",
430      "${relational_store_native_path}/rdb/include",
431    ]
432  }
433
434  base_deps = [ "//third_party/icu/icu4c:shared_icuuc" ]
435
436  ohos_source_set("native_rdb") {
437    defines = [ "ANDROID_PLATFORM" ]
438
439    part_name = "relational_store"
440
441    sources = base_sources
442
443    configs = [ ":native_rdb_config" ]
444
445    deps = base_deps
446
447    sources += [
448      "${relational_store_native_path}/rdb/mock/src/task_executor.cpp",
449      "${relational_store_native_path}/rdb/src/security_policy.cpp",
450    ]
451    deps += [
452      "${relational_store_innerapi_path}/appdatafwk:relational_common_base",
453      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_android",
454      "//commonlibrary/c_utils/base:utils",
455      "//third_party/sqlite:sqlite_static",
456    ]
457    cflags_cc = [ "-std=c++17" ]
458
459    public_configs = [ ":native_rdb_public_config" ]
460    subsystem_name = "distributeddatamgr"
461  }
462} else if (is_ios) {
463  config("native_rdb_config") {
464    visibility = [ ":*" ]
465
466    include_dirs = [
467      "${distributedfile_path}/mod_securitylabel",
468      "${relational_store_common_path}/include",
469      "${relational_store_innerapi_path}/rdb/mock/include",
470      "${relational_store_native_path}/rdb/mock/include",
471      "${relational_store_innerapi_path}/rdb/include",
472      "${relational_store_native_path}/rdb/include",
473    ]
474
475    defines = [
476      "RELATIONAL_STORE",
477      "SQLITE_HAS_CODEC",
478    ]
479
480    if (relational_store_rdb_support_icu) {
481      include_dirs += [
482        "//third_party/icu/icu4c/source",
483        "//third_party/icu/icu4c/source/i18n",
484        "//third_party/icu/icu4c/source/common",
485      ]
486      defines += [ "RDB_SUPPORT_ICU" ]
487    }
488  }
489
490  config("native_rdb_public_config") {
491    visibility = [ ":*" ]
492
493    include_dirs = [
494      "mock/include",
495      "include",
496      "${relational_store_native_path}/rdb/include",
497    ]
498  }
499
500  base_deps = [
501    "//third_party/icu/icu4c:static_icui18n",
502    "//third_party/icu/icu4c:static_icuuc",
503  ]
504
505  ohos_source_set("native_rdb") {
506    defines = [ "IOS_PLATFORM" ]
507
508    part_name = "relational_store"
509    sources = base_sources
510
511    configs = [ ":native_rdb_config" ]
512
513    deps = base_deps
514
515    sources += [
516      "${relational_store_native_path}/rdb/mock/src/task_executor.cpp",
517      "${relational_store_native_path}/rdb/src/security_policy.cpp",
518    ]
519    deps += [
520      "${relational_store_innerapi_path}/appdatafwk:relational_common_base",
521      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_ios",
522      "//commonlibrary/c_utils/base:utilsbase",
523      "//third_party/sqlite:sqlite_static",
524    ]
525    cflags_cc = [ "-std=c++17" ]
526
527    public_configs = [ ":native_rdb_public_config" ]
528    subsystem_name = "distributeddatamgr"
529  }
530} else {
531  not_needed([ "base_sources" ])
532}
533