OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 declare_args() { | 5 declare_args() { |
6 # Controls whether the build should uses the version of sqlite3 library | 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 | 7 # shipped with the system (currently only supported on iOS) or the one |
8 # shipped with Chromium source. | 8 # shipped with Chromium source. |
9 use_system_sqlite = is_ios | 9 use_system_sqlite = is_ios |
10 } | 10 } |
11 | 11 |
12 if (!use_system_sqlite) { | 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") { | 13 config("sqlite_config") { |
16 include_dirs = [ "." ] | 14 include_dirs = [ "." ] |
17 } | 15 } |
18 | 16 |
19 config("sqlite_warnings") { | 17 config("sqlite_warnings") { |
20 cflags = [] | 18 cflags = [] |
21 if (is_clang) { | 19 if (is_clang) { |
22 # sqlite contains a few functions that are unused, at least on | 20 # sqlite contains a few functions that are unused, at least on |
23 # Windows with Chromium's sqlite patches applied | 21 # Windows with Chromium's sqlite patches applied |
24 # (interiorCursorEOF fts3EvalDeferredPhrase | 22 # (interiorCursorEOF fts3EvalDeferredPhrase |
25 # fts3EvalSelectDeferred sqlite3Fts3InitHashTable | 23 # fts3EvalSelectDeferred sqlite3Fts3InitHashTable |
26 # sqlite3Fts3InitTok). | 24 # sqlite3Fts3InitTok). |
27 cflags += [ "-Wno-unused-function" ] | 25 cflags += [ "-Wno-unused-function" ] |
28 } | 26 } |
29 if (is_linux) { | 27 if (is_linux) { |
30 cflags += [ | 28 cflags += [ |
31 # SQLite doesn"t believe in compiler warnings, | 29 # SQLite doesn"t believe in compiler warnings, |
32 # preferring testing. | 30 # preferring testing. |
33 # http://www.sqlite.org/faq.html#q17 | 31 # http://www.sqlite.org/faq.html#q17 |
34 "-Wno-int-to-pointer-cast", | 32 "-Wno-int-to-pointer-cast", |
35 "-Wno-pointer-to-int-cast", | 33 "-Wno-pointer-to-int-cast", |
36 ] | 34 ] |
37 } | 35 } |
38 } | 36 } |
39 | 37 |
40 component("sqlite_build") { | 38 source_set("sqlite") { |
41 visibility = [ ":*" ] | |
42 | |
43 sources = [ | 39 sources = [ |
44 "amalgamation/sqlite3.c", | 40 "amalgamation/sqlite3.c", |
45 "amalgamation/sqlite3.h", | 41 "amalgamation/sqlite3.h", |
46 ] | 42 ] |
47 | 43 |
48 cflags = [] | 44 cflags = [] |
49 defines = [ | 45 defines = [ |
50 "SQLITE_ENABLE_FTS3", | 46 "SQLITE_ENABLE_FTS3", |
51 "SQLITE_DISABLE_FTS3_UNICODE", | 47 "SQLITE_DISABLE_FTS3_UNICODE", |
52 "SQLITE_DISABLE_FTS4_DEFERRED", | 48 "SQLITE_DISABLE_FTS4_DEFERRED", |
53 "SQLITE_ENABLE_ICU", | 49 "SQLITE_ENABLE_ICU", |
54 "SQLITE_ENABLE_MEMORY_MANAGEMENT", | 50 "SQLITE_ENABLE_MEMORY_MANAGEMENT", |
55 "SQLITE_SECURE_DELETE", | 51 "SQLITE_SECURE_DELETE", |
56 "SQLITE_SEPARATE_CACHE_POOLS", | 52 "SQLITE_SEPARATE_CACHE_POOLS", |
57 "THREADSAFE", | 53 "THREADSAFE", |
58 ] | 54 ] |
59 if (is_component_build) { | |
60 if (is_win) { | |
61 defines += [ "SQLITE_API=__declspec(dllexport)" ] | |
62 } else { | |
63 defines += [ "SQLITE_API=__attribute__((visibility(\"default\")))" ] | |
64 } | |
65 } | |
66 if (is_chromeos) { | 55 if (is_chromeos) { |
67 defines += [ | 56 defines += [ |
68 # Despite obvious warnings about not using this flag in deployment, we | 57 # Despite obvious warnings about not using this flag in deployment, we |
69 # are turning off sync in ChromeOS and relying on the underlying | 58 # are turning off sync in ChromeOS and relying on the underlying |
70 # journaling filesystem to do error recovery properly. It's much faster. | 59 # journaling filesystem to do error recovery properly. It's much faster. |
71 "SQLITE_NO_SYNC", | 60 "SQLITE_NO_SYNC", |
72 ] | 61 ] |
73 } | 62 } |
74 if (is_posix) { | 63 if (is_posix) { |
75 defines += [ | 64 defines += [ |
(...skipping 13 matching lines...) Expand all Loading... |
89 | 78 |
90 include_dirs = [ "amalgamation" ] | 79 include_dirs = [ "amalgamation" ] |
91 | 80 |
92 configs -= [ "//build/config/compiler:chromium_code" ] | 81 configs -= [ "//build/config/compiler:chromium_code" ] |
93 configs += [ "//build/config/compiler:no_chromium_code" ] | 82 configs += [ "//build/config/compiler:no_chromium_code" ] |
94 configs += [ ":sqlite_warnings" ] | 83 configs += [ ":sqlite_warnings" ] |
95 | 84 |
96 if (is_linux) { | 85 if (is_linux) { |
97 libs = [ "dl" ] | 86 libs = [ "dl" ] |
98 } else if (is_mac || is_ios) { | 87 } else if (is_mac || is_ios) { |
99 libs = [ | 88 libs = [ "CoreFoundation.framework" ] |
100 "CoreFoundation.framework", | |
101 "CoreServices.framework", | |
102 ] | |
103 } else if (is_android) { | 89 } else if (is_android) { |
104 defines += [ | 90 defines += [ |
105 "SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576", | 91 "SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576", |
106 "SQLITE_DEFAULT_AUTOVACUUM=1", | 92 "SQLITE_DEFAULT_AUTOVACUUM=1", |
107 "SQLITE_TEMP_STORE=3", | 93 "SQLITE_TEMP_STORE=3", |
108 "SQLITE_ENABLE_FTS3_BACKWARDS", | 94 "SQLITE_ENABLE_FTS3_BACKWARDS", |
109 "DSQLITE_DEFAULT_FILE_FORMAT=4", | 95 "DSQLITE_DEFAULT_FILE_FORMAT=4", |
110 ] | 96 ] |
111 } | 97 } |
112 | 98 |
113 deps = [ | 99 deps = [ |
114 "//third_party/icu", | 100 "//third_party/icu", |
115 ] | 101 ] |
116 } | |
117 | 102 |
118 config("sqlite_export") { | 103 public_configs = [ ":sqlite_config" ] |
119 if (is_component_build && is_win) { | |
120 defines = [ "SQLITE_API=__declspec(dllimport)" ] | |
121 } | |
122 } | |
123 | |
124 # This is used to allow the SQLITE_API definition to be different when | |
125 # building sqlite3.c than it is when clients include sqlite3.h. | |
126 group("sqlite") { | |
127 public_deps = [ ":sqlite_build" ] | |
128 public_configs = [ ":sqlite_export", ":sqlite_config" ] | |
129 } | 104 } |
130 | 105 |
131 if (is_linux) { | 106 if (is_linux) { |
132 executable("sqlite_shell") { | 107 executable("sqlite_shell") { |
133 sources = [ | 108 sources = [ |
134 "src/src/shell.c", | 109 "src/src/shell.c", |
135 "src/src/shell_icu_linux.c", | 110 "src/src/shell_icu_linux.c", |
136 | 111 |
137 # Include a dummy c++ file to force linking of libstdc++. | 112 # Include a dummy c++ file to force linking of libstdc++. |
138 "build_as_cpp.cc", | 113 "build_as_cpp.cc", |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 "//third_party/icu", | 165 "//third_party/icu", |
191 ] | 166 ] |
192 if (is_clang) { | 167 if (is_clang) { |
193 # src/ext/icu/icu.c uses assert(!"string") which causes warnings about | 168 # src/ext/icu/icu.c uses assert(!"string") which causes warnings about |
194 # conversion from string literal to bool. | 169 # conversion from string literal to bool. |
195 configs -= [ "//build/config/clang:extra_warnings" ] | 170 configs -= [ "//build/config/clang:extra_warnings" ] |
196 } | 171 } |
197 } | 172 } |
198 } | 173 } |
199 } | 174 } |
OLD | NEW |