diff --git a/Cargo.toml b/Cargo.toml index b97cbf9..9d6f61c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ crate-type = ["cdylib", "lib", "staticlib"] rand = "0.4" bit-vec = "0.4.4" futures = "0.1" +cfg-if = "0.1.7" pairing = { git = 'https://github.com/matterinc/pairing', tag = "0.16.2" } #pairing = { path = "../pairing" } diff --git a/src/lib.rs b/src/lib.rs index 690219a..23ca127 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,7 @@ #![allow(unused_imports)] +#[macro_use] +extern crate cfg_if; extern crate pairing as pairing_import; extern crate rand; extern crate bit_vec; @@ -20,18 +22,18 @@ mod multiexp; #[cfg(test)] mod tests; -#[cfg(feature = "multicore")] -mod multicore; - -#[cfg(feature = "singlecore")] -mod singlecore; - -mod worker { - #[cfg(feature = "multicore")] - pub use crate::multicore::*; - - #[cfg(feature = "singlecore")] - pub use crate::singlecore::*; +cfg_if! { + if #[cfg(feature = "multicore")] { + mod multicore; + mod worker { + pub use crate::multicore::*; + } + } else { + mod singlecore; + mod worker { + pub use crate::singlecore::*; + } + } } pub mod pairing {