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}gaussdb_rd", 26 "${kv_store_distributeddb_path}gaussdb_rd/include", 27 "${kv_store_distributeddb_path}gaussdb_rd/include/grd_base", 28 "${kv_store_distributeddb_path}gaussdb_rd/include/grd_document", 29 "${kv_store_distributeddb_path}gaussdb_rd/include/grd_kv", 30 "${kv_store_distributeddb_path}storage/include", 31 "${kv_store_distributeddb_path}storage/src", 32 "${kv_store_distributeddb_path}storage/src/cloud", 33 "${kv_store_distributeddb_path}storage/src/kv", 34 "${kv_store_distributeddb_path}storage/src/gaussdb_rd", 35 "${kv_store_distributeddb_path}storage/src/multiver", 36 "${kv_store_distributeddb_path}storage/src/operation", 37 "${kv_store_distributeddb_path}storage/src/relational", 38 "${kv_store_distributeddb_path}storage/src/sqlite", 39 "${kv_store_distributeddb_path}storage/src/sqlite/kv", 40 "${kv_store_distributeddb_path}storage/src/sqlite/relational", 41 "${kv_store_distributeddb_path}storage/src/upgrader", 42 "${kv_store_distributeddb_path}syncer/include", 43 "${kv_store_distributeddb_path}syncer/src", 44 "${kv_store_distributeddb_path}syncer/src/cloud", 45 "${kv_store_distributeddb_path}syncer/src/device", 46 "${kv_store_distributeddb_path}syncer/src/device/multiver", 47 "${kv_store_distributeddb_path}syncer/src/device/singlever", 48 "${kv_store_distributeddb_path}gaussdb_rd/src/common/include", 49 "${kv_store_distributeddb_path}gaussdb_rd/src/executor/include", 50 "${kv_store_distributeddb_path}gaussdb_rd/src/executor/document", 51 "${kv_store_distributeddb_path}gaussdb_rd/src/oh_adapter/include", 52 "${kv_store_distributeddb_path}gaussdb_rd/src/oh_adapter/src", 53 "${kv_store_distributeddb_path}gaussdb_rd/src/interface/include", 54 55 "//third_party/openssl/include/", 56 "//third_party/bounds_checking_function/include", 57] 58distrdb_defines = [ 59 "_LARGEFILE64_SOURCE", 60 "_FILE_OFFSET_BITS=64", 61 "SQLITE_HAS_CODEC", 62 "SQLITE_ENABLE_JSON1", 63 "USE_SQLITE_SYMBOLS", 64 "USING_DB_JSON_EXTRACT_AUTOMATICALLY", 65 "JSONCPP_USE_BUILDER", 66 "OMIT_FLATBUFFER", 67 "OMIT_MULTI_VER", 68 "RELATIONAL_STORE", 69 "SQLITE_DISTRIBUTE_RELATIONAL", 70 "SQLITE_ENABLE_DROPTABLE_CALLBACK", 71] 72config("distrdb_public_config") { 73 visibility = [ "*:*" ] 74 include_dirs = [ 75 "${kv_store_distributeddb_path}interfaces/include", 76 "${kv_store_distributeddb_path}interfaces/include/relational", 77 "${kv_store_distributeddb_path}include", 78 "${kv_store_distributeddb_path}gaussdb_rd/include/grd_base", 79 "${kv_store_distributeddb_path}gaussdb_rd/include/grd_document", 80 "${kv_store_distributeddb_path}gaussdb_rd/include/grd_kv", 81 ] 82} 83 84group("build_module") { 85 deps = [] 86 if (use_platform_win || use_platforn_mac) { 87 deps += [ ":distributeddb" ] 88 } 89} 90distrdb_sources = distributeddb_src 91 92config("distrdb_config") { 93 visibility = [ ":*" ] 94 include_dirs = distrdb_Dir 95 include_dirs += [ 96 "//third_party/jsoncpp/include", 97 "//third_party/zlib", 98 "//third_party/sqlite/include", 99 "//third_party/bounds_checking_function/include", 100 ] 101 102 defines = distrdb_defines 103 defines += [ 104 "EVLOOP_TIMER_ONLY", 105 "USING_PRINTF_LOGGER", 106 "OPENSSL_SUPPRESS_DEPRECATED", 107 "OMIT_cJSON", 108 ] 109 if (use_platform_win) { 110 defines += [ "OS_TYPE_WINDOWS" ] 111 } else if (use_platforn_mac) { 112 defines += [ "OS_TYPE_MAC" ] 113 } 114} 115 116ohos_shared_library("distributeddb_mock") { 117 cflags_cc = [ "-std=c++17" ] 118 sources = distrdb_sources 119 sources += distributeddb_src_rd 120 configs = [ ":distrdb_config" ] 121 public_configs = [ ":distrdb_public_config" ] 122 ldflags = [ "-v" ] 123 deps = [ 124 "//third_party/bounds_checking_function:libsec_static", 125 "//third_party/jsoncpp:jsoncpp_static", 126 "//third_party/openssl:libcrypto_static", 127 "//third_party/sqlite:sqlite_sdk", 128 "//third_party/zlib:shared_libz", 129 ] 130 131 if (use_platform_win) { 132 libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libws2_32.a" ] 133 deps += [ 134 "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_windows", 135 ] 136 } else if (use_platforn_mac) { 137 deps += 138 [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_mac" ] 139 } 140 configs += [ "//third_party/jsoncpp:jsoncpp_config" ] 141 142 subsystem_name = "distributeddatamgr" 143 part_name = "kv_store" 144} 145