Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / leveldatabase / BUILD.gn
blobb3080d8a2fdb491dc4eaff9264f66ac2465cc1a3
1 # Copyright 2014 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 import("//testing/test.gni")
7 defines = [ "LEVELDB_PLATFORM_CHROMIUM=1" ]
9 config("leveldatabase_config") {
10   include_dirs = [
11     ".",
12     "src",
13     "src/include",
14   ]
17 static_library("leveldatabase") {
18   sources = [
19     "env_chromium.cc",
20     "env_chromium.h",
21     "port/port_chromium.cc",
22     "port/port_chromium.h",
23     "src/db/builder.cc",
24     "src/db/builder.h",
25     "src/db/db_impl.cc",
26     "src/db/db_impl.h",
27     "src/db/db_iter.cc",
28     "src/db/db_iter.h",
29     "src/db/dbformat.cc",
30     "src/db/dbformat.h",
31     "src/db/dumpfile.cc",
32     "src/db/filename.cc",
33     "src/db/filename.h",
34     "src/db/log_format.h",
35     "src/db/log_reader.cc",
36     "src/db/log_reader.h",
37     "src/db/log_writer.cc",
38     "src/db/log_writer.h",
39     "src/db/memtable.cc",
40     "src/db/memtable.h",
41     "src/db/repair.cc",
42     "src/db/skiplist.h",
43     "src/db/snapshot.h",
44     "src/db/table_cache.cc",
45     "src/db/table_cache.h",
46     "src/db/version_edit.cc",
47     "src/db/version_edit.h",
48     "src/db/version_set.cc",
49     "src/db/version_set.h",
50     "src/db/write_batch.cc",
51     "src/db/write_batch_internal.h",
52     "src/helpers/memenv/memenv.cc",
53     "src/helpers/memenv/memenv.h",
54     "src/include/leveldb/cache.h",
55     "src/include/leveldb/comparator.h",
56     "src/include/leveldb/db.h",
57     "src/include/leveldb/dumpfile.h",
58     "src/include/leveldb/env.h",
59     "src/include/leveldb/filter_policy.h",
60     "src/include/leveldb/iterator.h",
61     "src/include/leveldb/options.h",
62     "src/include/leveldb/slice.h",
63     "src/include/leveldb/status.h",
64     "src/include/leveldb/table.h",
65     "src/include/leveldb/table_builder.h",
66     "src/include/leveldb/write_batch.h",
67     "src/port/port.h",
68     "src/table/block.cc",
69     "src/table/block.h",
70     "src/table/block_builder.cc",
71     "src/table/block_builder.h",
72     "src/table/filter_block.cc",
73     "src/table/filter_block.h",
74     "src/table/format.cc",
75     "src/table/format.h",
76     "src/table/iterator.cc",
77     "src/table/iterator_wrapper.h",
78     "src/table/merger.cc",
79     "src/table/merger.h",
80     "src/table/table.cc",
81     "src/table/table_builder.cc",
82     "src/table/two_level_iterator.cc",
83     "src/table/two_level_iterator.h",
84     "src/util/arena.cc",
85     "src/util/arena.h",
86     "src/util/bloom.cc",
87     "src/util/cache.cc",
88     "src/util/coding.cc",
89     "src/util/coding.h",
90     "src/util/comparator.cc",
91     "src/util/crc32c.cc",
92     "src/util/crc32c.h",
93     "src/util/env.cc",
94     "src/util/filter_policy.cc",
95     "src/util/hash.cc",
96     "src/util/hash.h",
97     "src/util/logging.cc",
98     "src/util/logging.h",
99     "src/util/mutexlock.h",
100     "src/util/options.cc",
101     "src/util/random.h",
102     "src/util/status.cc",
103   ]
105   configs -= [ "//build/config/compiler:chromium_code" ]
106   configs += [ "//build/config/compiler:no_chromium_code" ]
108   public_configs = [ ":leveldatabase_config" ]
110   deps = [
111     "//base",
112     "//base/third_party/dynamic_annotations",
113     "//third_party/re2",
114     "//third_party/snappy",
115   ]
117   if (is_win) {
118     cflags = [ "/wd4018" ]  # Signed/unsigned mismatch in comparison.
119   }
122 if (!is_android) {
123   test("env_chromium_unittests") {
124     sources = [
125       "env_chromium_unittest.cc",
126     ]
127     deps = [
128       ":leveldatabase",
129       "//base/test:test_support",
130       "//testing/gtest",
131     ]
132   }
134   static_library("leveldb_testutil") {
135     sources = [
136       "src/util/histogram.cc",
137       "src/util/histogram.h",
138       "src/util/testharness.cc",
139       "src/util/testharness.h",
140       "src/util/testutil.cc",
141       "src/util/testutil.h",
142     ]
144     configs -= [ "//build/config/compiler:chromium_code" ]
145     configs += [ "//build/config/compiler:no_chromium_code" ]
147     public_deps = [
148       ":leveldatabase",
149     ]
150     deps = [
151       "//base",
152     ]
153   }
155   test("leveldb_arena_test") {
156     sources = [
157       "src/util/arena_test.cc",
158     ]
159     configs -= [ "//build/config/compiler:chromium_code" ]
160     configs += [ "//build/config/compiler:no_chromium_code" ]
161     deps = [
162       ":leveldb_testutil",
163     ]
164   }
166   test("leveldb_bloom_test") {
167     sources = [
168       "src/util/bloom_test.cc",
169     ]
170     configs -= [ "//build/config/compiler:chromium_code" ]
171     configs += [ "//build/config/compiler:no_chromium_code" ]
172     deps = [
173       ":leveldb_testutil",
174     ]
175   }
177   test("leveldb_cache_test") {
178     sources = [
179       "src/util/cache_test.cc",
180     ]
181     configs -= [ "//build/config/compiler:chromium_code" ]
182     configs += [ "//build/config/compiler:no_chromium_code" ]
183     deps = [
184       ":leveldb_testutil",
185     ]
186   }
188   test("leveldb_corruption_test") {
189     sources = [
190       "src/db/corruption_test.cc",
191     ]
192     configs -= [ "//build/config/compiler:chromium_code" ]
193     configs += [ "//build/config/compiler:no_chromium_code" ]
194     deps = [
195       ":leveldb_testutil",
196     ]
197   }
199   test("leveldb_crc32c_test") {
200     sources = [
201       "src/util/crc32c_test.cc",
202     ]
203     configs -= [ "//build/config/compiler:chromium_code" ]
204     configs += [ "//build/config/compiler:no_chromium_code" ]
205     deps = [
206       ":leveldb_testutil",
207     ]
208   }
210   test("leveldb_db_bench") {
211     sources = [
212       "src/db/db_bench.cc",
213     ]
214     configs -= [ "//build/config/compiler:chromium_code" ]
215     configs += [ "//build/config/compiler:no_chromium_code" ]
216     deps = [
217       ":leveldb_testutil",
218     ]
219   }
221   test("leveldb_db_test") {
222     sources = [
223       "src/db/db_test.cc",
224     ]
225     configs -= [ "//build/config/compiler:chromium_code" ]
226     configs += [ "//build/config/compiler:no_chromium_code" ]
227     deps = [
228       ":leveldb_testutil",
229     ]
230   }
232   test("leveldb_dbformat_test") {
233     sources = [
234       "src/db/dbformat_test.cc",
235     ]
236     configs -= [ "//build/config/compiler:chromium_code" ]
237     configs += [ "//build/config/compiler:no_chromium_code" ]
238     deps = [
239       ":leveldb_testutil",
240     ]
241   }
243   test("leveldb_env_test") {
244     sources = [
245       "src/util/env_test.cc",
246     ]
247     configs -= [ "//build/config/compiler:chromium_code" ]
248     configs += [ "//build/config/compiler:no_chromium_code" ]
249     deps = [
250       ":leveldb_testutil",
251     ]
252   }
254   test("leveldb_filename_test") {
255     sources = [
256       "src/db/filename_test.cc",
257     ]
258     configs -= [ "//build/config/compiler:chromium_code" ]
259     configs += [ "//build/config/compiler:no_chromium_code" ]
260     deps = [
261       ":leveldb_testutil",
262     ]
263   }
265   test("leveldb_filter_block_test") {
266     sources = [
267       "src/table/filter_block_test.cc",
268     ]
269     configs -= [ "//build/config/compiler:chromium_code" ]
270     configs += [ "//build/config/compiler:no_chromium_code" ]
271     deps = [
272       ":leveldb_testutil",
273     ]
274   }
276   test("leveldb_log_test") {
277     sources = [
278       "src/db/log_test.cc",
279     ]
280     configs -= [ "//build/config/compiler:chromium_code" ]
281     configs += [ "//build/config/compiler:no_chromium_code" ]
282     deps = [
283       ":leveldb_testutil",
284     ]
285   }
287   test("leveldb_skiplist_test") {
288     sources = [
289       "src/db/skiplist_test.cc",
290     ]
291     configs -= [ "//build/config/compiler:chromium_code" ]
292     configs += [ "//build/config/compiler:no_chromium_code" ]
293     deps = [
294       ":leveldb_testutil",
295     ]
296   }
298   test("leveldb_table_test") {
299     sources = [
300       "src/table/table_test.cc",
301     ]
302     configs -= [ "//build/config/compiler:chromium_code" ]
303     configs += [ "//build/config/compiler:no_chromium_code" ]
304     deps = [
305       ":leveldb_testutil",
306     ]
307   }
309   test("leveldb_version_edit_test") {
310     sources = [
311       "src/db/version_edit_test.cc",
312     ]
313     configs -= [ "//build/config/compiler:chromium_code" ]
314     configs += [ "//build/config/compiler:no_chromium_code" ]
315     deps = [
316       ":leveldb_testutil",
317     ]
318   }
320   test("leveldb_write_batch_test") {
321     sources = [
322       "src/db/write_batch_test.cc",
323     ]
324     configs -= [ "//build/config/compiler:chromium_code" ]
325     configs += [ "//build/config/compiler:no_chromium_code" ]
326     deps = [
327       ":leveldb_testutil",
328     ]
329   }