Skip to content

Commit 8da2e88

Browse files
Ryan ClantonSchrodingerZhu
authored andcommitted
addition of build_cc to the Readme
1 parent d3f736c commit 8da2e88

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ cache-friendly = ["snmalloc-sys/cache-friendly"]
3030
android-lld = ["snmalloc-sys/android-lld"]
3131
android-shared-stl = ["snmalloc-sys/android-shared-stl"]
3232
native-cpu = ["snmalloc-sys/native-cpu"]
33+
local_dynamic_tls = ["snmalloc-sys/local_dynamic_tls"]
34+

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ There are three features defined in this crate:
2323
- `native-cpu`: Optimize `snmalloc` for the native CPU of the host machine. (this is not a default behavior since `0.2.14`)
2424
- `qemu`: workaround `madvise` problem of QEMU environment
2525
- `stats`: enable statistics
26+
- `local_dynamic_tls`: workaround cannot allocate memory in static tls block
27+
- `build_cc`: use of cc crate instead of cmake (cmake still default) as builder (more platform agnostic)
28+
2629

2730
**To get the crates compiled, you need to choose either `1mib` or `16mib` to determine the chunk configuration**
2831

@@ -62,6 +65,13 @@ Hence, please make sure the following libs are in your `PATH`:
6265
- feature `android-shared-std` can be used to set the STL library of `snmalloc` to `c++_shared` (it uses `c++_static` by default)
6366

6467
## Changelog
68+
### 0.2.26
69+
70+
- **upstream** Building adjustment
71+
- option of cc crate as build feature, only c compiler needed, no cmake required
72+
- Addition of dynamic local TLS option
73+
74+
6575
### 0.2.25
6676

6777
- **upstream** Apple M1 support

snmalloc-sys/build.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ fn main() {
3333
build.flag_if_supported("-g");
3434
build.flag_if_supported("-fomit-frame-pointer");
3535
build.flag_if_supported("-fpermissive");
36+
build.static_crt(true);
3637
build.cpp(true);
3738
build.debug(false);
3839

@@ -45,11 +46,9 @@ fn main() {
4546
if cfg!(feature = "android-lld") {
4647
build.define("ANDROID_LD", "lld");
4748
}
48-
4949
if cfg!(feature = "android-shared-stl") {
5050
build.define("ANDROID_STL", "c++_shared");
5151
}
52-
5352
if triple.contains("aarch64") {
5453
build.define("ANDROID_ABI", "arm64-v8a");
5554
} else if triple.contains("armv7") {
@@ -66,16 +65,7 @@ fn main() {
6665
}
6766
}
6867

69-
if target_os == "windows" && target_env == "gnu" {
70-
build.define("CMAKE_SH", "CMAKE_SH-NOTFOUND");
71-
if cfg!(feature = "local_dynamic_tls") {
72-
build.flag_if_supported("-ftls-model=local-dynamic");
73-
} else {
74-
build.flag_if_supported("-ftls-model=initial-exec");
75-
}
76-
}
77-
78-
if target_family == "unix" && target_os != "haiku" {
68+
if target_family == "unix" || target_env == "gnu" && target_os != "haiku" {
7969
if cfg!(feature = "local_dynamic_tls") {
8070
build.flag_if_supported("-ftls-model=local-dynamic");
8171
} else {
@@ -119,7 +109,6 @@ fn main() {
119109
}
120110

121111
if target_os == "windows" && target_env == "gnu" {
122-
//using cc
123112
println!("cargo:rustc-link-lib=dylib=atomic");
124113
}
125114

@@ -141,7 +130,6 @@ fn main() {
141130
};
142131
}
143132

144-
145133
#[cfg(not(feature = "build_cc"))]
146134
fn main() {
147135
let mut cfg = &mut cmake::Config::new("snmalloc");

0 commit comments

Comments
 (0)