# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("//foundation/distributeddatamgr/relational_store/relational_store.gni") config("native_rdb_config") { visibility = [ ":*" ] if (is_mingw || is_mac) { include_dirs = [ "mock/include", "${relational_store_native_path}/rdb/mock/include", "//commonlibrary/c_utils/base/include", "include", ] } else { include_dirs = [ "include", "//base/security/huks/frameworks/huks_standard/main/common/include", "${relational_store_native_path}/rdb/include", "${relational_store_native_path}/rdb_device_manager_adapter/include", "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/include/", "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/interfaces/include/", "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/interfaces/include/relational", ] } defines = [ "RELATIONAL_STORE", "SQLITE_HAS_CODEC", ] if (relational_store_rdb_support_icu) { include_dirs += [ "//third_party/icu/icu4c/source", "//third_party/icu/icu4c/source/i18n", "//third_party/icu/icu4c/source/common", ] defines += [ "RDB_SUPPORT_ICU" ] } if (is_mingw) { defines += [ "WINDOWS_PLATFORM" ] include_dirs += [ "//third_party/sqlite/include" ] libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libws2_32.a" ] cflags_cc = [ "-std=c++17" ] } else if (is_mac) { defines += [ "MAC_PLATFORM" ] include_dirs += [ "//third_party/sqlite/include" ] cflags_cc = [ "-std=c++17" ] } else { defines += [ "SQLITE_DISTRIBUTE_RELATIONAL" ] } } config("native_rdb_public_config") { visibility = [ "//foundation/distributeddatamgr/relational_store:*" ] if (is_mingw || is_mac) { include_dirs = [ "mock/include", "include", ] } else { include_dirs = [ "include", "//foundation/distributeddatamgr/distributedfile/interfaces/kits/js/src/mod_securitylabel", ] } defines = [ "SQLITE_HAS_CODEC" ] } ohos_shared_library("native_rdb") { part_name = "relational_store" sources = [ "${relational_store_native_path}/rdb/src/abs_predicates.cpp", "${relational_store_native_path}/rdb/src/abs_rdb_predicates.cpp", "${relational_store_native_path}/rdb/src/abs_result_set.cpp", "${relational_store_native_path}/rdb/src/base_transaction.cpp", "${relational_store_native_path}/rdb/src/base_transaction.h", "${relational_store_native_path}/rdb/src/logger.h", "${relational_store_native_path}/rdb/src/rdb_helper.cpp", "${relational_store_native_path}/rdb/src/rdb_predicates.cpp", "${relational_store_native_path}/rdb/src/rdb_store_config.cpp", "${relational_store_native_path}/rdb/src/rdb_store_impl.cpp", "${relational_store_native_path}/rdb/src/sqlite_config.cpp", "${relational_store_native_path}/rdb/src/sqlite_connection.cpp", "${relational_store_native_path}/rdb/src/sqlite_connection_pool.cpp", "${relational_store_native_path}/rdb/src/sqlite_database_utils.cpp", "${relational_store_native_path}/rdb/src/sqlite_global_config.cpp", "${relational_store_native_path}/rdb/src/sqlite_sql_builder.cpp", "${relational_store_native_path}/rdb/src/sqlite_statement.cpp", "${relational_store_native_path}/rdb/src/sqlite_utils.cpp", "${relational_store_native_path}/rdb/src/step_result_set.cpp", "${relational_store_native_path}/rdb/src/store_session.cpp", "${relational_store_native_path}/rdb/src/string_utils.cpp", "${relational_store_native_path}/rdb/src/value_object.cpp", "${relational_store_native_path}/rdb/src/values_bucket.cpp", ] configs = [ ":native_rdb_config" ] deps = [ "//third_party/icu/icu4c:shared_icui18n", "//third_party/icu/icu4c:shared_icuuc", ] if (is_mingw) { deps += [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_windows", "//third_party/sqlite:sqlite_sdk", ] } else if (is_mac) { deps += [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_mac", "//third_party/sqlite:sqlite_sdk", ] } else { deps += [ "//third_party/sqlite:sqlite" ] ldflags = [ "-Wl,--exclude-libs,ALL" ] sources += [ "${relational_store_native_path}/rdb/src/abs_shared_result_set.cpp", "${relational_store_native_path}/rdb/src/rdb_security_manager.cpp", "${relational_store_native_path}/rdb/src/result_set_proxy.cpp", "${relational_store_native_path}/rdb/src/security_policy.cpp", "${relational_store_native_path}/rdb/src/share_block.cpp", "${relational_store_native_path}/rdb/src/shared_block_serializer_info.cpp", "${relational_store_native_path}/rdb/src/sqlite_shared_result_set.cpp", "${relational_store_native_path}/rdb_device_manager_adapter/src/rdb_device_manager_adapter.cpp", ] public_deps = [ "${relational_store_innerapi_path}/appdatafwk:native_appdatafwk", "//base/security/huks/frameworks/huks_standard/main/os_dependency:libhuks_os_dependency_standard_static", "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb", "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", ] external_deps = [ "c_utils:utils", "device_manager:devicemanagersdk", "hilog_native:libhilog", "hitrace_native:hitrace_meter", "hitrace_native:libhitracechain", "huks:libhukssdk", "ipc:ipc_core", ] } public_configs = [ ":native_rdb_public_config" ] subsystem_name = "distributeddatamgr" }