Isolate extensions_browsertests
[chromium-blink-merge.git] / third_party / sqlite / sqlite.gyp
blobbb18457a34cce499db03b65091b0b162bb2e6085
1 # Copyright (c) 2012 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   'variables': {
7     'use_system_sqlite%': 0,
8     'required_sqlite_version': '3.6.1',
9   },
10   'target_defaults': {
11     'defines': [
12       'SQLITE_CORE',
13       'SQLITE_ENABLE_FTS3',
14       'SQLITE_ENABLE_ICU',
15       'SQLITE_ENABLE_MEMORY_MANAGEMENT',
16       'SQLITE_SECURE_DELETE',
17       'SQLITE_SEPARATE_CACHE_POOLS',
18       'THREADSAFE',
19       '_HAS_EXCEPTIONS=0',
20     ],
21   },
22   'targets': [
23     {
24       'target_name': 'sqlite',
25       'conditions': [
26         [ 'chromeos==1' , {
27             'defines': [
28                 # Despite obvious warnings about not using this flag
29                 # in deployment, we are turning off sync in ChromeOS
30                 # and relying on the underlying journaling filesystem
31                 # to do error recovery properly.  It's much faster.
32                 'SQLITE_NO_SYNC',
33                 ],
34           },
35         ],
36         ['os_posix == 1', {
37           'defines': [
38             # Allow xSleep() call on Unix to use usleep() rather than sleep().
39             # Microsecond precision is better than second precision.  Should
40             # only affect contended databases via the busy callback.  Browser
41             # profile databases are mostly exclusive, but renderer databases may
42             # allow for contention.
43             'HAVE_USLEEP=1',
44           ],
45         }],
46         ['use_system_sqlite', {
47           'type': 'none',
48           'direct_dependent_settings': {
49             'defines': [
50               'USE_SYSTEM_SQLITE',
51             ],
52           },
54           'conditions': [
55             ['OS == "ios"', {
56               'dependencies': [
57                 'sqlite_regexp',
58               ],
59               'link_settings': {
60                 'libraries': [
61                   '$(SDKROOT)/usr/lib/libsqlite3.dylib',
62                 ],
63               },
64             }],
65             ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
66               'direct_dependent_settings': {
67                 'cflags': [
68                   # This next command produces no output but it it will fail
69                   # (and cause GYP to fail) if we don't have a recent enough
70                   # version of sqlite.
71                   '<!@(pkg-config --atleast-version=<(required_sqlite_version) sqlite3)',
73                   '<!@(pkg-config --cflags sqlite3)',
74                 ],
75               },
76               'link_settings': {
77                 'ldflags': [
78                   '<!@(pkg-config --libs-only-L --libs-only-other sqlite3)',
79                 ],
80                 'libraries': [
81                   '<!@(pkg-config --libs-only-l sqlite3)',
82                 ],
83               },
84             }],
85           ],
86         }, { # !use_system_sqlite
87           'product_name': 'sqlite3',
88           'type': 'static_library',
89           'sources': [
90             'amalgamation/sqlite3.h',
91             'amalgamation/sqlite3.c',
92           ],
94           # TODO(shess): Previously fts1 and rtree files were
95           # explicitly excluded from the build.  Make sure they are
96           # logically still excluded.
98           # TODO(shess): Should all of the sources be listed and then
99           # excluded?  For editing purposes?
101           'include_dirs': [
102             'amalgamation',
103           ],
104           'dependencies': [
105             '../icu/icu.gyp:icui18n',
106             '../icu/icu.gyp:icuuc',
107           ],
108           'direct_dependent_settings': {
109             'include_dirs': [
110               '.',
111               '../..',
112             ],
113           },
114           'msvs_disabled_warnings': [
115             4018, 4244, 4267,
116           ],
117           'variables': {
118             'clang_warning_flags': [
119               # sqlite does `if (*a++ && *b++);` in a non-buggy way.
120               '-Wno-empty-body',
121               # sqlite has some `unsigned < 0` checks.
122               '-Wno-tautological-compare',
123               # Needed because we don't have this commit yet:
124               # https://github.com/mackyle/sqlite/commit/25df0fa050dcc9be7fb937b8e25be24049b3fef0
125               '-Wno-pointer-bool-conversion',
126             ],
127           },
128           'conditions': [
129             ['OS=="linux"', {
130               'link_settings': {
131                 'libraries': [
132                   '-ldl',
133                 ],
134               },
135             }],
136             ['OS == "mac" or OS == "ios"', {
137               'link_settings': {
138                 'libraries': [
139                   '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
140                 ],
141               },
142             }],
143             ['OS == "android"', {
144               'defines': [
145                 'SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576',
146                 'SQLITE_DEFAULT_AUTOVACUUM=1',
147                 'SQLITE_TEMP_STORE=3',
148                 'SQLITE_ENABLE_FTS3_BACKWARDS',
149                 'SQLITE_DEFAULT_FILE_FORMAT=4',
150               ],
151             }],
152             ['os_posix == 1 and OS != "mac" and OS != "android"', {
153               'cflags': [
154                 # SQLite doesn't believe in compiler warnings,
155                 # preferring testing.
156                 #   http://www.sqlite.org/faq.html#q17
157                 '-Wno-int-to-pointer-cast',
158                 '-Wno-pointer-to-int-cast',
159               ],
160             }],
161             # Enable feedback-directed optimisation for sqlite when building in android.
162             ['android_webview_build == 1', {
163               'aosp_build_settings': {
164                 'LOCAL_FDO_SUPPORT': 'true',
165               },
166             }],
167             ['sqlite_enable_fts2', {
168               'defines': [
169                 'SQLITE_ENABLE_BROKEN_FTS2',
170                 'SQLITE_ENABLE_FTS2',
171               ],
172               'sources': [
173                 # fts2.c currently has a lot of conflicts when added to
174                 # the amalgamation.  It is probably not worth fixing that.
175                 'src/ext/fts2/fts2.c',
176                 'src/ext/fts2/fts2.h',
177                 'src/ext/fts2/fts2_hash.c',
178                 'src/ext/fts2/fts2_hash.h',
179                 'src/ext/fts2/fts2_icu.c',
180                 'src/ext/fts2/fts2_porter.c',
181                 'src/ext/fts2/fts2_tokenizer.c',
182                 'src/ext/fts2/fts2_tokenizer.h',
183                 'src/ext/fts2/fts2_tokenizer1.c',
184               ],
185               'include_dirs': [
186                 'src/src',
187               ],
188             }],
189           ],
190         }],
191       ],
192       'includes': [
193         # Disable LTO due to ELF section name out of range
194         # crbug.com/422251
195         '../../build/android/disable_lto.gypi',
196       ],
197     },
198   ],
199   'conditions': [
200     ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and not use_system_sqlite', {
201       'targets': [
202         {
203           'target_name': 'sqlite_shell',
204           'type': 'executable',
205           'dependencies': [
206             '../icu/icu.gyp:icuuc',
207             'sqlite',
208           ],
209           'sources': [
210             'src/src/shell.c',
211             'src/src/shell_icu_linux.c',
212             # Include a dummy c++ file to force linking of libstdc++.
213             'build_as_cpp.cc',
214           ],
215         },
216       ],
217     },],
218     ['OS == "ios"', {
219       'targets': [
220         {
221           'target_name': 'sqlite_regexp',
222           'type': 'static_library',
223           'dependencies': [
224             '../icu/icu.gyp:icui18n',
225             '../icu/icu.gyp:icuuc',
226           ],
227           'sources': [
228             'src/ext/icu/icu.c',
229           ],
230         },
231       ],
232     }],
233   ],