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