Skip to content

Commit 98f8938

Browse files
Using cfg flag to detect usage of portable_atomic
1 parent 97563eb commit 98f8938

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

Cargo.toml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ matrixmultiply = { version = "0.3.2", default-features = false, features=["cgemm
4545
serde = { version = "1.0", optional = true, default-features = false, features = ["alloc"] }
4646
rawpointer = { version = "0.2" }
4747

48-
portable-atomic = { version = "1.6.0", optional = true }
49-
portable-atomic-util = { version = "0.2.0", features = [ "alloc" ], optional = true }
5048

5149
[dev-dependencies]
5250
defmac = "0.2"
@@ -73,11 +71,24 @@ docs = ["approx", "serde", "rayon"]
7371
std = ["num-traits/std", "matrixmultiply/std"]
7472
rayon = ["rayon_", "std"]
7573

76-
portable-atomic = ["dep:portable-atomic", "dep:portable-atomic-util"]
7774
critical-section = ["portable-atomic/critical-section"]
7875

7976
matrixmultiply-threading = ["matrixmultiply/threading"]
8077

78+
[target.'cfg(not(target_has_atomic = "ptr"))'.dependencies]
79+
portable-atomic = { version = "1.6.0" }
80+
portable-atomic-util = { version = "0.2.0", features = [ "alloc" ] }
81+
82+
# [target.'cfg(unix)'.dependencies]
83+
# openssl = "1.0.1"
84+
85+
# [target.'cfg(target_arch = "x86")'.dependencies]
86+
# native-i686 = { path = "native/i686" }
87+
88+
# [target.'cfg(target_arch = "x86_64")'.dependencies]
89+
# native-x86_64 = { path = "native/x86_64" }
90+
91+
8192
[profile.bench]
8293
debug = true
8394
[profile.dev.package.numeric-tests]

src/data_traits.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
#[allow(unused_imports)]
1212
use rawpointer::PointerExt;
1313

14-
#[cfg(not(feature = "portable-atomic"))]
14+
#[cfg(target_has_atomic = "ptr")]
1515
use alloc::sync::Arc;
1616

17-
#[cfg(feature = "portable-atomic")]
17+
#[cfg(not(target_has_atomic = "ptr"))]
1818
use portable_atomic_util::Arc;
1919

2020
#[cfg(not(feature = "std"))]

src/impl_arc_array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
use crate::imp_prelude::*;
1010

11-
#[cfg(not(feature = "portable-atomic"))]
11+
#[cfg(target_has_atomic = "ptr")]
1212
use alloc::sync::Arc;
1313

14-
#[cfg(feature = "portable-atomic")]
14+
#[cfg(not(target_has_atomic = "ptr"))]
1515
use portable_atomic_util::Arc;
1616

1717
/// Methods specific to `ArcArray`.

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ extern crate cblas_sys;
125125
#[cfg(feature = "docs")]
126126
pub mod doc;
127127

128-
#[cfg(not(feature = "portable-atomic"))]
128+
#[cfg(target_has_atomic = "ptr")]
129129
use alloc::sync::Arc;
130130

131-
#[cfg(feature = "portable-atomic")]
131+
#[cfg(not(target_has_atomic = "ptr"))]
132132
use portable_atomic_util::Arc;
133133

134134
use std::marker::PhantomData;

0 commit comments

Comments
 (0)