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 config("sqlite_config") {
14 include_dirs = [ "." ]
17 source_set("sqlite") {
19 "amalgamation/sqlite3.c",
20 "amalgamation/sqlite3.h",
26 "SQLITE_DISABLE_FTS3_UNICODE",
27 "SQLITE_DISABLE_FTS4_DEFERRED",
29 "SQLITE_ENABLE_MEMORY_MANAGEMENT",
30 "SQLITE_SECURE_DELETE",
31 "SQLITE_SEPARATE_CACHE_POOLS",
36 # Despite obvious warnings about not using this flag in deployment, we
37 # are turning off sync in ChromeOS and relying on the underlying
38 # journaling filesystem to do error recovery properly. It's much faster.
44 # Allow xSleep() call on Unix to use usleep() rather than sleep(), so it
45 # will have microsecond precision. Should only affect contended databases
46 # via the busy callback. Browser profile databases are mostly exclusive,
47 # but renderer databases may allow for contention.
51 if (is_linux || is_android) {
53 # Linux provides fdatasync(), a faster equivalent of fsync().
54 "fdatasync=fdatasync",
58 include_dirs = [ "amalgamation" ]
60 config("sqlite_warnings") {
63 # sqlite contains a few functions that are unused, at least on
64 # Windows with Chromium's sqlite patches applied
65 # (interiorCursorEOF fts3EvalDeferredPhrase
66 # fts3EvalSelectDeferred sqlite3Fts3InitHashTable
67 # sqlite3Fts3InitTok).
68 cflags += [ "-Wno-unused-function" ]
72 # SQLite doesn"t believe in compiler warnings,
74 # http://www.sqlite.org/faq.html#q17
75 "-Wno-int-to-pointer-cast",
76 "-Wno-pointer-to-int-cast",
80 configs -= [ "//build/config/compiler:chromium_code" ]
81 configs += [ "//build/config/compiler:no_chromium_code" ]
82 configs += [ ":sqlite_warnings" ]
86 } else if (is_mac || is_ios) {
87 libs = [ "CoreFoundation.framework" ]
88 } else if (is_android) {
90 "SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576",
91 "SQLITE_DEFAULT_AUTOVACUUM=1",
92 "SQLITE_TEMP_STORE=3",
93 "SQLITE_ENABLE_FTS3_BACKWARDS",
94 "DSQLITE_DEFAULT_FILE_FORMAT=4",
102 public_configs = [ ":sqlite_config" ]
106 executable("sqlite_shell") {
109 "src/src/shell_icu_linux.c",
111 # Include a dummy c++ file to force linking of libstdc++.
123 if (use_system_sqlite) {
124 # iOS uses the version of sqlite3 shipped with the system instead of the
125 # version shipped with Chromium. Export a "sqlite" target so the change
126 # can be localized to this file.
128 config("sqlite_config") {
129 defines = [ "USE_SYSTEM_SQLITE" ]
133 assert(false, "extra flags to use system sqlite3 library missing")
137 source_set("sqlite") {
138 public_configs = [ ":sqlite_config" ]
147 source_set("sqlite_regexp") {
149 # Necessary to statically compile the extension.
151 "SQLITE_DISABLE_FTS3_UNICODE",
152 "SQLITE_DISABLE_FTS4_DEFERRED",
153 "SQLITE_ENABLE_FTS3",
155 "SQLITE_ENABLE_MEMORY_MANAGEMENT",
156 "SQLITE_SECURE_DELETE",
157 "SQLITE_SEPARATE_CACHE_POOLS",
167 # src/ext/icu/icu.c uses assert(!"string") which causes warnings about
168 # conversion from string literal to bool.
169 configs -= [ "//build/config/clang:extra_warnings" ]