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 24sources = [ 25 "../common/src/js_scope.cpp", 26 "../common/src/js_sendable_utils.cpp", 27 "../common/src/js_utils.cpp", 28 "../common/src/js_uv_queue.cpp", 29 "src/entry_point.cpp", 30 "src/napi_async_call.cpp", 31 "src/napi_rdb_const_properties.cpp", 32 "src/napi_rdb_error.cpp", 33 "src/napi_rdb_js_utils.cpp", 34 "src/napi_rdb_predicates.cpp", 35 "src/napi_rdb_sendable_utils.cpp", 36 "src/napi_rdb_store.cpp", 37 "src/napi_rdb_store_helper.cpp", 38 "src/napi_result_set.cpp", 39 "src/napi_transaction.cpp", 40 "src/napi_uv_queue.cpp", 41] 42 43if (is_ohos) { 44 ohos_shared_library("relationalstore") { 45 include_dirs = [ 46 "include", 47 "${datashare_path}/common/include/", 48 "${kvstore_path}/common", 49 "${relational_store_common_path}/include", 50 "${relational_store_js_common_path}/include", 51 "${relational_store_napi_path}/relationalstore/include", 52 ] 53 54 defines = [ "SQLITE_DISTRIBUTE_RELATIONAL" ] 55 56 sources += [ 57 "${relational_store_js_common_path}/src/js_ability.cpp", 58 "src/napi_rdb_store_observer.cpp", 59 ] 60 61 deps = [ 62 "${relational_store_innerapi_path}/appdatafwk:native_appdatafwk", 63 "${relational_store_innerapi_path}/rdb:native_rdb", 64 "${relational_store_innerapi_path}/rdb_data_share_adapter:rdb_data_share_adapter", 65 ] 66 67 external_deps = [ 68 "ability_runtime:abilitykit_native", 69 "ability_runtime:napi_base_context", 70 "bounds_checking_function:libsec_shared", 71 "c_utils:utils", 72 "common_event_service:cesfwk_innerkits", 73 "eventhandler:libeventhandler", 74 "hilog:libhilog", 75 "hitrace:hitrace_meter", 76 "napi:ace_napi", 77 ] 78 79 subsystem_name = "distributeddatamgr" 80 part_name = "relational_store" 81 relative_install_dir = "module/data" 82 } 83} else if (is_mingw) { 84 ohos_shared_library("relationalstore") { 85 include_dirs = [ 86 "mock/include", 87 "${kvstore_path}/common", 88 "${relational_store_common_path}/include", 89 "${relational_store_js_common_path}/mock/include", 90 "${relational_store_napi_path}/relationalstore/mock/include", 91 "//commonlibrary/c_utils/base/include", 92 "include", 93 "${relational_store_js_common_path}/include", 94 ] 95 cflags_cc = [ 96 "-std=c++17", 97 "-stdlib=libc++", 98 ] 99 100 buildos = "windows" 101 defines = [ 102 "WINDOWS_PLATFORM", 103 "API_EXPORT=__declspec(dllimport)", 104 ] 105 106 sources += [ "${relational_store_js_common_path}/mock/src/js_ability.cpp" ] 107 108 deps = [ 109 "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_${buildos}", 110 "//foundation/arkui/napi:ace_napi", 111 "//foundation/distributeddatamgr/relational_store/interfaces/inner_api/rdb:native_rdb", 112 ] 113 114 external_deps = [ "bounds_checking_function:libsec_static" ] 115 116 subsystem_name = "distributeddatamgr" 117 part_name = "relational_store" 118 relative_install_dir = "module/data" 119 } 120} else if (is_mac) { 121 ohos_shared_library("relationalstore") { 122 include_dirs = [ 123 "mock/include", 124 "${kvstore_path}/common", 125 "${relational_store_common_path}/include", 126 "${relational_store_js_common_path}/mock/include", 127 "${relational_store_napi_path}/relationalstore/mock/include", 128 "//commonlibrary/c_utils/base/include", 129 "include", 130 "${relational_store_js_common_path}/include", 131 ] 132 133 cflags_cc = [ 134 "-std=c++17", 135 "-stdlib=libc++", 136 ] 137 138 buildos = "mac" 139 defines = [ "MAC_PLATFORM" ] 140 141 sources += [ "${relational_store_js_common_path}/mock/src/js_ability.cpp" ] 142 143 deps = [ 144 "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_${buildos}", 145 "//foundation/arkui/napi:ace_napi", 146 "//foundation/distributeddatamgr/relational_store/interfaces/inner_api/rdb:native_rdb", 147 ] 148 149 external_deps = [ "bounds_checking_function:libsec_static" ] 150 151 subsystem_name = "distributeddatamgr" 152 part_name = "relational_store" 153 relative_install_dir = "module/data" 154 } 155} else if (is_android) { 156 ohos_source_set("data_relationalstore") { 157 include_dirs = [ 158 "mock/include", 159 "${kvstore_path}/common", 160 "${relational_store_common_path}/include", 161 "${relational_store_js_common_path}/mock/include", 162 "include", 163 "${relational_store_js_common_path}/include", 164 "//base/global/resource_management/interfaces/inner_api/include", 165 "//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/inner_api/napi_base_context/include", 166 "//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/inner_api/bundle", 167 "//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/inner_api/configuration", 168 "//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/kits/native/appkit", 169 ] 170 171 cflags_cc = [ 172 "-std=c++17", 173 "-stdlib=libc++", 174 ] 175 176 defines = [ "ANDROID_PLATFORM" ] 177 178 sources += [ 179 "${relational_store_js_common_path}/mock/src/js_ability.cpp", 180 "//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/inner_api/napi_base_context/src/napi_base_context.cpp", 181 ] 182 183 deps = [ 184 "${relational_store_innerapi_path}/rdb:native_rdb", 185 "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_android", 186 "//foundation/arkui/ace_engine/adapter/android/build:libarkui_android", 187 ] 188 189 external_deps = [ "bounds_checking_function:libsec_static" ] 190 191 subsystem_name = "distributeddatamgr" 192 part_name = "relational_store" 193 } 194} else if (is_ios) { 195 ohos_source_set("data_relationalstore") { 196 include_dirs = [ 197 "mock/include", 198 "${kvstore_path}/common", 199 "${relational_store_common_path}/include", 200 "${relational_store_js_common_path}/mock/include", 201 "include", 202 "${relational_store_js_common_path}/include", 203 "//base/global/resource_management/interfaces/inner_api/include", 204 "//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/inner_api/napi_base_context/include", 205 "//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/inner_api/bundle", 206 "//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/inner_api/configuration", 207 "//foundation/appframework/ability/ability_runtime/cross_platform/interfaces/kits/native/appkit", 208 ] 209 210 cflags_cc = [ 211 "-std=c++17", 212 "-stdlib=libc++", 213 ] 214 215 defines = [ "IOS_PLATFORM" ] 216 217 sources += [ "${relational_store_js_common_path}/mock/src/js_ability.cpp" ] 218 219 deps = [ 220 "${relational_store_innerapi_path}/rdb:native_rdb", 221 "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_ios", 222 "//plugins/libs/napi:napi_ios", 223 ] 224 225 external_deps = [ "bounds_checking_function:libsec_static" ] 226 227 subsystem_name = "distributeddatamgr" 228 part_name = "relational_store" 229 } 230} 231