Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit 444e817

Browse files
authored
Add 'compat' feature (#1)
* Add 'compat' feature * Pass feature to croaring-sys
1 parent 9977f80 commit 444e817

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ readme = "README.md"
99
keywords = ["RoaringBitmap", "croaring", "bitmap"]
1010
documentation = "https://docs.rs/croaring"
1111

12+
[features]
13+
compat = ["croaring-sys/compat"]
14+
1215
[dev-dependencies]
1316
proptest = "0.9"
1417
roaring = "0.5.2"

croaring-sys/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ documentation = "https://docs.rs/croaring-sys"
99
build = "build.rs"
1010
description = "Raw bindings to CRoaring"
1111

12+
[features]
13+
compat = []
14+
1215
[dependencies]
1316
libc = "0.2.42"
1417

croaring-sys/build.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,19 @@ use std::env;
55
use std::path::PathBuf;
66

77
fn main() {
8-
cc::Build::new()
8+
let mut builder = cc::Build::new();
9+
builder
910
.flag_if_supported("-std=c11")
10-
.flag_if_supported("-march=native")
11-
.flag_if_supported("-O3")
11+
.flag_if_supported("-O3");
12+
13+
if cfg!(feature = "compat") {
14+
builder.define("DISABLEAVX", Some("1"));
15+
}
16+
else {
17+
builder.flag_if_supported("-march=native");
18+
}
19+
20+
builder
1221
.file("CRoaring/roaring.c")
1322
.compile("libroaring.a");
1423

0 commit comments

Comments
 (0)