Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / third_party / sqlite / sqlite.gyp
blobe6a0faf5d2c098166d34a43a5fda516088436e50
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               # Needed because we don't have this commit yet:
114               # https://github.com/mackyle/sqlite/commit/25df0fa050dcc9be7fb937b8e25be24049b3fef0
115               '-Wno-pointer-bool-conversion',
116             ],
117           },
118           'conditions': [
119             ['OS=="linux"', {
120               'link_settings': {
121                 'libraries': [
122                   '-ldl',
123                 ],
124               },
125             }],
126             ['OS == "mac" or OS == "ios"', {
127               'link_settings': {
128                 'libraries': [
129                   '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
130                 ],
131               },
132             }],
133             ['OS == "android"', {
134               'defines': [
135                 'HAVE_USLEEP=1',
136                 'SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576',
137                 'SQLITE_DEFAULT_AUTOVACUUM=1',
138                 'SQLITE_TEMP_STORE=3',
139                 'SQLITE_ENABLE_FTS3_BACKWARDS',
140                 'DSQLITE_DEFAULT_FILE_FORMAT=4',
141               ],
142             }],
143             ['os_posix == 1 and OS != "mac" and OS != "android"', {
144               'cflags': [
145                 # SQLite doesn't believe in compiler warnings,
146                 # preferring testing.
147                 #   http://www.sqlite.org/faq.html#q17
148                 '-Wno-int-to-pointer-cast',
149                 '-Wno-pointer-to-int-cast',
150               ],
151             }],
152             # Enable feedback-directed optimisation for sqlite when building in android.
153             ['android_webview_build == 1', {
154               'aosp_build_settings': {
155                 'LOCAL_FDO_SUPPORT': 'true',
156               },
157             }],
158             ['sqlite_enable_fts2', {
159               'defines': [
160                 'SQLITE_ENABLE_BROKEN_FTS2',
161                 'SQLITE_ENABLE_FTS2',
162               ],
163               'sources': [
164                 # fts2.c currently has a lot of conflicts when added to
165                 # the amalgamation.  It is probably not worth fixing that.
166                 'src/ext/fts2/fts2.c',
167                 'src/ext/fts2/fts2.h',
168                 'src/ext/fts2/fts2_hash.c',
169                 'src/ext/fts2/fts2_hash.h',
170                 'src/ext/fts2/fts2_icu.c',
171                 'src/ext/fts2/fts2_porter.c',
172                 'src/ext/fts2/fts2_tokenizer.c',
173                 'src/ext/fts2/fts2_tokenizer.h',
174                 'src/ext/fts2/fts2_tokenizer1.c',
175               ],
176               'include_dirs': [
177                 'src/src',
178               ],
179             }],
180           ],
181         }],
182       ],
183       'includes': [
184         # Disable LTO due to ELF section name out of range
185         # crbug.com/422251
186         '../../build/android/disable_lto.gypi',
187       ],
188     },
189   ],
190   'conditions': [
191     ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and not use_system_sqlite', {
192       'targets': [
193         {
194           'target_name': 'sqlite_shell',
195           'type': 'executable',
196           'dependencies': [
197             '../icu/icu.gyp:icuuc',
198             'sqlite',
199           ],
200           'sources': [
201             'src/src/shell.c',
202             'src/src/shell_icu_linux.c',
203             # Include a dummy c++ file to force linking of libstdc++.
204             'build_as_cpp.cc',
205           ],
206         },
207       ],
208     },],
209     ['OS == "ios"', {
210       'targets': [
211         {
212           'target_name': 'sqlite_regexp',
213           'type': 'static_library',
214           'dependencies': [
215             '../icu/icu.gyp:icui18n',
216             '../icu/icu.gyp:icuuc',
217           ],
218           'sources': [
219             'src/ext/icu/icu.c',
220           ],
221         },
222       ],
223     }],
224   ],