• 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("//foundation/distributeddatamgr/kv_store/kv_store.gni")
15import("../.././frameworks/libs/distributeddb/distributeddb.gni")
16kv_store_distributeddb_path = "../.././frameworks/libs/distributeddb/"
17distrdb_Dir = [
18  "${kv_store_distributeddb_path}include",
19  "${kv_store_distributeddb_path}interfaces/include",
20  "${kv_store_distributeddb_path}interfaces/src",
21  "${kv_store_distributeddb_path}interfaces/src/relational",
22  "${kv_store_distributeddb_path}common/include",
23  "${kv_store_distributeddb_path}common/include/relational",
24  "${kv_store_distributeddb_path}communicator/include",
25  "${kv_store_distributeddb_path}storage/include",
26  "${kv_store_distributeddb_path}storage/src",
27  "${kv_store_distributeddb_path}storage/src/multiver",
28  "${kv_store_distributeddb_path}storage/src/operation",
29  "${kv_store_distributeddb_path}storage/src/sqlite",
30  "${kv_store_distributeddb_path}storage/src/sqlite/relational",
31  "${kv_store_distributeddb_path}storage/src/upgrader",
32  "${kv_store_distributeddb_path}syncer/include",
33  "${kv_store_distributeddb_path}syncer/src",
34  "//third_party/openssl/include/",
35  "//third_party/bounds_checking_function/include",
36]
37distrdb_defines = [
38  "_LARGEFILE64_SOURCE",
39  "_FILE_OFFSET_BITS=64",
40  "SQLITE_HAS_CODEC",
41  "SQLITE_ENABLE_JSON1",
42  "USE_SQLITE_SYMBOLS",
43  "USING_DB_JSON_EXTRACT_AUTOMATICALLY",
44  "JSONCPP_USE_BUILDER",
45  "OMIT_FLATBUFFER",
46  "OMIT_MULTI_VER",
47  "RELATIONAL_STORE",
48  "SQLITE_DISTRIBUTE_RELATIONAL",
49  "SQLITE_ENABLE_DROPTABLE_CALLBACK",
50]
51config("distrdb_public_config") {
52  visibility = [ "*:*" ]
53  include_dirs = [
54    "${kv_store_distributeddb_path}interfaces/include",
55    "${kv_store_distributeddb_path}interfaces/include/relational",
56    "${kv_store_distributeddb_path}include",
57  ]
58}
59
60group("build_module") {
61  deps = []
62  if (use_platform_win || use_platforn_mac) {
63    deps += [ ":distributeddb" ]
64  }
65}
66distrdb_sources = distributeddb_src
67
68config("distrdb_config") {
69  visibility = [ ":*" ]
70  include_dirs = distrdb_Dir
71  include_dirs += [
72    "//third_party/jsoncpp/include",
73    "//third_party/zlib",
74    "//third_party/sqlite/include",
75    "//third_party/bounds_checking_function/include",
76  ]
77
78  defines = distrdb_defines
79  defines += [
80    "EVLOOP_TIMER_ONLY",
81    "USING_PRINTF_LOGGER",
82    "OPENSSL_SUPPRESS_DEPRECATED",
83  ]
84  if (use_platform_win) {
85    defines += [ "OS_TYPE_WINDOWS" ]
86  } else if (use_platforn_mac) {
87    defines += [ "OS_TYPE_MAC" ]
88  }
89}
90
91ohos_shared_library("distributeddb_mock") {
92  cflags_cc = [ "-std=c++17" ]
93  sources = distrdb_sources
94  configs = [ ":distrdb_config" ]
95  public_configs = [ ":distrdb_public_config" ]
96  ldflags = [ "-v" ]
97  deps = [
98    "//third_party/bounds_checking_function:libsec_static",
99    "//third_party/jsoncpp:jsoncpp_static",
100    "//third_party/openssl:libcrypto_static",
101    "//third_party/sqlite:sqlite_sdk",
102    "//third_party/zlib:shared_libz",
103  ]
104
105  if (use_platform_win) {
106    libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libws2_32.a" ]
107    deps += [
108      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_windows",
109    ]
110  } else if (use_platforn_mac) {
111    deps +=
112        [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_mac" ]
113  }
114  configs += [ "//third_party/jsoncpp:jsoncpp_config" ]
115
116  subsystem_name = "distributeddatamgr"
117  part_name = "kv_store"
118}
119