-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
cargo-build.md
116 lines (71 loc) · 2.18 KB
/
cargo-build.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# cargo-build(1)
{{*set actionverb="Build"}}
{{*set multitarget=true}}
## NAME
cargo-build --- Compile the current package
## SYNOPSIS
`cargo build` [_options_]
## DESCRIPTION
Compile local packages and all of their dependencies.
## OPTIONS
{{> section-package-selection }}
### Target Selection
When no target selection options are given, `cargo build` will build all
binary and library targets of the selected packages. Binaries are skipped if
they have `required-features` that are missing.
{{> options-targets-bin-auto-built }}
{{> options-targets }}
{{> section-features }}
### Compilation Options
{{#options}}
{{> options-target-triple }}
{{> options-release }}
{{> options-profile }}
{{> options-ignore-rust-version }}
{{> options-timings }}
{{/options}}
### Output Options
{{#options}}
{{> options-target-dir }}
{{#option "`--out-dir` _directory_" }}
Copy final artifacts to this directory.
This option is unstable and available only on the
[nightly channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html)
and requires the `-Z unstable-options` flag to enable.
See <https://github.com/rust-lang/cargo/issues/6790> for more information.
{{/option}}
{{/options}}
### Display Options
{{#options}}
{{> options-display }}
{{> options-message-format }}
{{#option "`--build-plan`" }}
Outputs a series of JSON messages to stdout that indicate the commands to run
the build.
This option is unstable and available only on the
[nightly channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html)
and requires the `-Z unstable-options` flag to enable.
See <https://github.com/rust-lang/cargo/issues/5579> for more information.
{{/option}}
{{/options}}
### Manifest Options
{{#options}}
{{> options-manifest-path }}
{{> options-locked }}
{{/options}}
{{> section-options-common }}
### Miscellaneous Options
{{#options}}
{{> options-jobs }}
{{> options-keep-going }}
{{> options-future-incompat }}
{{/options}}
{{> section-environment }}
{{> section-exit-status }}
## EXAMPLES
1. Build the local package and all of its dependencies:
cargo build
2. Build with optimizations:
cargo build --release
## SEE ALSO
{{man "cargo" 1}}, {{man "cargo-rustc" 1}}