diff --git a/oneapi-rs-sys/build.rs b/oneapi-rs-sys/build.rs index c222644..5c6e089 100644 --- a/oneapi-rs-sys/build.rs +++ b/oneapi-rs-sys/build.rs @@ -10,6 +10,14 @@ use std::{io::Error, path::PathBuf}; use which::which; fn main() { + // We detect whether we're running in a docs.rs environment, If yes - we exit the build script + // because the docs.rs build container doesn't have oneAPI installed as a dependency. + // This allows us to build the documentation without having to build the whole library. + // https://docs.rs/about/builds#detecting-docsrs + if std::env::var("DOCS_RS").is_ok() { + return; + } + let compiler_path = get_compiler_path() .expect("Expecting a compiler. Set the ONEAPI_CXX environment variable.");