<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Targets &amp; cross-compilation on cargo-feature-combinations</title><link>https://romnn.github.io/cargo-feature-combinations/docs/targets/</link><description>Recent content in Targets &amp; cross-compilation on cargo-feature-combinations</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://romnn.github.io/cargo-feature-combinations/docs/targets/index.xml" rel="self" type="application/rss+xml"/><item><title>Configured targets</title><link>https://romnn.github.io/cargo-feature-combinations/docs/targets/configured-targets/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://romnn.github.io/cargo-feature-combinations/docs/targets/configured-targets/</guid><description>&lt;h1 id="configured-targets"&gt;Configured targets&lt;a class="anchor" href="#configured-targets"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="declaring-a-target-list"&gt;Declaring a target list&lt;a class="anchor" href="#declaring-a-target-list"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Declare workspace-wide targets in the workspace &lt;code&gt;Cargo.toml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-toml" data-lang="toml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;workspace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cargo-fc&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;targets&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;x86_64-unknown-linux-gnu&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;x86_64-pc-windows-msvc&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;aarch64-apple-darwin&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now &lt;code&gt;cargo fc check&lt;/code&gt; visits every combination on every target.&lt;/p&gt;
&lt;h2 id="per-package-target-lists"&gt;Per-package target lists&lt;a class="anchor" href="#per-package-target-lists"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A package can override the workspace list, or opt out of it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-toml" data-lang="toml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;package&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cargo-fc&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;# Run this package only on wasm (overrides the workspace list, does not merge).&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;targets&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;wasm32-unknown-unknown&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The three states:&lt;/p&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Value&lt;/th&gt;
					&lt;th&gt;Meaning&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;key missing&lt;/td&gt;
					&lt;td&gt;inherit the workspace target list&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;targets = []&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;opt out of the workspace list; use the single effective target&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;targets = [&amp;quot;…&amp;quot;]&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;this package&amp;rsquo;s own list (overrides, does not merge)&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;code&gt;targets&lt;/code&gt; only selects which targets are visited. The &lt;a href="https://romnn.github.io/cargo-feature-combinations/docs/configuration/per-target/"&gt;&lt;code&gt;target.'cfg(...)'&lt;/code&gt;&lt;/a&gt; overrides still shape the feature matrix for each concrete target.&lt;/p&gt;</description></item><item><title>Build drivers</title><link>https://romnn.github.io/cargo-feature-combinations/docs/targets/drivers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://romnn.github.io/cargo-feature-combinations/docs/targets/drivers/</guid><description>&lt;h1 id="build-drivers"&gt;Build drivers&lt;a class="anchor" href="#build-drivers"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;A &amp;ldquo;driver&amp;rdquo; is the program &lt;code&gt;cargo fc&lt;/code&gt; invokes in place of &lt;code&gt;cargo&lt;/code&gt; for each build. The default depends on whether you&amp;rsquo;re cross-compiling.&lt;/p&gt;
&lt;h2 id="why-a-driver"&gt;Why a driver&lt;a class="anchor" href="#why-a-driver"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Cross-compiling a crate with native-C build dependencies (for example &lt;code&gt;aws-lc-sys&lt;/code&gt;, pulled in via &lt;code&gt;rustls&lt;/code&gt;) needs a cross C toolchain — the host &lt;code&gt;cc&lt;/code&gt; can&amp;rsquo;t target another OS. To make that transparent, &lt;strong&gt;when any non-host target is planned, &lt;code&gt;cargo fc&lt;/code&gt; invokes &lt;a href="https://github.com/rust-cross/cargo-zigbuild"&gt;&lt;code&gt;cargo-zigbuild&lt;/code&gt;&lt;/a&gt; instead of plain &lt;code&gt;cargo&lt;/code&gt;&lt;/strong&gt;, so zig supplies the cross C compiler and linker for every target.&lt;/p&gt;</description></item><item><title>Installing targets</title><link>https://romnn.github.io/cargo-feature-combinations/docs/targets/installing-targets/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://romnn.github.io/cargo-feature-combinations/docs/targets/installing-targets/</guid><description>&lt;h1 id="installing-missing-targets"&gt;Installing missing targets&lt;a class="anchor" href="#installing-missing-targets"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;By default &lt;code&gt;cargo fc&lt;/code&gt; does not mutate the Rust toolchain. If a configured target&amp;rsquo;s &lt;code&gt;rustup&lt;/code&gt; component isn&amp;rsquo;t installed, the build for that target fails as it normally would.&lt;/p&gt;
&lt;h2 id="opt-in-per-invocation"&gt;Opt in per invocation&lt;a class="anchor" href="#opt-in-per-invocation"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cargo &lt;span class="nb"&gt;fc&lt;/span&gt; check --install-missing-targets&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This installs the missing target components with &lt;code&gt;rustup&lt;/code&gt; before running. It&amp;rsquo;s an explicit opt-in because it may mutate the toolchain and use the network. When a &lt;code&gt;+toolchain&lt;/code&gt; override is present, the same override is passed to &lt;code&gt;rustup&lt;/code&gt;, so components land in the right toolchain.&lt;/p&gt;</description></item></channel></rss>