From 60c0f32e1c59fad0e5ec36a9e5d2a41b2eab4055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Thu, 24 Mar 2016 19:37:56 +0100 Subject: [PATCH] Feature-gate the `VecN` structure. `rustc` is has a hard time compiling it from time to time. --- CHANGELOG | 4 ++-- Cargo.toml | 15 +++++++++++---- README.md | 2 +- src/lib.rs | 9 +++++++-- src/structs/mod.rs | 5 ++++- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 40f402e8..a1487f88 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,8 +6,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [unreleased] [0.6.0] ### Added - * Dependency to [generic-array](https://crates.io/crates/generic-array) - * Staticly sized vectors with user-defined sizes: `VecN`. + * (feature=generic_sizes): Dependency to [generic-array](https://crates.io/crates/generic-array) + * (feature=ganedic_sizes): Staticly sized vectors with user-defined sizes: `VecN`. * Similarity transformations (an uniform scale followed by a rotation followed by a translation): `Sim2`, `Sim3`. diff --git a/Cargo.toml b/Cargo.toml index 54905910..513404a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,14 +18,21 @@ path = "src/lib.rs" [features] # Generate arbitrary instances of nalgebra types for testing with quickcheck arbitrary = [ "quickcheck" ] +generic_sizes = [ "generic-array", "typenum" ] [dependencies] rustc-serialize = "0.3.*" rand = "0.3.*" -num = "0.1.*" -generic-array = "0.2.*" -typenum = "1.3.*" +num = "0.1.*" + +[dependencies.generic-array] +optional = true +version = "0.2.*" + +[dependencies.typenum] +optional = true +version = "1.3.*" [dependencies.quickcheck] optional = true -version = "0.2.*" +version = "0.2.*" diff --git a/README.md b/README.md index aa735021..a986f1e4 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ fn main() { an optimized set of tools for computer graphics and physics. Those features include: * Vectors with predefined static sizes: `Vec1`, `Vec2`, `Vec3`, `Vec4`, `Vec5`, `Vec6`. -* Vector with a user-defined static size: `VecN`. +* Vector with a user-defined static size: `VecN` (available only with the `generic_sizes` feature). * Points with static sizes: `Pnt1`, `Pnt2`, `Pnt3`, `Pnt4`, `Pnt5`, `Pnt6`. * Square matrices with static sizes: `Mat1`, `Mat2`, `Mat3`, `Mat4`, `Mat5`, `Mat6 `. * Rotation matrices: `Rot2`, `Rot3` diff --git a/src/lib.rs b/src/lib.rs index d5af670a..f6531611 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,7 +42,7 @@ fn main() { an optimized set of tools for computer graphics and physics. Those features include: * Vectors with predefined static sizes: `Vec1`, `Vec2`, `Vec3`, `Vec4`, `Vec5`, `Vec6`. -* Vector with a user-defined static size: `VecN`. +* Vector with a user-defined static size: `VecN` (available only with the `generic_sizes` feature). * Points with static sizes: `Pnt1`, `Pnt2`, `Pnt3`, `Pnt4`, `Pnt5`, `Pnt6`. * Square matrices with static sizes: `Mat1`, `Mat2`, `Mat3`, `Mat4`, `Mat5`, `Mat6 `. * Rotation matrices: `Rot2`, `Rot3` @@ -78,6 +78,8 @@ Feel free to add your project to this list if you happen to use **nalgebra**! extern crate rustc_serialize; extern crate rand; extern crate num; + +#[cfg(feature="generic_sizes")] extern crate generic_array; #[cfg(feature="arbitrary")] @@ -136,6 +138,9 @@ pub use traits::{ UniformSphereSample }; +#[cfg(feature="generic_sizes")] +pub use structs::VecN; + pub use structs::{ Identity, DMat, DMat1, DMat2, DMat3, DMat4, DMat5, DMat6, @@ -145,7 +150,7 @@ pub use structs::{ Mat1, Mat2, Mat3, Mat4, Mat5, Mat6, Rot2, Rot3, - VecN, Vec1, Vec2, Vec3, Vec4, Vec5, Vec6, + Vec1, Vec2, Vec3, Vec4, Vec5, Vec6, Pnt1, Pnt2, Pnt3, Pnt4, Pnt5, Pnt6, Persp3, PerspMat3, Ortho3, OrthoMat3, diff --git a/src/structs/mod.rs b/src/structs/mod.rs index 7af9a619..00d818bd 100644 --- a/src/structs/mod.rs +++ b/src/structs/mod.rs @@ -3,7 +3,6 @@ pub use self::dmat::{DMat, DMat1, DMat2, DMat3, DMat4, DMat5, DMat6}; pub use self::dvec::{DVec, DVec1, DVec2, DVec3, DVec4, DVec5, DVec6}; pub use self::vec::{Vec1, Vec2, Vec3, Vec4, Vec5, Vec6}; -pub use self::vecn::VecN; pub use self::pnt::{Pnt1, Pnt2, Pnt3, Pnt4, Pnt5, Pnt6}; pub use self::mat::{Identity, Mat1, Mat2, Mat3, Mat4, Mat5, Mat6}; pub use self::rot::{Rot2, Rot3}; @@ -13,9 +12,13 @@ pub use self::persp::{Persp3, PerspMat3}; pub use self::ortho::{Ortho3, OrthoMat3}; pub use self::quat::{Quat, UnitQuat}; +#[cfg(feature="generic_sizes")] +pub use self::vecn::VecN; + mod dmat_macros; mod dmat; mod vecn_macros; +#[cfg(feature="generic_sizes")] mod vecn; mod dvec_macros; mod dvec;