Skip to content

Commit e435ac9

Browse files
authored
doc: Add instructions on using sccache (#1503)
1 parent fcc7fc4 commit e435ac9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/lib.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@
9595
//! dependencies. Note that operations that return [`Tool`]s such as
9696
//! [`Build::get_compiler`] may produce less accurate results as in some cases `cc` runs
9797
//! commands in order to locate compilers. Additionally, this does nothing to prevent
98-
//! users from running [`Tool::to_command`] and executing the [`Command`] themselves.//!
98+
//! users from running [`Tool::to_command`] and executing the [`Command`] themselves.
99+
//! * `RUSTC_WRAPPER` - If set, the specified command will be prefixed to the compiler
100+
//! command. This is useful for projects that want to use
101+
//! [sccache](https://github.com/mozilla/sccache),
102+
//! [buildcache](https://gitlab.com/bits-n-bites/buildcache), or
103+
//! [cachepot](https://github.com/paritytech/cachepot).
99104
//!
100105
//! Furthermore, projects using this crate may specify custom environment variables
101106
//! to be inspected, for example via the `Build::try_flags_from_environment`
@@ -215,6 +220,15 @@
215220
//! .file("bar.cu")
216221
//! .compile("bar");
217222
//! ```
223+
//!
224+
//! # Speed up compilation with sccache
225+
//!
226+
//! `cc-rs` does not handle incremental compilation like `make` or `ninja`. It
227+
//! always compiles the all sources, no matter if they have changed or not.
228+
//! This would be time-consuming in large projects. To save compilation time,
229+
//! you can use [sccache](https://github.com/mozilla/sccache) by setting
230+
//! environment variable `RUSTC_WRAPPER=sccache`, which will use cached `.o`
231+
//! files if the sources are unchanged.
218232
219233
#![doc(html_root_url = "https://docs.rs/cc/1.0")]
220234
#![deny(warnings)]

0 commit comments

Comments
 (0)