]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/buckifier/targets_cfg.py
1 from __future__
import absolute_import
2 from __future__
import division
3 from __future__
import print_function
4 from __future__
import unicode_literals
5 rocksdb_target_header
= """load("@fbcode_macros//build_defs:auto_headers.bzl", "AutoHeaders")
7 REPO_PATH = package_name() + "/"
9 BUCK_BINS = "buck-out/gen/" + REPO_PATH
11 TEST_RUNNER = REPO_PATH + "buckifier/rocks_test_runner.sh"
13 rocksdb_compiler_flags = [
14 "-fno-builtin-memcmp",
15 "-DROCKSDB_PLATFORM_POSIX",
16 "-DROCKSDB_LIB_IO_POSIX",
17 "-DROCKSDB_FALLOCATE_PRESENT",
18 "-DROCKSDB_MALLOC_USABLE_SIZE",
19 "-DROCKSDB_RANGESYNC_PRESENT",
20 "-DROCKSDB_SCHED_GETCPU_PRESENT",
21 "-DROCKSDB_SUPPORT_THREAD_LOCAL",
23 # Flags to enable libs we include
32 # Needed to compile in fbcode
33 "-Wno-expansion-to-defined",
34 # Added missing flags from output of build_detect_platform
35 "-DROCKSDB_PTHREAD_ADAPTIVE_MUTEX",
36 "-DROCKSDB_BACKTRACE",
40 rocksdb_external_deps = [
41 ("bzip2", None, "bz2"),
42 ("snappy", None, "snappy"),
44 ("gflags", None, "gflags"),
48 ("numa", None, "numa"),
49 ("googletest", None, "gtest"),
52 rocksdb_preprocessor_flags = [
53 # Directories with files for #include
54 "-I" + REPO_PATH + "include/",
58 rocksdb_arch_preprocessor_flags = {
65 build_mode = read_config("fbcode", "build_mode")
67 is_opt_mode = build_mode.startswith("opt")
69 # -DNDEBUG is added by default in opt mode in fbcode. But adding it twice
70 # doesn't harm and avoid forgetting to add it.
72 rocksdb_compiler_flags.append("-DNDEBUG")
76 library_template
= """
80 {headers_attr_prefix}headers = {headers},
81 arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
82 compiler_flags = rocksdb_compiler_flags,
83 preprocessor_flags = rocksdb_preprocessor_flags,
85 external_deps = rocksdb_external_deps,
93 arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
94 compiler_flags = rocksdb_compiler_flags,
95 preprocessor_flags = rocksdb_preprocessor_flags,
97 external_deps = rocksdb_external_deps,
101 test_cfg_template
= """ [
108 unittests_template
= """
109 # [test_name, test_src, test_type]
113 # Generate a test rule for each entry in ROCKS_TESTS
114 # Do not build the tests in opt mode, since SyncPoint and other test code
115 # will not be included.
117 for test_cfg in ROCKS_TESTS:
118 test_name = test_cfg[0]
119 test_cc = test_cfg[1]
120 ttype = "gtest" if test_cfg[2] == "parallel" else "simple"
121 test_bin = test_name + "_bin"
126 arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
127 compiler_flags = rocksdb_compiler_flags,
128 preprocessor_flags = rocksdb_preprocessor_flags,
129 deps = [":rocksdb_test_lib"],
130 external_deps = rocksdb_external_deps,
135 command = [TEST_RUNNER, BUCK_BINS + test_bin],
137 deps = [":" + test_bin],