Skip to content

Commit a5bda9c

Browse files
authored
Add guidance on what string to pass compile (#658)
1 parent 030baed commit a5bda9c

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

src/lib.rs

+29-4
Original file line numberDiff line numberDiff line change
@@ -1066,10 +1066,35 @@ impl Build {
10661066

10671067
/// Run the compiler, generating the file `output`
10681068
///
1069-
/// The name `output` should be the name of the library. For backwards compatibility,
1070-
/// the `output` may start with `lib` and end with `.a`. The Rust compiler will create
1071-
/// the assembly with the lib prefix and .a extension. MSVC will create a file without prefix,
1072-
/// ending with `.lib`.
1069+
/// # Library name
1070+
///
1071+
/// The `output` string argument determines the file name for the compiled
1072+
/// library. The Rust compiler will create an assembly named "lib"+output+".a".
1073+
/// MSVC will create a file named output+".lib".
1074+
///
1075+
/// The choice of `output` is close to arbitrary, but:
1076+
///
1077+
/// - must be nonempty,
1078+
/// - must not contain a path separator (`/`),
1079+
/// - must be unique across all `compile` invocations made by the same build
1080+
/// script.
1081+
///
1082+
/// If your build script compiles a single source file, the base name of
1083+
/// that source file would usually be reasonable:
1084+
///
1085+
/// ```no_run
1086+
/// cc::Build::new().file("blobstore.c").compile("blobstore");
1087+
/// ```
1088+
///
1089+
/// Compiling multiple source files, some people use their crate's name, or
1090+
/// their crate's name + "-cc".
1091+
///
1092+
/// Otherwise, please use your imagination.
1093+
///
1094+
/// For backwards compatibility, if `output` starts with "lib" *and* ends
1095+
/// with ".a", a second "lib" prefix and ".a" suffix do not get added on,
1096+
/// but this usage is deprecated; please omit `lib` and `.a` in the argument
1097+
/// that you pass.
10731098
///
10741099
/// # Panics
10751100
///

0 commit comments

Comments
 (0)