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