tuple: update to make use of C++11
[chromium-blink-merge.git] / third_party / sqlite / BUILD.gn
blob3d994d2053d70526240256ae413537542cd30064
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.h",
12     "amalgamation/sqlite3.c",
14     # fts2.c currently has a lot of conflicts when added to
15     # the amalgamation.  It is probably not worth fixing that.
16     "src/ext/fts2/fts2.c",
17     "src/ext/fts2/fts2.h",
18     "src/ext/fts2/fts2_hash.c",
19     "src/ext/fts2/fts2_hash.h",
20     "src/ext/fts2/fts2_icu.c",
21     "src/ext/fts2/fts2_porter.c",
22     "src/ext/fts2/fts2_tokenizer.c",
23     "src/ext/fts2/fts2_tokenizer.h",
24     "src/ext/fts2/fts2_tokenizer1.c",
25   ]
27   cflags = []
28   defines = [
29     "SQLITE_CORE",
30     "SQLITE_ENABLE_BROKEN_FTS2",
31     "SQLITE_ENABLE_FTS2",
32     "SQLITE_ENABLE_FTS3",
33     "SQLITE_ENABLE_ICU",
34     "SQLITE_ENABLE_MEMORY_MANAGEMENT",
35     "SQLITE_SECURE_DELETE",
36     "SQLITE_SEPARATE_CACHE_POOLS",
37     "THREADSAFE",
38     "_HAS_EXCEPTIONS=0",
39   ]
40   if (is_chromeos) {
41     defines += [
42       # Despite obvious warnings about not using this flag in deployment, we
43       # are turning off sync in ChromeOS and relying on the underlying
44       # journaling filesystem to do error recovery properly. It's much faster.
45       "SQLITE_NO_SYNC",
46     ]
47   }
49   include_dirs = [
50     "amalgamation",
51     "src/src",  # Needed for fts2 to build.
52   ]
54   configs -= [ "//build/config/compiler:chromium_code" ]
55   configs += [ "//build/config/compiler:no_chromium_code" ]
57   if (is_win) {
58     cflags += [ "/wd4267" ]  # Conversion from size_t to "type".
59   } else if (is_linux) {
60     cflags += [
61       # SQLite doesn"t believe in compiler warnings,
62       # preferring testing.
63       #   http://www.sqlite.org/faq.html#q17
64       "-Wno-int-to-pointer-cast",
65       "-Wno-pointer-to-int-cast",
66     ]
67     libs = [ "dl" ]
68   } else if (is_mac || is_ios) {
69     libs = [ "CoreFoundation.framework" ]
70   } else if (is_android) {
71     defines += [
72       "HAVE_USLEEP=1",
73       "SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576",
74       "SQLITE_DEFAULT_AUTOVACUUM=1",
75       "SQLITE_TEMP_STORE=3",
76       "SQLITE_ENABLE_FTS3_BACKWARDS",
77       "DSQLITE_DEFAULT_FILE_FORMAT=4",
78     ]
79   }
81   if (is_clang) {
82     cflags += [
83       # sqlite does `if (*a++ && *b++);` in a non-buggy way.
84       "-Wno-empty-body",
86       # sqlite has some `unsigned < 0` checks.
87       "-Wno-tautological-compare",
89       # Needed because we don't have this commit yet:
90       # https://github.com/mackyle/sqlite/commit/25df0fa050dcc9be7fb937b8e25be24049b3fef0
91       "-Wno-pointer-bool-conversion",
92     ]
93   }
95   public_configs = [ ":sqlite_config" ]
97   deps = [
98     "//third_party/icu",
99   ]
102 if (is_linux) {
103   executable("sqlite_shell") {
104     sources = [
105       "src/src/shell.c",
106       "src/src/shell_icu_linux.c",
108       # Include a dummy c++ file to force linking of libstdc++.
109       "build_as_cpp.cc",
110     ]
112     deps = [
113       ":sqlite",
114       "//third_party/icu",
115     ]
116   }
119 if (is_ios) {
120   source_set("sqlite_regexp") {
121     sources = [
122       "src/ext/icu/icu.c",
123     ]
124     deps = [
125       "//third_party/icu",
126     ]
127   }