Skip to content

Commit

Permalink
Add compile error on using unsupported features on SPIRV
Browse files Browse the repository at this point in the history
  • Loading branch information
repi authored and XAMPPRocky committed Nov 10, 2020
1 parent 03e52b0 commit c9561e4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Cargo.toml
Expand Up @@ -38,10 +38,12 @@ transform-types = []
libm = ["num-traits/libm"]

[dependencies]
bytemuck = { version = "1.4", optional = true, default-features = false }
mint = { version = "0.5", optional = true, default-features = false }
# enabled by the libm feature, required when building no_std
num-traits = { version = "0.2.14", optional = true, default-features = false }

[target.'cfg(not(target_arch = "spirv"))'.dependencies]
bytemuck = { version = "1.4", optional = true, default-features = false }
rand = { version = "0.7", optional = true, default-features = false }
serde = { version = "1.0", optional = true, features = ["derive"] }

Expand Down
15 changes: 15 additions & 0 deletions src/lib.rs
Expand Up @@ -201,6 +201,21 @@ The minimum supported version of Rust for `glam` is `1.36.0`.

#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(all(target_arch = "spirv", feature = "glam-assert"))]
compile_error!("`glam-assert` feature is not supported when building for SPIRV");

#[cfg(all(target_arch = "spirv", feature = "debug-glam-assert"))]
compile_error!("`debug-glam-assert` feature is not supported when building for SPIRV");

#[cfg(all(target_arch = "spirv", feature = "serde"))]
compile_error!("`serde` feature is not supported when building for SPIRV");

#[cfg(all(target_arch = "spirv", feature = "rand"))]
compile_error!("`rand` feature is not supported when building for SPIRV");

#[cfg(all(target_arch = "spirv", feature = "bytemuck"))]
compile_error!("`bytemuck` feature is not supported when building for SPIRV");

#[macro_use]
mod macros;

Expand Down

0 comments on commit c9561e4

Please sign in to comment.