Skip to content

Commit 4bb62bc

Browse files
committed
compilation mode changes
1 parent 6e83200 commit 4bb62bc

File tree

1 file changed

+36
-31
lines changed

1 file changed

+36
-31
lines changed

BUILD.bazel

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,45 @@ filegroup(
1212
visibility = ["//visibility:private"],
1313
)
1414

15+
config_setting(
16+
name = "release_with_debug",
17+
values = {
18+
"compilation_mode": "fastbuild",
19+
},
20+
)
21+
22+
config_setting(
23+
name = "release",
24+
values = {
25+
"compilation_mode": "opt",
26+
},
27+
)
28+
29+
config_setting(
30+
name = "debug",
31+
values = {
32+
"compilation_mode": "dbg",
33+
},
34+
)
35+
36+
CMAKE_FLAGS = {
37+
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": "TRUE",
38+
"SNMALLOC_OPTIMISE_FOR_CURRENT_MACHINE": "ON",
39+
"SNMALLOC_USE_SELF_VENDORED_STL": "OFF",
40+
"SNMALLOC_IPO": "ON",
41+
"USE_SNMALLOC_STATS": "ON",
42+
} | select({
43+
":release_with_debug": {"CMAKE_BUILD_TYPE": "RelWithDebInfo"},
44+
":release": {"CMAKE_BUILD_TYPE": "Release"},
45+
":debug": {"CMAKE_BUILD_TYPE": "Debug"},
46+
"//conditions:default": {"CMAKE_BUILD_TYPE": "Release"},
47+
})
48+
1549
cmake(
1650
name = "snmalloc",
17-
cache_entries = {
18-
"CMAKE_BUILD_TYPE": "Release",
19-
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": "TRUE",
20-
"SNMALLOC_OPTIMISE_FOR_CURRENT_MACHINE": "ON",
21-
"SNMALLOC_USE_SELF_VENDORED_STL": "OFF",
22-
"SNMALLOC_IPO": "ON",
23-
"USE_SNMALLOC_STATS": "ON",
24-
},
25-
copts = [
26-
"-fuse-ld=lld",
27-
"-stdlib=libc++",
28-
"-mcx16",
29-
"-Wno-error=unknown-pragmas",
30-
"-Qunused-arguments",
31-
],
51+
cache_entries = CMAKE_FLAGS,
3252
generate_args = ["-G Ninja"],
3353
lib_source = ":srcs",
34-
out_headers_only = False,
3554
out_shared_libs = select({
3655
"@bazel_tools//src/conditions:darwin": [
3756
"libsnmallocshim-checks-memcpy-only.dylib",
@@ -50,25 +69,11 @@ cmake(
5069

5170
cmake(
5271
name = "snmalloc-rs",
53-
cache_entries = {
54-
"CMAKE_BUILD_TYPE": "Release",
55-
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": "TRUE",
72+
cache_entries = CMAKE_FLAGS | {
5673
"SNMALLOC_RUST_SUPPORT": "ON",
57-
"SNMALLOC_OPTIMISE_FOR_CURRENT_MACHINE": "ON",
58-
"SNMALLOC_USE_SELF_VENDORED_STL": "OFF",
59-
"SNMALLOC_IPO": "ON",
60-
"USE_SNMALLOC_STATS": "ON",
6174
},
62-
copts = [
63-
"-fuse-ld=lld",
64-
"-stdlib=libc++",
65-
"-mcx16",
66-
"-Wno-error=unknown-pragmas",
67-
"-Qunused-arguments",
68-
],
6975
generate_args = ["-G Ninja"],
7076
lib_source = ":srcs",
71-
out_headers_only = False,
7277
out_shared_libs = select({
7378
"@bazel_tools//src/conditions:darwin": [
7479
"libsnmallocshim-checks-memcpy-only.dylib",

0 commit comments

Comments
 (0)