[ServiceWorker] Add unittests for ServiceWorkerWriteToCacheJob.
[chromium-blink-merge.git] / third_party / sqlite / sqlite.gyp
blob2f80fc66b7e58fe8464e775b48da9ecb76357252
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         ['use_system_sqlite', {
37           'type': 'none',
38           'direct_dependent_settings': {
39             'defines': [
40               'USE_SYSTEM_SQLITE',
41             ],
42           },
44           'conditions': [
45             ['OS == "ios"', {
46               'dependencies': [
47                 'sqlite_regexp',
48               ],
49               'link_settings': {
50                 'libraries': [
51                   '$(SDKROOT)/usr/lib/libsqlite3.dylib',
52                 ],
53               },
54             }],
55             ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
56               'direct_dependent_settings': {
57                 'cflags': [
58                   # This next command produces no output but it it will fail
59                   # (and cause GYP to fail) if we don't have a recent enough
60                   # version of sqlite.
61                   '<!@(pkg-config --atleast-version=<(required_sqlite_version) sqlite3)',
63                   '<!@(pkg-config --cflags sqlite3)',
64                 ],
65               },
66               'link_settings': {
67                 'ldflags': [
68                   '<!@(pkg-config --libs-only-L --libs-only-other sqlite3)',
69                 ],
70                 'libraries': [
71                   '<!@(pkg-config --libs-only-l sqlite3)',
72                 ],
73               },
74             }],
75           ],
76         }, { # !use_system_sqlite
77           'product_name': 'sqlite3',
78           'type': 'static_library',
79           'sources': [
80             'amalgamation/sqlite3.h',
81             'amalgamation/sqlite3.c',
82           ],
84           # TODO(shess): Previously fts1 and rtree files were
85           # explicitly excluded from the build.  Make sure they are
86           # logically still excluded.
88           # TODO(shess): Should all of the sources be listed and then
89           # excluded?  For editing purposes?
91           'include_dirs': [
92             'amalgamation',
93           ],
94           'dependencies': [
95             '../icu/icu.gyp:icui18n',
96             '../icu/icu.gyp:icuuc',
97           ],
98           'direct_dependent_settings': {
99             'include_dirs': [
100               '.',
101               '../..',
102             ],
103           },
104           'msvs_disabled_warnings': [
105             4018, 4244, 4267,
106           ],
107           'variables': {
108             'clang_warning_flags': [
109               # sqlite does `if (*a++ && *b++);` in a non-buggy way.
110               '-Wno-empty-body',
111               # sqlite has some `unsigned < 0` checks.
112               '-Wno-tautological-compare',
113             ],
114           },
115           'conditions': [
116             ['OS=="linux"', {
117               'link_settings': {
118                 'libraries': [
119                   '-ldl',
120                 ],
121               },
122             }],
123             ['OS == "mac" or OS == "ios"', {
124               'link_settings': {
125                 'libraries': [
126                   '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
127                 ],
128               },
129             }],
130             ['OS == "android"', {
131               'defines': [
132                 'HAVE_USLEEP=1',
133                 'SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576',
134                 'SQLITE_DEFAULT_AUTOVACUUM=1',
135                 'SQLITE_TEMP_STORE=3',
136                 'SQLITE_ENABLE_FTS3_BACKWARDS',
137                 'DSQLITE_DEFAULT_FILE_FORMAT=4',
138               ],
139             }],
140             ['os_posix == 1 and OS != "mac" and OS != "android"', {
141               'cflags': [
142                 # SQLite doesn't believe in compiler warnings,
143                 # preferring testing.
144                 #   http://www.sqlite.org/faq.html#q17
145                 '-Wno-int-to-pointer-cast',
146                 '-Wno-pointer-to-int-cast',
147               ],
148             }],
149             # Enable feedback-directed optimisation for sqlite when building in android.
150             ['android_webview_build == 1', {
151               'aosp_build_settings': {
152                 'LOCAL_FDO_SUPPORT': 'true',
153               },
154             }],
155             ['sqlite_enable_fts2', {
156               'defines': [
157                 'SQLITE_ENABLE_BROKEN_FTS2',
158                 'SQLITE_ENABLE_FTS2',
159               ],
160               'sources': [
161                 # fts2.c currently has a lot of conflicts when added to
162                 # the amalgamation.  It is probably not worth fixing that.
163                 'src/ext/fts2/fts2.c',
164                 'src/ext/fts2/fts2.h',
165                 'src/ext/fts2/fts2_hash.c',
166                 'src/ext/fts2/fts2_hash.h',
167                 'src/ext/fts2/fts2_icu.c',
168                 'src/ext/fts2/fts2_porter.c',
169                 'src/ext/fts2/fts2_tokenizer.c',
170                 'src/ext/fts2/fts2_tokenizer.h',
171                 'src/ext/fts2/fts2_tokenizer1.c',
172               ],
173               'include_dirs': [
174                 'src/src',
175               ],
176             }],
177           ],
178         }],
179       ],
180     },
181   ],
182   'conditions': [
183     ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and not use_system_sqlite', {
184       'targets': [
185         {
186           'target_name': 'sqlite_shell',
187           'type': 'executable',
188           'dependencies': [
189             '../icu/icu.gyp:icuuc',
190             'sqlite',
191           ],
192           'sources': [
193             'src/src/shell.c',
194             'src/src/shell_icu_linux.c',
195             # Include a dummy c++ file to force linking of libstdc++.
196             'build_as_cpp.cc',
197           ],
198         },
199       ],
200     },],
201     ['OS == "ios"', {
202       'targets': [
203         {
204           'target_name': 'sqlite_regexp',
205           'type': 'static_library',
206           'dependencies': [
207             '../icu/icu.gyp:icui18n',
208             '../icu/icu.gyp:icuuc',
209           ],
210           'sources': [
211             'src/ext/icu/icu.c',
212           ],
213         },
214       ],
215     }],
216   ],