Skip afn on docs.rs builds
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "fast_fp"
|
name = "fast_fp"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
authors = ["Renar Narubin <renar@standard.ai>"]
|
authors = ["Renar Narubin <renar@standard.ai>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Floating point fast-math optimizations"
|
description = "Floating point fast-math optimizations"
|
||||||
|
|||||||
21
build.rs
21
build.rs
@@ -30,9 +30,24 @@ fn build_c(mut builder: cc::Build) {
|
|||||||
builder.flag("-fno-signed-zeros");
|
builder.flag("-fno-signed-zeros");
|
||||||
builder.flag("-fno-trapping-math");
|
builder.flag("-fno-trapping-math");
|
||||||
builder.flag("-ffp-contract=fast");
|
builder.flag("-ffp-contract=fast");
|
||||||
// -fapprox-func isn't currently available in the driver, but it is in clang itself
|
|
||||||
// https://reviews.llvm.org/D106191
|
// -fapprox-func isn't currently available in the clang driver (fixed with
|
||||||
builder.flag("-Xclang").flag("-fapprox-func");
|
// https://reviews.llvm.org/D106191 but need an updated version), but it is in clang itself.
|
||||||
|
// This means it can be toggled using the `-Xclang <arg>` option.
|
||||||
|
//
|
||||||
|
// The clang version on docs.rs doesn't recognize -fapprox-func even with -Xclang :shrug:
|
||||||
|
// We could attempt to check flag support using cc's flag_if_supported, but this is a compound
|
||||||
|
// flag which doesn't seem to mix well with the is_supported api checks. Instead, do the dumb
|
||||||
|
// thing and don't enable this flag when compiling on docs.rs. That way, normal users should at
|
||||||
|
// least get a slightly informative error if they have an incompatible clang
|
||||||
|
match std::env::var("DOCS_RS") {
|
||||||
|
Err(std::env::VarError::NotPresent) => {
|
||||||
|
builder.flag("-Xclang").flag("-fapprox-func");
|
||||||
|
}
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(err) => panic!("{}", err),
|
||||||
|
}
|
||||||
|
|
||||||
builder.flag("-fno-math-errno");
|
builder.flag("-fno-math-errno");
|
||||||
|
|
||||||
// poison_unsafe must be compiled without finite-math-only
|
// poison_unsafe must be compiled without finite-math-only
|
||||||
|
|||||||
Reference in New Issue
Block a user