diff --git a/BUILD.gn b/BUILD.gn index 6dd82943721118143ddebdbdaae841b02dd386d7..2cc51c13dd68a95ecf7ce8f9c30b85b2f0a99cd1 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -112,6 +112,8 @@ ohos_shared_library("sqlite") { "SQLITE_DIRECT_OVERFLOW_READ", "SQLITE_HAS_CODEC", "SQLITE_EXPORT_SYMBOLS", + "SQLITE_API=SQLITE_EXPORT", + "SQLITE_ENABLE_LOAD_EXTENSION", "SQLITE_SHARED_BLOCK_OPTIMIZATION", "SQLITE_CODEC_ATTACH_CHANGED", "SQLITE_ENABLE_DROPTABLE_CALLBACK", @@ -176,10 +178,7 @@ ohos_shared_library("sqlite") { ohos_executable("sqlite3") { include_dirs = [ "$sqlite_patched_dir/include" ] - sources = [ - "$sqlite_patched_dir/src/shell.c", - "$sqlite_patched_dir/src/sqlite3.c", - ] + sources = ["$sqlite_patched_dir/src/shell.c"] defines = [ "NDEBUG=1", @@ -210,10 +209,20 @@ ohos_executable("sqlite3") { cflags = [ "-Wno-error=implicit-function-declaration", + "-Wno-macro-redefined", "-Wno-implicit-fallthrough", ] - deps = [ "//third_party/sqlite/patch:apply_patch" ] + deps = [ + ":sqlite", + "//third_party/sqlite/patch:apply_patch", + ] + + public_configs = [ ":sqlite_config" ] + external_deps = [ "c_utils:utils" ] + configs = [ ":sqlite3_private_config" ] + part_name = "sqlite" + subsystem_name = "thirdparty" } if (is_mingw || is_mac) { diff --git a/bundle.json b/bundle.json index a72e6fbf0f94c89a0cfab359f1f9001c7b92b5be..8d70d2de9ef56ed45e74448b66a3972b0653f659 100644 --- a/bundle.json +++ b/bundle.json @@ -35,6 +35,7 @@ "build": { "sub_component": [ "//third_party/sqlite:sqlite", + "//third_party/sqlite:sqlite3", "//third_party/sqlite:sqliteicu" ], "inner_kits": [ @@ -50,6 +51,9 @@ }, { "name": "//third_party/sqlite:sqliteicu" + }, + { + "name": "//third_party/sqlite:sqlite3" } ], "test": [ diff --git a/include/sqlite3sym.h b/include/sqlite3sym.h index 59893ffdef6db1a0f96ddf5048da44b0b5e1ec70..4fa7b8fe050e388bf2f851e24ab29a3e22f52e76 100644 --- a/include/sqlite3sym.h +++ b/include/sqlite3sym.h @@ -62,6 +62,7 @@ struct sqlite3_api_routines_hw { }; extern const struct sqlite3_api_routines_hw *sqlite3_export_hw_symbols; +/* 通过符号表实现模块间调用 */ #define sqlite3_initialize sqlite3_export_hw_symbols->initialize #define sqlite3_config sqlite3_export_hw_symbols->config #define sqlite3_key sqlite3_export_hw_symbols->key diff --git a/src/shell.c b/src/shell.c index 7fb190e676b910b3b29c1dc967aaf44e64f0b0e8..32588e3de3ed0c97f64af0b3030b8d742b042bbd 100644 --- a/src/shell.c +++ b/src/shell.c @@ -119,6 +119,7 @@ typedef unsigned short int u16; #include #include #include "sqlite3.h" +#include "sqlite3sym.h" typedef sqlite3_int64 i64; typedef sqlite3_uint64 u64; typedef unsigned char u8; diff --git a/src/sqlite3.c b/src/sqlite3.c index 7fb290f841431817db3b44f1d83fd443b0b1c96d..002416378f38f6e0789021407362d25ae62486ee 100644 --- a/src/sqlite3.c +++ b/src/sqlite3.c @@ -20,6 +20,9 @@ ** The content in this amalgamation comes from Fossil check-in ** f1e31fd9961ac82535a5d0702b127d84de8c. */ +#ifndef SQLITE_EXPORT +#define SQLITE_EXPORT +#endif #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 #ifndef SQLITE_PRIVATE