Skip to content

Commit 760c648

Browse files
committed
Addition of V1 stableand dev options, as well as V2 dev option
1 parent 73891cf commit 760c648

File tree

6 files changed

+88
-22
lines changed

6 files changed

+88
-22
lines changed

.gitmodules

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
[submodule "libmimalloc-sys/c_src/mimalloc"]
22
path = libmimalloc-sys/c_src/mimalloc
33
url = https://github.com/microsoft/mimalloc
4+
[submodule "libmimalloc-sys/c_src/mimalloc_dev_slice"]
5+
path = libmimalloc-sys/c_src/mimalloc_dev_slice
6+
url = https://github.com/microsoft/mimalloc.git
7+
branch = dev-slice
8+
[submodule "libmimalloc-sys/c_src/mimalloc_dev"]
9+
path = libmimalloc-sys/c_src/mimalloc_dev
10+
url = https://github.com/microsoft/mimalloc.git
11+
branch = dev

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ travis-ci = { repository = "purpleprotocol/mimalloc_rust" }
2424
libmimalloc-sys = { path = "libmimalloc-sys", version = "0.1.21", default-features = false }
2525

2626
[features]
27-
default = ["secure"]
27+
default = ["secure","v1_stable"]
2828
secure = ["libmimalloc-sys/secure"]
2929
override = ["libmimalloc-sys/override"]
3030
local_dynamic_tls = ["libmimalloc-sys/local_dynamic_tls"]
31+
v1_stable = ["libmimalloc-sys/v1_stable"]
32+
v1_dev = ["libmimalloc-sys/v1_dev"]
33+
v2_dev = ["libmimalloc-sys/v2_dev"]

libmimalloc-sys/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ secure = []
2121
override = []
2222
extended = ["cty"]
2323
local_dynamic_tls = []
24+
v1_stable = []
25+
v1_dev = []
26+
v2_dev = []
27+
2428

2529
# Show `extended` on docs.rs since it's the full API surface.
2630
[package.metadata.docs.rs]

libmimalloc-sys/build.rs

Lines changed: 70 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,76 @@ use std::env;
33
fn main() {
44
let mut build = cc::Build::new();
55

6-
build.include("c_src/mimalloc/include");
7-
build.files(
8-
[
9-
"alloc-aligned",
10-
"alloc-posix",
11-
"alloc",
12-
"arena",
13-
"bitmap",
14-
"heap",
15-
"init",
16-
"options",
17-
"os",
18-
"page",
19-
"random",
20-
"region",
21-
"segment",
22-
"stats",
23-
]
24-
.iter()
25-
.map(|fname| format!("c_src/mimalloc/src/{}.c", fname)),
26-
);
6+
if cfg!(feature = "v1_stable") {
7+
build.include("c_src/mimalloc/include");
8+
build.files(
9+
[
10+
"alloc-aligned",
11+
"alloc-posix",
12+
"alloc",
13+
"arena",
14+
"bitmap",
15+
"heap",
16+
"init",
17+
"options",
18+
"os",
19+
"page",
20+
"random",
21+
"region",
22+
"segment",
23+
"stats",
24+
]
25+
.iter()
26+
.map(|fname| format!("c_src/mimalloc/src/{}.c", fname)),
27+
);
28+
} else if cfg!(feature = "v1_dev") {
29+
build.include("c_src/mimalloc_dev/include");
30+
build.files(
31+
[
32+
"alloc-aligned",
33+
"alloc-posix",
34+
"alloc",
35+
"arena",
36+
"bitmap",
37+
"heap",
38+
"init",
39+
"options",
40+
"os",
41+
"page",
42+
"random",
43+
"region",
44+
"segment",
45+
"stats",
46+
]
47+
.iter()
48+
.map(|fname| format!("c_src/mimalloc_dev/src/{}.c", fname)),
49+
);
50+
} else if cfg!(feature = "v2_dev") {
51+
build.include("c_src/mimalloc_dev_slice/include");
52+
build.files(
53+
[
54+
"alloc-aligned",
55+
"alloc-posix",
56+
"alloc",
57+
"arena",
58+
"bitmap",
59+
"heap",
60+
"init",
61+
"options",
62+
"os",
63+
"page",
64+
"random",
65+
"segment-cache",
66+
"segment",
67+
"stats",
68+
]
69+
.iter()
70+
.map(|fname| format!("c_src/mimalloc_dev_slice/src/{}.c", fname)),
71+
);
72+
} else {
73+
panic!("A mimalloc branch must be specified as one of features");
74+
}
75+
2776

2877
build.define("MI_STATIC_LIB", None);
2978

libmimalloc-sys/c_src/mimalloc_dev

Submodule mimalloc_dev added at 5f59605
Submodule mimalloc_dev_slice added at 4e643b6

0 commit comments

Comments
 (0)