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