Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / third_party / sqlite / BUILD.gn
blob922136913b7d86d2531ceb4360c1c8166c1186a6
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.
5 config("sqlite_config") {
6   include_dirs = [ "." ]
9 source_set("sqlite") {
10   sources = [
11     "amalgamation/sqlite3.c",
12     "amalgamation/sqlite3.h",
13   ]
15   cflags = []
16   defines = [
17     "SQLITE_ENABLE_FTS3",
18     "SQLITE_DISABLE_FTS3_UNICODE",
19     "SQLITE_DISABLE_FTS4_DEFERRED",
20     "SQLITE_ENABLE_ICU",
21     "SQLITE_ENABLE_MEMORY_MANAGEMENT",
22     "SQLITE_SECURE_DELETE",
23     "SQLITE_SEPARATE_CACHE_POOLS",
24     "THREADSAFE",
25     "_HAS_EXCEPTIONS=0",
26   ]
27   if (is_chromeos) {
28     defines += [
29       # Despite obvious warnings about not using this flag in deployment, we
30       # are turning off sync in ChromeOS and relying on the underlying
31       # journaling filesystem to do error recovery properly. It's much faster.
32       "SQLITE_NO_SYNC",
33     ]
34   }
35   if (is_posix) {
36     defines += [
37       # Allow xSleep() call on Unix to use usleep() rather than sleep(), so it
38       # will have microsecond precision.  Should only affect contended databases
39       # via the busy callback.  Browser profile databases are mostly exclusive,
40       # but renderer databases may allow for contention.
41       "HAVE_USLEEP=1",
42     ]
43   }
44   if (is_linux || is_android) {
45     defines += [
46       # Linux provides fdatasync(), a faster equivalent of fsync().
47       "fdatasync=fdatasync",
48     ]
49   }
51   include_dirs = [ "amalgamation" ]
53   configs -= [ "//build/config/compiler:chromium_code" ]
54   configs += [ "//build/config/compiler:no_chromium_code" ]
56   if (is_linux) {
57     cflags += [
58       # SQLite doesn"t believe in compiler warnings,
59       # preferring testing.
60       #   http://www.sqlite.org/faq.html#q17
61       "-Wno-int-to-pointer-cast",
62       "-Wno-pointer-to-int-cast",
63     ]
64     libs = [ "dl" ]
65   } else if (is_mac || is_ios) {
66     libs = [ "CoreFoundation.framework" ]
67   } else if (is_android) {
68     defines += [
69       "SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576",
70       "SQLITE_DEFAULT_AUTOVACUUM=1",
71       "SQLITE_TEMP_STORE=3",
72       "SQLITE_ENABLE_FTS3_BACKWARDS",
73       "DSQLITE_DEFAULT_FILE_FORMAT=4",
74     ]
75   }
77   public_configs = [ ":sqlite_config" ]
79   deps = [
80     "//third_party/icu",
81   ]
84 if (is_linux) {
85   executable("sqlite_shell") {
86     sources = [
87       "src/src/shell.c",
88       "src/src/shell_icu_linux.c",
90       # Include a dummy c++ file to force linking of libstdc++.
91       "build_as_cpp.cc",
92     ]
94     deps = [
95       ":sqlite",
96       "//third_party/icu",
97     ]
98   }
101 if (is_ios) {
102   source_set("sqlite_regexp") {
103     defines += [
104       # Necessary to statically compile the extension.
105       "SQLITE_CORE",
106     ]
107     sources = [
108       "src/ext/icu/icu.c",
109     ]
110     deps = [
111       "//third_party/icu",
112     ]
113   }