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_df_manager.cpp", 27 "../common/src/js_utils.cpp", 28 "src/napi_async_call.cpp", 29 "src/napi_rdb_const_properties.cpp", 30 "src/napi_rdb_js_utils.cpp", 31 "src/napi_rdb_predicates.cpp", 32 "src/napi_rdb_store.cpp", 33 "src/napi_rdb_store_helper.cpp", 34 "src/napi_result_set.cpp", 35 "src/napi_uv_queue.cpp", 36 "src/napi_values_bucket.cpp", 37 ] 38 39 if (is_mingw || is_mac) { 40 include_dirs = [ 41 "mock/include", 42 "${kvstore_path}/common", 43 "${relational_store_common_path}/include", 44 "${relational_store_js_common_path}/mock/include", 45 "${relational_store_napi_path}/rdb/mock/include", 46 "//commonlibrary/c_utils/base/include", 47 "include", 48 "${relational_store_js_common_path}/include", 49 ] 50 cflags_cc = [ 51 "-std=c++17", 52 "-stdlib=libc++", 53 ] 54 if (is_mac) { 55 buildos = "mac" 56 defines = [ 57 "MAC_PLATFORM", 58 "CROSS_PLATFORM", 59 ] 60 } else { 61 buildos = "windows" 62 defines = [ 63 "WINDOWS_PLATFORM", 64 "CROSS_PLATFORM", 65 ] 66 } 67 sources += [ "${relational_store_js_common_path}/mock/src/js_ability.cpp" ] 68 deps = [ 69 "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_${buildos}", 70 "//foundation/arkui/napi:ace_napi", 71 "//foundation/distributeddatamgr/relational_store/interfaces/inner_api/rdb:native_rdb", 72 ] 73 74 external_deps = [ "bounds_checking_function:libsec_static" ] 75 } else { 76 include_dirs = [ 77 "include", 78 "${datashare_path}/common/include/", 79 "${kvstore_path}/common", 80 "${relational_store_common_path}/include", 81 "${relational_store_js_common_path}/include", 82 "${relational_store_napi_path}/rdb/include", 83 ] 84 defines = [ "SQLITE_DISTRIBUTE_RELATIONAL" ] 85 sources += [ 86 "${relational_store_js_common_path}/src/js_ability.cpp", 87 "src/napi_rdb_store_observer.cpp", 88 ] 89 90 deps = [ 91 "${relational_store_innerapi_path}/appdatafwk:native_appdatafwk", 92 "${relational_store_innerapi_path}/rdb:native_rdb", 93 "${relational_store_innerapi_path}/rdb_data_share_adapter:rdb_data_share_adapter", 94 ] 95 96 external_deps = [ 97 "ability_runtime:abilitykit_native", 98 "ability_runtime:extensionkit_native", 99 "ability_runtime:napi_base_context", 100 "bounds_checking_function:libsec_shared", 101 "c_utils:utils", 102 "common_event_service:cesfwk_innerkits", 103 "hilog:libhilog", 104 "hitrace:hitrace_meter", 105 "napi:ace_napi", 106 ] 107 } 108 109 subsystem_name = "distributeddatamgr" 110 innerapi_tags = [ "platformsdk" ] 111 part_name = "relational_store" 112} 113 114ohos_shared_library("rdb") { 115 sources = [ "src/entry_point.cpp" ] 116 117 if (is_mingw || is_mac) { 118 include_dirs = [ 119 "mock/include", 120 "${relational_store_common_path}/include", 121 "${relational_store_js_common_path}/mock/include", 122 "${relational_store_napi_path}/rdb/mock/include", 123 "//commonlibrary/c_utils/base/include", 124 "include", 125 "${relational_store_js_common_path}/include", 126 ] 127 cflags_cc = [ 128 "-std=c++17", 129 "-stdlib=libc++", 130 ] 131 if (is_mac) { 132 buildos = "mac" 133 defines = [ 134 "MAC_PLATFORM", 135 "CROSS_PLATFORM", 136 ] 137 } else { 138 buildos = "windows" 139 defines = [ 140 "WINDOWS_PLATFORM", 141 "CROSS_PLATFORM", 142 ] 143 } 144 145 deps = [ 146 ":napi_rdb", 147 "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_${buildos}", 148 "//foundation/arkui/napi:ace_napi", 149 "//foundation/distributeddatamgr/relational_store/interfaces/inner_api/rdb:native_rdb", 150 ] 151 } else { 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