• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
13
14import("//build/ohos.gni")
15
16# Lets callers do '#include <sqlite3.h>'
17config("sqlite_config") {
18  include_dirs = [
19    "include",
20    "//utils/native/base/include",
21  ]
22}
23
24# This is the configuration used to build sqlite itself.
25# It should not be needed outside of this library.
26config("sqlite3_private_config") {
27  visibility = [ ":*" ]
28  include_dirs = [ "include" ]
29}
30
31group("libsqlite") {
32  public_deps = [ ":sqlite" ]
33}
34
35ohos_shared_library("sqlite") {
36  visibility = [ "//foundation/distributeddatamgr/*" ]
37  visibility += [ "//foundation/multimodalinput/*" ]
38  visibility +=
39      [ "//hit/fuzzing_test/projects/multimodal_InputService_fuzzer/*" ]
40  visibility += [ "//foundation/communication/*" ]
41  visibility += [ "//build/common/*" ]
42  visibility += [ ":*" ]
43  visibility += [ "//base/security/permission/*" ]
44  visibility += [ "//third_party/libsoup/*" ]
45  visibility += [ "//base/security/access_token/*" ]
46
47  sources = [ "src/sqlite3.c" ]
48
49  defines = [
50    "NDEBUG=1",
51    "HAVE_USLEEP=1",
52    "SQLITE_HAVE_ISNAN",
53    "SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576",
54    "SQLITE_THREADSAFE=2",
55    "SQLITE_TEMP_STORE=3",
56    "SQLITE_POWERSAFE_OVERWRITE=1",
57    "SQLITE_DEFAULT_FILE_FORMAT=4",
58    "SQLITE_DEFAULT_AUTOVACUUM=1",
59    "SQLITE_ENABLE_MEMORY_MANAGEMENT=1",
60    "SQLITE_ENABLE_FTS3",
61    "SQLITE_ENABLE_FTS4",
62    "SQLITE_OMIT_COMPILEOPTION_DIAGS",
63    "SQLITE_OMIT_LOAD_EXTENSION",
64    "SQLITE_DEFAULT_FILE_PERMISSIONS=0660",
65    "SQLITE_SECURE_DELETE",
66    "SQLITE_ENABLE_BATCH_ATOMIC_WRITE",
67    "USE_PREAD64",
68    "fdatasync=fdatasync",
69    "HAVE_MALLOC_H=1",
70    "HAVE_MALLOC_USABLE_SIZE",
71    "SQLITE_DIRECT_OVERFLOW_READ",
72    "SQLITE_HAS_CODEC",
73    "SQLITE3_HW_EXPORT_SYMBOLS",
74    "SQLITE_SHARED_BLOCK_OPTIMIZATION",
75    "SQLITE_CODEC_ATTACH_CHANGED",
76  ]
77  cflags_c = [ "-fvisibility=hidden" ]
78  ldflags = [ "-Wl,--exclude-libs,ALL" ]
79  deps = [
80    "//third_party/openssl:libcrypto_static",
81    "//utils/native/base:utils",
82  ]
83  public_configs = [ ":sqlite_config" ]
84  configs = [ ":sqlite3_private_config" ]
85  part_name = "common"
86}
87
88ohos_executable("sqlite3") {
89  include_dirs = [ "include" ]
90  sources = [
91    "src/shell.c",
92    "src/sqlite3.c",
93  ]
94
95  defines = [
96    "NDEBUG=1",
97    "HAVE_USLEEP=1",
98    "SQLITE_HAVE_ISNAN",
99    "SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576",
100    "SQLITE_THREADSAFE=2",
101    "SQLITE_TEMP_STORE=3",
102    "SQLITE_POWERSAFE_OVERWRITE=1",
103    "SQLITE_DEFAULT_FILE_FORMAT=4",
104    "SQLITE_DEFAULT_AUTOVACUUM=1",
105    "SQLITE_ENABLE_MEMORY_MANAGEMENT=1",
106    "SQLITE_ENABLE_FTS3",
107    "SQLITE_ENABLE_FTS4",
108    "SQLITE_OMIT_COMPILEOPTION_DIAGS",
109    "SQLITE_OMIT_LOAD_EXTENSION",
110    "SQLITE_DEFAULT_FILE_PERMISSIONS=0600",
111    "SQLITE_SECURE_DELETE",
112    "SQLITE_ENABLE_BATCH_ATOMIC_WRITE",
113    "USE_PREAD64",
114    "fdatasync=fdatasync",
115    "SQLITE_DIRECT_OVERFLOW_READ",
116    "SQLITE_SHARED_BLOCK_OPTIMIZATION",
117  ]
118
119  cflags = [ "-Wno-error=implicit-function-declaration" ]
120}
121