• 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
16config("native_rdb_config") {
17  visibility = [ ":*" ]
18
19  if (is_mingw || is_mac) {
20    include_dirs = [
21      "mock/include",
22      "${relational_store_native_path}/rdb/mock/include",
23      "//commonlibrary/c_utils/base/include",
24      "include",
25    ]
26  } else {
27    include_dirs = [
28      "include",
29      "//base/security/huks/frameworks/huks_standard/main/common/include",
30      "${relational_store_native_path}/rdb/include",
31    ]
32  }
33
34  defines = [
35    "RELATIONAL_STORE",
36    "SQLITE_HAS_CODEC",
37  ]
38
39  if (relational_store_rdb_support_icu) {
40    include_dirs += [
41      "//third_party/icu/icu4c/source",
42      "//third_party/icu/icu4c/source/i18n",
43      "//third_party/icu/icu4c/source/common",
44    ]
45    defines += [ "RDB_SUPPORT_ICU" ]
46  }
47
48  if (is_mingw) {
49    defines += [ "WINDOWS_PLATFORM" ]
50    include_dirs += [ "//third_party/sqlite/include" ]
51
52    libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libws2_32.a" ]
53
54    cflags_cc = [ "-std=c++17" ]
55  } else if (is_mac) {
56    defines += [ "MAC_PLATFORM" ]
57    include_dirs += [ "//third_party/sqlite/include" ]
58    cflags_cc = [ "-std=c++17" ]
59  } else {
60    defines += [ "SQLITE_DISTRIBUTE_RELATIONAL" ]
61  }
62}
63
64config("native_rdb_public_config") {
65  visibility = [ "//foundation/distributeddatamgr/relational_store:*" ]
66
67  if (is_mingw || is_mac) {
68    include_dirs = [
69      "mock/include",
70      "include",
71    ]
72  } else {
73    include_dirs = [
74      "include",
75      "//foundation/distributeddatamgr/distributedfile/interfaces/kits/js/src/mod_securitylabel",
76    ]
77  }
78
79  defines = [ "SQLITE_HAS_CODEC" ]
80}
81
82ohos_shared_library("native_rdb") {
83  part_name = "relational_store"
84  sources = [
85    "${relational_store_native_path}/rdb/src/abs_predicates.cpp",
86    "${relational_store_native_path}/rdb/src/abs_rdb_predicates.cpp",
87    "${relational_store_native_path}/rdb/src/abs_result_set.cpp",
88    "${relational_store_native_path}/rdb/src/base_transaction.cpp",
89    "${relational_store_native_path}/rdb/src/base_transaction.h",
90    "${relational_store_native_path}/rdb/src/logger.h",
91    "${relational_store_native_path}/rdb/src/rdb_helper.cpp",
92    "${relational_store_native_path}/rdb/src/rdb_predicates.cpp",
93    "${relational_store_native_path}/rdb/src/rdb_store_config.cpp",
94    "${relational_store_native_path}/rdb/src/rdb_store_impl.cpp",
95    "${relational_store_native_path}/rdb/src/sqlite_config.cpp",
96    "${relational_store_native_path}/rdb/src/sqlite_connection.cpp",
97    "${relational_store_native_path}/rdb/src/sqlite_connection_pool.cpp",
98    "${relational_store_native_path}/rdb/src/sqlite_database_utils.cpp",
99    "${relational_store_native_path}/rdb/src/sqlite_global_config.cpp",
100    "${relational_store_native_path}/rdb/src/sqlite_sql_builder.cpp",
101    "${relational_store_native_path}/rdb/src/sqlite_statement.cpp",
102    "${relational_store_native_path}/rdb/src/sqlite_utils.cpp",
103    "${relational_store_native_path}/rdb/src/step_result_set.cpp",
104    "${relational_store_native_path}/rdb/src/store_session.cpp",
105    "${relational_store_native_path}/rdb/src/string_utils.cpp",
106    "${relational_store_native_path}/rdb/src/value_object.cpp",
107    "${relational_store_native_path}/rdb/src/values_bucket.cpp",
108  ]
109
110  configs = [ ":native_rdb_config" ]
111
112  deps = [
113    "//third_party/icu/icu4c:shared_icui18n",
114    "//third_party/icu/icu4c:shared_icuuc",
115  ]
116
117  if (is_mingw) {
118    deps += [
119      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_windows",
120      "//third_party/sqlite:sqlite_sdk",
121    ]
122  } else if (is_mac) {
123    deps += [
124      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_mac",
125      "//third_party/sqlite:sqlite_sdk",
126    ]
127  } else {
128    deps += [ "//third_party/sqlite:sqlite" ]
129    ldflags = [ "-Wl,--exclude-libs,ALL" ]
130
131    sources += [
132      "${relational_store_native_path}/rdb/src/abs_shared_result_set.cpp",
133      "${relational_store_native_path}/rdb/src/rdb_security_manager.cpp",
134      "${relational_store_native_path}/rdb/src/result_set_proxy.cpp",
135      "${relational_store_native_path}/rdb/src/security_policy.cpp",
136      "${relational_store_native_path}/rdb/src/share_block.cpp",
137      "${relational_store_native_path}/rdb/src/shared_block_serializer_info.cpp",
138      "${relational_store_native_path}/rdb/src/sqlite_shared_result_set.cpp",
139    ]
140    public_deps = [
141      "${relational_store_innerapi_path}/appdatafwk:native_appdatafwk",
142      "//base/security/huks/frameworks/huks_standard/main/os_dependency:libhuks_os_dependency_standard_static",
143      "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb",
144      "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
145    ]
146
147    external_deps = [
148      "c_utils:utils",
149      "hilog_native:libhilog",
150      "hitrace_native:hitrace_meter",
151      "hitrace_native:libhitracechain",
152      "huks:libhukssdk",
153      "ipc:ipc_core",
154    ]
155  }
156
157  public_configs = [ ":native_rdb_public_config" ]
158
159  subsystem_name = "distributeddatamgr"
160}
161