1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
6 # Controls whether the build should uses the version of sqlite3 library
7 # shipped with the system (currently only supported on iOS) or the one
8 # shipped with Chromium source.
9 use_system_sqlite = is_ios
12 if (!use_system_sqlite) {
13 # TODO(shess): This cannot possibly be the right thing to do. AFAICT it is
14 # only necessary so that WebDatabase can #include <sqlite3.h>.
15 config("sqlite_config") {
16 include_dirs = [ "." ]
19 config("sqlite_warnings") {
22 # sqlite contains a few functions that are unused, at least on
23 # Windows with Chromium's sqlite patches applied
24 # (interiorCursorEOF fts3EvalDeferredPhrase
25 # fts3EvalSelectDeferred sqlite3Fts3InitHashTable
26 # sqlite3Fts3InitTok).
27 cflags += [ "-Wno-unused-function" ]
31 # SQLite doesn"t believe in compiler warnings,
33 # http://www.sqlite.org/faq.html#q17
34 "-Wno-int-to-pointer-cast",
35 "-Wno-pointer-to-int-cast",
40 # "sqlite3" can cause conflicts with the system library.
41 component("chromium_sqlite3") {
45 "amalgamation/sqlite3.c",
46 "amalgamation/sqlite3.h",
52 "SQLITE_DISABLE_FTS3_UNICODE",
53 "SQLITE_DISABLE_FTS4_DEFERRED",
55 "SQLITE_ENABLE_MEMORY_MANAGEMENT",
56 "SQLITE_SECURE_DELETE",
57 "SQLITE_SEPARATE_CACHE_POOLS",
60 if (is_component_build) {
62 defines += [ "SQLITE_API=__declspec(dllexport)" ]
64 defines += [ "SQLITE_API=__attribute__((visibility(\"default\")))" ]
69 # Despite obvious warnings about not using this flag in deployment, we
70 # are turning off sync in ChromeOS and relying on the underlying
71 # journaling filesystem to do error recovery properly. It's much faster.
77 # Allow xSleep() call on Unix to use usleep() rather than sleep(), so it
78 # will have microsecond precision. Should only affect contended databases
79 # via the busy callback. Browser profile databases are mostly exclusive,
80 # but renderer databases may allow for contention.
84 if (is_linux || is_android) {
86 # Linux provides fdatasync(), a faster equivalent of fsync().
87 "fdatasync=fdatasync",
91 include_dirs = [ "amalgamation" ]
93 configs -= [ "//build/config/compiler:chromium_code" ]
95 "//build/config/compiler:no_chromium_code",
97 # Must be after no_chromium_code for warning flags to be ordered
104 } else if (is_mac || is_ios) {
106 "CoreFoundation.framework",
107 "CoreServices.framework",
109 } else if (is_android) {
111 "SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576",
112 "SQLITE_DEFAULT_AUTOVACUUM=1",
113 "SQLITE_TEMP_STORE=3",
114 "SQLITE_ENABLE_FTS3_BACKWARDS",
115 "DSQLITE_DEFAULT_FILE_FORMAT=4",
124 config("sqlite_export") {
125 if (is_component_build && is_win) {
126 defines = [ "SQLITE_API=__declspec(dllimport)" ]
130 # This is used to allow the SQLITE_API definition to be different when
131 # building sqlite3.c than it is when clients include sqlite3.h.
133 public_deps = [ ":chromium_sqlite3" ]
134 public_configs = [ ":sqlite_export", ":sqlite_config" ]
138 executable("sqlite_shell") {
141 "src/src/shell_icu_linux.c",
143 # Include a dummy c++ file to force linking of libstdc++.
149 "//build/config/sanitizers:deps",
156 if (use_system_sqlite) {
157 # iOS uses the version of sqlite3 shipped with the system instead of the
158 # version shipped with Chromium. Export a "sqlite" target so the change
159 # can be localized to this file.
161 config("sqlite_config") {
162 defines = [ "USE_SYSTEM_SQLITE" ]
166 assert(false, "extra flags to use system sqlite3 library missing")
170 source_set("sqlite") {
171 public_configs = [ ":sqlite_config" ]
180 source_set("sqlite_regexp") {
182 # Necessary to statically compile the extension.
184 "SQLITE_DISABLE_FTS3_UNICODE",
185 "SQLITE_DISABLE_FTS4_DEFERRED",
186 "SQLITE_ENABLE_FTS3",
188 "SQLITE_ENABLE_MEMORY_MANAGEMENT",
189 "SQLITE_SECURE_DELETE",
190 "SQLITE_SEPARATE_CACHE_POOLS",
200 # src/ext/icu/icu.c uses assert(!"string") which causes warnings about
201 # conversion from string literal to bool.
202 configs -= [ "//build/config/clang:extra_warnings" ]