File tree Expand file tree Collapse file tree 8 files changed +29
-9
lines changed Expand file tree Collapse file tree 8 files changed +29
-9
lines changed Original file line number Diff line number Diff line change 1
- [submodule "libmimalloc-sys/c_src/mimalloc "]
2
- path = libmimalloc-sys/c_src/mimalloc
1
+ [submodule "libmimalloc-sys/c_src/mimalloc/v2 "]
2
+ path = libmimalloc-sys/c_src/mimalloc/v2
3
+ url = https://github.com/microsoft/mimalloc
4
+ [submodule "libmimalloc-sys/c_src/mimalloc/v3 "]
5
+ path = libmimalloc-sys/c_src/mimalloc/v3
3
6
url = https://github.com/microsoft/mimalloc
Original file line number Diff line number Diff line change @@ -32,3 +32,4 @@ debug_in_debug = ["libmimalloc-sys/debug_in_debug"]
32
32
local_dynamic_tls = [" libmimalloc-sys/local_dynamic_tls" ]
33
33
no_thp = [" libmimalloc-sys/no_thp" ]
34
34
extended = [" libmimalloc-sys/extended" ]
35
+ v3 = [" libmimalloc-sys/v3" ]
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ extended = ["cty"]
34
34
arena = []
35
35
local_dynamic_tls = []
36
36
no_thp = []
37
+ v3 = []
37
38
38
39
# Show `extended` on docs.rs since it's the full API surface.
39
40
[package .metadata .docs .rs ]
Original file line number Diff line number Diff line change @@ -3,9 +3,15 @@ use std::env;
3
3
fn main ( ) {
4
4
let mut build = cc:: Build :: new ( ) ;
5
5
6
- build. include ( "c_src/mimalloc/include" ) ;
7
- build. include ( "c_src/mimalloc/src" ) ;
8
- build. file ( "c_src/mimalloc/src/static.c" ) ;
6
+ let version = if env:: var ( "CARGO_FEATURE_V3" ) . is_ok ( ) {
7
+ "v3"
8
+ } else {
9
+ "v2"
10
+ } ;
11
+
12
+ build. include ( format ! ( "c_src/mimalloc/{version}/include" ) ) ;
13
+ build. include ( format ! ( "c_src/mimalloc/{version}/src" ) ) ;
14
+ build. file ( format ! ( "c_src/mimalloc/{version}/src/static.c" ) ) ;
9
15
10
16
let target_os = env:: var ( "CARGO_CFG_TARGET_OS" ) . expect ( "target_os not defined!" ) ;
11
17
let target_family = env:: var ( "CARGO_CFG_TARGET_FAMILY" ) . expect ( "target_family not defined!" ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ use std:: env;
2
+
1
3
fn main ( ) {
4
+ let cargo_manifest_dir = env ! ( "CARGO_MANIFEST_DIR" ) ;
5
+ let version = if env:: var ( "CARGO_FEATURE_V3" ) . is_ok ( ) {
6
+ "v3"
7
+ } else {
8
+ "v2"
9
+ } ;
10
+
2
11
let mut cfg = ctest2:: TestGenerator :: new ( ) ;
3
12
cfg. header ( "mimalloc.h" )
4
- . include ( concat ! (
5
- env!( "CARGO_MANIFEST_DIR" ) ,
6
- "/../c_src/mimalloc/include"
13
+ . include ( format ! (
14
+ "{cargo_manifest_dir}/../c_src/mimalloc/{version}/include"
7
15
) )
8
16
. cfg ( "feature" , Some ( "extended" ) )
9
17
. fn_cname ( |rust, link_name| link_name. unwrap_or ( rust) . to_string ( ) )
You can’t perform that action at this time.
0 commit comments