@@ -12,26 +12,45 @@ filegroup(
12
12
visibility = ["//visibility:private" ],
13
13
)
14
14
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
+
15
49
cmake (
16
50
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 ,
32
52
generate_args = ["-G Ninja" ],
33
53
lib_source = ":srcs" ,
34
- out_headers_only = False ,
35
54
out_shared_libs = select ({
36
55
"@bazel_tools//src/conditions:darwin" : [
37
56
"libsnmallocshim-checks-memcpy-only.dylib" ,
@@ -50,25 +69,11 @@ cmake(
50
69
51
70
cmake (
52
71
name = "snmalloc-rs" ,
53
- cache_entries = {
54
- "CMAKE_BUILD_TYPE" : "Release" ,
55
- "CMAKE_INTERPROCEDURAL_OPTIMIZATION" : "TRUE" ,
72
+ cache_entries = CMAKE_FLAGS | {
56
73
"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" ,
61
74
},
62
- copts = [
63
- "-fuse-ld=lld" ,
64
- "-stdlib=libc++" ,
65
- "-mcx16" ,
66
- "-Wno-error=unknown-pragmas" ,
67
- "-Qunused-arguments" ,
68
- ],
69
75
generate_args = ["-G Ninja" ],
70
76
lib_source = ":srcs" ,
71
- out_headers_only = False ,
72
77
out_shared_libs = select ({
73
78
"@bazel_tools//src/conditions:darwin" : [
74
79
"libsnmallocshim-checks-memcpy-only.dylib" ,
0 commit comments