From 146cfaaca9e80a0e148b5f94455c3ebddd5d369b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B5=B7=E7=A1=95?= <2627006591@qq.com> Date: Mon, 18 Nov 2024 10:50:49 +0800 Subject: [PATCH] sqlite fts adapt icu Signed-off-by: wanghaishuo --- BUILD.gn | 12 ++++++++++++ bundle.json | 3 ++- sqlite.gni | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 sqlite.gni diff --git a/BUILD.gn b/BUILD.gn index 570cebb..349c79a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -12,6 +12,7 @@ # limitations under the License. import("//build/ohos.gni") +import("//third_party/sqlite/sqlite.gni") is_cross_platform_build = defined(is_arkui_x) && is_arkui_x @@ -46,9 +47,11 @@ ohos_shared_library("sqlite") { "SQLITE_DEFAULT_FILE_FORMAT=4", "SQLITE_DEFAULT_AUTOVACUUM=1", "SQLITE_ENABLE_MEMORY_MANAGEMENT=1", + "SQLITE_ENABLE_LOAD_EXTENSION", "SQLITE_ENABLE_FTS3", "SQLITE_ENABLE_FTS4", "SQLITE_ENABLE_FTS5", + "SQLITE_ENABLE_FTS3_TOKENIZER", "SQLITE_OMIT_COMPILEOPTION_DIAGS", "SQLITE_DEFAULT_FILE_PERMISSIONS=0660", "SQLITE_SECURE_DELETE", @@ -68,6 +71,9 @@ ohos_shared_library("sqlite") { "FDSAN_ENABLE", "HARMONY_OS", ] + if (os_level == "standard" && sqlite_support_icu) { + defines += [ "SQLITE_ENABLE_ICU" ] + } cflags_c = [ "-fvisibility=hidden", "-Wno-implicit-fallthrough", @@ -95,6 +101,12 @@ ohos_shared_library("sqlite") { "c_utils:utils", "openssl:libcrypto_shared", ] + if (os_level == "standard" && sqlite_support_icu) { + external_deps += [ + "icu:shared_icui18n", + "icu:shared_icuuc", + ] + } } } diff --git a/bundle.json b/bundle.json index c2501b6..1fea87d 100644 --- a/bundle.json +++ b/bundle.json @@ -14,13 +14,14 @@ "name": "sqlite", "subsystem": "thirdparty", "syscap": [], - "features": [], + "features": ["sqlite_support_icu"], "adapted_system_type": [ "standard" ], "rom": "2200KB", "ram": "1024KB", "deps": { "components": [ "c_utils", + "icu", "openssl" ], "third_party": [ diff --git a/sqlite.gni b/sqlite.gni new file mode 100644 index 0000000..97c7d72 --- /dev/null +++ b/sqlite.gni @@ -0,0 +1,16 @@ +# Copyright (c) 2024 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. + +declare_args() { + sqlite_support_icu = true +} -- Gitee