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