• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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("//build/ohos/ace/ace.gni")
15import("//foundation/distributeddatamgr/relational_store/relational_store.gni")
16
17ohos_copy("relational_store_declaration") {
18  sources = [ "./api" ]
19  outputs = [ target_out_dir + "/$target_name/" ]
20  module_source_dir = target_out_dir + "/$target_name"
21  module_install_name = ""
22}
23
24ohos_shared_library("napi_rdb") {
25  sources = [
26    "../common/src/js_utils.cpp",
27    "src/napi_async_call.cpp",
28    "src/napi_rdb_const_properties.cpp",
29    "src/napi_rdb_js_utils.cpp",
30    "src/napi_rdb_predicates.cpp",
31    "src/napi_rdb_store.cpp",
32    "src/napi_rdb_store_helper.cpp",
33    "src/napi_result_set.cpp",
34    "src/napi_uv_queue.cpp",
35    "src/napi_values_bucket.cpp",
36  ]
37
38  if (is_mingw || is_mac) {
39    include_dirs = [
40      "mock/include",
41      "${relational_store_common_path}/include",
42      "${relational_store_js_common_path}/mock/include",
43      "${relational_store_napi_path}/rdb/mock/include",
44      "//commonlibrary/c_utils/base/include",
45      "include",
46      "${relational_store_js_common_path}/include",
47    ]
48    cflags_cc = [
49      "-std=c++17",
50      "-stdlib=libc++",
51    ]
52    if (is_mac) {
53      buildos = "mac"
54      defines = [ "MAC_PLATFORM" ]
55    } else {
56      buildos = "windows"
57      defines = [ "WINDOWS_PLATFORM" ]
58    }
59    sources += [ "${relational_store_js_common_path}/mock/src/js_ability.cpp" ]
60    deps = [
61      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_${buildos}",
62      "//foundation/arkui/napi:ace_napi",
63      "//foundation/distributeddatamgr/relational_store/interfaces/inner_api/rdb:native_rdb",
64    ]
65  } else {
66    if (is_ohos) {
67      branch_protector_ret = "pac_ret"
68      sanitize = {
69        cfi = true
70        cfi_cross_dso = true
71        debug = false
72      }
73    }
74
75    include_dirs = [
76      "include",
77      "${datashare_path}/common/include/",
78      "${kvstore_path}/common",
79      "${relational_store_common_path}/include",
80      "${relational_store_js_common_path}/include",
81      "${relational_store_napi_path}/rdb/include",
82    ]
83    defines = [ "SQLITE_DISTRIBUTE_RELATIONAL" ]
84    sources += [
85      "${relational_store_js_common_path}/src/js_ability.cpp",
86      "src/napi_rdb_store_observer.cpp",
87    ]
88
89    deps = [
90      "${relational_store_innerapi_path}/appdatafwk:native_appdatafwk",
91      "${relational_store_innerapi_path}/rdb:native_rdb",
92      "${relational_store_innerapi_path}/rdb_data_share_adapter:rdb_data_share_adapter",
93    ]
94
95    external_deps = [
96      "ability_runtime:abilitykit_native",
97      "ability_runtime:napi_base_context",
98      "c_utils:utils",
99      "common_event_service:cesfwk_innerkits",
100      "hilog:libhilog",
101      "hitrace:hitrace_meter",
102      "napi:ace_napi",
103    ]
104  }
105
106  subsystem_name = "distributeddatamgr"
107  innerapi_tags = [ "platformsdk" ]
108  part_name = "relational_store"
109}
110
111ohos_shared_library("rdb") {
112  sources = [ "src/entry_point.cpp" ]
113
114  if (is_mingw || is_mac) {
115    include_dirs = [
116      "mock/include",
117      "${relational_store_common_path}/include",
118      "${relational_store_js_common_path}/mock/include",
119      "${relational_store_napi_path}/rdb/mock/include",
120      "//commonlibrary/c_utils/base/include",
121      "include",
122      "${relational_store_js_common_path}/include",
123    ]
124    cflags_cc = [
125      "-std=c++17",
126      "-stdlib=libc++",
127    ]
128    if (is_mac) {
129      buildos = "mac"
130      defines = [ "MAC_PLATFORM" ]
131    } else {
132      buildos = "windows"
133      defines = [ "WINDOWS_PLATFORM" ]
134    }
135
136    deps = [
137      ":napi_rdb",
138      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_${buildos}",
139      "//foundation/arkui/napi:ace_napi",
140      "//foundation/distributeddatamgr/relational_store/interfaces/inner_api/rdb:native_rdb",
141    ]
142  } else {
143    if (is_ohos) {
144      branch_protector_ret = "pac_ret"
145      sanitize = {
146        cfi = true
147        cfi_cross_dso = true
148        debug = false
149      }
150    }
151
152    include_dirs = [
153      "include",
154      "${datashare_path}/common/include/",
155      "${relational_store_js_common_path}/include",
156      "${relational_store_napi_path}/rdb/include",
157    ]
158    defines = [ "SQLITE_DISTRIBUTE_RELATIONAL" ]
159
160    deps = [
161      ":napi_rdb",
162      "${relational_store_innerapi_path}/appdatafwk:native_appdatafwk",
163      "${relational_store_innerapi_path}/rdb:native_rdb",
164      "${relational_store_innerapi_path}/rdb_data_share_adapter:rdb_data_share_adapter",
165    ]
166
167    external_deps = [
168      "ability_runtime:abilitykit_native",
169      "ability_runtime:napi_base_context",
170      "c_utils:utils",
171      "hilog:libhilog",
172      "hitrace:hitrace_meter",
173      "napi:ace_napi",
174    ]
175  }
176
177  subsystem_name = "distributeddatamgr"
178  part_name = "relational_store"
179  relative_install_dir = "module/data"
180}
181