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
36 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"]
3232local_dynamic_tls = [" libmimalloc-sys/local_dynamic_tls" ]
3333no_thp = [" libmimalloc-sys/no_thp" ]
3434extended = [" libmimalloc-sys/extended" ]
35+ v3 = [" libmimalloc-sys/v3" ]
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ extended = ["cty"]
3434arena = []
3535local_dynamic_tls = []
3636no_thp = []
37+ v3 = []
3738
3839# Show `extended` on docs.rs since it's the full API surface.
3940[package .metadata .docs .rs ]
Original file line number Diff line number Diff line change @@ -3,9 +3,15 @@ use std::env;
33fn main ( ) {
44 let mut build = cc:: Build :: new ( ) ;
55
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" ) ) ;
915
1016 let target_os = env:: var ( "CARGO_CFG_TARGET_OS" ) . expect ( "target_os not defined!" ) ;
1117 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+
13fn 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+
211 let mut cfg = ctest2:: TestGenerator :: new ( ) ;
312 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"
715 ) )
816 . cfg ( "feature" , Some ( "extended" ) )
917 . fn_cname ( |rust, link_name| link_name. unwrap_or ( rust) . to_string ( ) )
You can’t perform that action at this time.
0 commit comments