mirror of https://github.com/lukechilds/cc-rs.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
301 lines
65 KiB
301 lines
65 KiB
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Build` struct in crate `cc`."><meta name="keywords" content="rust, rustlang, rust-lang, Build"><title>cc::Build - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../cc/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Build</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.ar_flag">ar_flag</a><a href="#method.archiver">archiver</a><a href="#method.cargo_metadata">cargo_metadata</a><a href="#method.compile">compile</a><a href="#method.compiler">compiler</a><a href="#method.cpp">cpp</a><a href="#method.cpp_link_stdlib">cpp_link_stdlib</a><a href="#method.cpp_set_stdlib">cpp_set_stdlib</a><a href="#method.cuda">cuda</a><a href="#method.debug">debug</a><a href="#method.define">define</a><a href="#method.expand">expand</a><a href="#method.extra_warnings">extra_warnings</a><a href="#method.file">file</a><a href="#method.files">files</a><a href="#method.flag">flag</a><a href="#method.flag_if_supported">flag_if_supported</a><a href="#method.force_frame_pointer">force_frame_pointer</a><a href="#method.get_compiler">get_compiler</a><a href="#method.host">host</a><a href="#method.include">include</a><a href="#method.is_flag_supported">is_flag_supported</a><a href="#method.new">new</a><a href="#method.no_default_flags">no_default_flags</a><a href="#method.object">object</a><a href="#method.opt_level">opt_level</a><a href="#method.opt_level_str">opt_level_str</a><a href="#method.out_dir">out_dir</a><a href="#method.pic">pic</a><a href="#method.shared_flag">shared_flag</a><a href="#method.static_crt">static_crt</a><a href="#method.static_flag">static_flag</a><a href="#method.target">target</a><a href="#method.try_compile">try_compile</a><a href="#method.try_expand">try_expand</a><a href="#method.try_get_compiler">try_get_compiler</a><a href="#method.use_plt">use_plt</a><a href="#method.warnings">warnings</a><a href="#method.warnings_into_errors">warnings_into_errors</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Default">Default</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class='location'><a href='index.html'>cc</a></p><script>window.sidebarCurrent = {name: 'Build', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/cc/lib.rs.html#90-123' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='index.html'>cc</a>::<wbr><a class="struct" href=''>Build</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct Build { /* fields omitted */ }</pre></div><div class='docblock'><p>A builder for compilation of a native static library.</p>
|
|
<p>A <code>Build</code> is the main type of the <code>cc</code> crate and is used to control all the
|
|
various configuration options and such of a compile. You'll find more
|
|
documentation on each method itself.</p>
|
|
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a href='#impl' class='anchor'></a><a class='srclink' href='../src/cc/lib.rs.html#275-2376' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>() -> <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#281-316' title='goto source code'>[src]</a></h4><div class='docblock'><p>Construct a new instance of a blank set of configuration.</p>
|
|
<p>This builder is finished with the <a href="struct.Build.html#method.compile"><code>compile</code></a> function.</p>
|
|
</div><h4 id='method.include' class="method"><code id='include.v'>pub fn <a href='#method.include' class='fnname'>include</a><P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(&mut self, dir: P) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#333-336' title='goto source code'>[src]</a></h4><div class='docblock'><p>Add a directory to the <code>-I</code> or include path for headers</p>
|
|
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;
|
|
|
|
<span class="kw">let</span> <span class="ident">library_path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">"/path/to/library"</span>);
|
|
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">include</span>(<span class="ident">library_path</span>)
|
|
.<span class="ident">include</span>(<span class="string">"src"</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"foo"</span>);</pre></div>
|
|
</div><h4 id='method.define' class="method"><code id='define.v'>pub fn <a href='#method.define' class='fnname'>define</a><'a, V: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>>>(<br> &mut self, <br> var: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br> val: V<br>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#349-353' title='goto source code'>[src]</a></h4><div class='docblock'><p>Specify a <code>-D</code> variable with an optional value.</p>
|
|
<h1 id="example-1" class="section-header"><a href="#example-1">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">define</span>(<span class="string">"FOO"</span>, <span class="string">"BAR"</span>)
|
|
.<span class="ident">define</span>(<span class="string">"BAZ"</span>, <span class="prelude-val">None</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"foo"</span>);</pre></div>
|
|
</div><h4 id='method.object' class="method"><code id='object.v'>pub fn <a href='#method.object' class='fnname'>object</a><P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(&mut self, obj: P) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#356-359' title='goto source code'>[src]</a></h4><div class='docblock'><p>Add an arbitrary object file to link in</p>
|
|
</div><h4 id='method.flag' class="method"><code id='flag.v'>pub fn <a href='#method.flag' class='fnname'>flag</a>(&mut self, flag: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#371-374' title='goto source code'>[src]</a></h4><div class='docblock'><p>Add an arbitrary flag to the invocation of the compiler</p>
|
|
<h1 id="example-2" class="section-header"><a href="#example-2">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">flag</span>(<span class="string">"-ffunction-sections"</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"foo"</span>);</pre></div>
|
|
</div><h4 id='method.ar_flag' class="method"><code id='ar_flag.v'>pub fn <a href='#method.ar_flag' class='fnname'>ar_flag</a>(&mut self, flag: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#388-391' title='goto source code'>[src]</a></h4><div class='docblock'><p>Add an arbitrary flag to the invocation of the compiler</p>
|
|
<h1 id="example-3" class="section-header"><a href="#example-3">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">file</span>(<span class="string">"src/bar.c"</span>)
|
|
.<span class="ident">ar_flag</span>(<span class="string">"/NODEFAULTLIB:libc.dll"</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"foo"</span>);</pre></div>
|
|
</div><h4 id='method.is_flag_supported' class="method"><code id='is_flag_supported.v'>pub fn <a href='#method.is_flag_supported' class='fnname'>is_flag_supported</a>(&self, flag: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <a class="struct" href="../cc/struct.Error.html" title="struct cc::Error">Error</a>></code><a class='srclink' href='../src/cc/lib.rs.html#423-476' title='goto source code'>[src]</a></h4><div class='docblock'><p>Run the compiler to test if it accepts the given flag.</p>
|
|
<p>For a convenience method for setting flags conditionally,
|
|
see <code>flag_if_supported()</code>.</p>
|
|
<p>It may return error if it's unable to run the compilier with a test file
|
|
(e.g. the compiler is missing or a write to the <code>out_dir</code> failed).</p>
|
|
<p>Note: Once computed, the result of this call is stored in the
|
|
<code>known_flag_support</code> field. If <code>is_flag_supported(flag)</code>
|
|
is called again, the result will be read from the hash table.</p>
|
|
</div><h4 id='method.flag_if_supported' class="method"><code id='flag_if_supported.v'>pub fn <a href='#method.flag_if_supported' class='fnname'>flag_if_supported</a>(&mut self, flag: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#489-492' title='goto source code'>[src]</a></h4><div class='docblock'><p>Add an arbitrary flag to the invocation of the compiler if it supports it</p>
|
|
<h1 id="example-4" class="section-header"><a href="#example-4">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">flag_if_supported</span>(<span class="string">"-Wlogical-op"</span>) <span class="comment">// only supported by GCC</span>
|
|
.<span class="ident">flag_if_supported</span>(<span class="string">"-Wunreachable-code"</span>) <span class="comment">// only supported by clang</span>
|
|
.<span class="ident">compile</span>(<span class="string">"foo"</span>);</pre></div>
|
|
</div><h4 id='method.shared_flag' class="method"><code id='shared_flag.v'>pub fn <a href='#method.shared_flag' class='fnname'>shared_flag</a>(&mut self, shared_flag: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#507-510' title='goto source code'>[src]</a></h4><div class='docblock'><p>Set the <code>-shared</code> flag.</p>
|
|
<p>When enabled, the compiler will produce a shared object which can
|
|
then be linked with other objects to form an executable.</p>
|
|
<h1 id="example-5" class="section-header"><a href="#example-5">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">shared_flag</span>(<span class="bool-val">true</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"libfoo.so"</span>);</pre></div>
|
|
</div><h4 id='method.static_flag' class="method"><code id='static_flag.v'>pub fn <a href='#method.static_flag' class='fnname'>static_flag</a>(&mut self, static_flag: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#526-529' title='goto source code'>[src]</a></h4><div class='docblock'><p>Set the <code>-static</code> flag.</p>
|
|
<p>When enabled on systems that support dynamic linking, this prevents
|
|
linking with the shared libraries.</p>
|
|
<h1 id="example-6" class="section-header"><a href="#example-6">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">shared_flag</span>(<span class="bool-val">true</span>)
|
|
.<span class="ident">static_flag</span>(<span class="bool-val">true</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"foo"</span>);</pre></div>
|
|
</div><h4 id='method.no_default_flags' class="method"><code id='no_default_flags.v'>pub fn <a href='#method.no_default_flags' class='fnname'>no_default_flags</a>(&mut self, no_default_flags: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#537-540' title='goto source code'>[src]</a></h4><div class='docblock'><p>Disables the generation of default compiler flags. The default compiler
|
|
flags may cause conflicts in some cross compiling scenarios.</p>
|
|
<p>Setting the <code>CRATE_CC_NO_DEFAULTS</code> environment variable has the same
|
|
effect as setting this to <code>true</code>. The presence of the environment
|
|
variable and the value of <code>no_default_flags</code> will be OR'd together.</p>
|
|
</div><h4 id='method.file' class="method"><code id='file.v'>pub fn <a href='#method.file' class='fnname'>file</a><P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(&mut self, p: P) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#543-546' title='goto source code'>[src]</a></h4><div class='docblock'><p>Add a file which will be compiled</p>
|
|
</div><h4 id='method.files' class="method"><code id='files.v'>pub fn <a href='#method.files' class='fnname'>files</a><P>(&mut self, p: P) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a> <span class="where fmt-newline">where<br> P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,<br> P::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>, </span></code><a class='srclink' href='../src/cc/lib.rs.html#549-558' title='goto source code'>[src]</a></h4><div class='docblock'><p>Add files which will be compiled</p>
|
|
</div><h4 id='method.cpp' class="method"><code id='cpp.v'>pub fn <a href='#method.cpp' class='fnname'>cpp</a>(&mut self, cpp: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#564-567' title='goto source code'>[src]</a></h4><div class='docblock'><p>Set C++ support.</p>
|
|
<p>The other <code>cpp_*</code> options will only become active if this is set to
|
|
<code>true</code>.</p>
|
|
</div><h4 id='method.cuda' class="method"><code id='cuda.v'>pub fn <a href='#method.cuda' class='fnname'>cuda</a>(&mut self, cuda: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#577-583' title='goto source code'>[src]</a></h4><div class='docblock'><p>Set CUDA C++ support.</p>
|
|
<p>Enabling CUDA will pass the detected C/C++ toolchain as an argument to
|
|
the CUDA compiler, NVCC. NVCC itself accepts some limited GNU-like args;
|
|
any other arguments for the C/C++ toolchain will be redirected using
|
|
"-Xcompiler" flags.</p>
|
|
<p>If enabled, this also implicitly enables C++ support.</p>
|
|
</div><h4 id='method.warnings_into_errors' class="method"><code id='warnings_into_errors.v'>pub fn <a href='#method.warnings_into_errors' class='fnname'>warnings_into_errors</a>(&mut self, warnings_into_errors: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#604-607' title='goto source code'>[src]</a></h4><div class='docblock'><p>Set warnings into errors flag.</p>
|
|
<p>Disabled by default.</p>
|
|
<p>Warning: turning warnings into errors only make sense
|
|
if you are a developer of the crate using cc-rs.
|
|
Some warnings only appear on some architecture or
|
|
specific version of the compiler. Any user of this crate,
|
|
or any other crate depending on it, could fail during
|
|
compile time.</p>
|
|
<h1 id="example-7" class="section-header"><a href="#example-7">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">warnings_into_errors</span>(<span class="bool-val">true</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"libfoo.a"</span>);</pre></div>
|
|
</div><h4 id='method.warnings' class="method"><code id='warnings.v'>pub fn <a href='#method.warnings' class='fnname'>warnings</a>(&mut self, warnings: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#625-629' title='goto source code'>[src]</a></h4><div class='docblock'><p>Set warnings flags.</p>
|
|
<p>Adds some flags:</p>
|
|
<ul>
|
|
<li>"-Wall" for MSVC.</li>
|
|
<li>"-Wall", "-Wextra" for GNU and Clang.</li>
|
|
</ul>
|
|
<p>Enabled by default.</p>
|
|
<h1 id="example-8" class="section-header"><a href="#example-8">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">warnings</span>(<span class="bool-val">false</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"libfoo.a"</span>);</pre></div>
|
|
</div><h4 id='method.extra_warnings' class="method"><code id='extra_warnings.v'>pub fn <a href='#method.extra_warnings' class='fnname'>extra_warnings</a>(&mut self, warnings: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#648-651' title='goto source code'>[src]</a></h4><div class='docblock'><p>Set extra warnings flags.</p>
|
|
<p>Adds some flags:</p>
|
|
<ul>
|
|
<li>nothing for MSVC.</li>
|
|
<li>"-Wextra" for GNU and Clang.</li>
|
|
</ul>
|
|
<p>Enabled by default.</p>
|
|
<h1 id="example-9" class="section-header"><a href="#example-9">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="comment">// Disables -Wextra, -Wall remains enabled:</span>
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">extra_warnings</span>(<span class="bool-val">false</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"libfoo.a"</span>);</pre></div>
|
|
</div><h4 id='method.cpp_link_stdlib' class="method"><code id='cpp_link_stdlib.v'>pub fn <a href='#method.cpp_link_stdlib' class='fnname'>cpp_link_stdlib</a><'a, V: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>>>(<br> &mut self, <br> cpp_link_stdlib: V<br>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#680-686' title='goto source code'>[src]</a></h4><div class='docblock'><p>Set the standard library to link against when compiling with C++
|
|
support.</p>
|
|
<p>The default value of this property depends on the current target: On
|
|
OS X <code>Some("c++")</code> is used, when compiling for a Visual Studio based
|
|
target <code>None</code> is used and for other targets <code>Some("stdc++")</code> is used.
|
|
If the <code>CXXSTDLIB</code> environment variable is set, its value will
|
|
override the default value.</p>
|
|
<p>A value of <code>None</code> indicates that no automatic linking should happen,
|
|
otherwise cargo will link against the specified library.</p>
|
|
<p>The given library name must not contain the <code>lib</code> prefix.</p>
|
|
<p>Common values:</p>
|
|
<ul>
|
|
<li><code>stdc++</code> for GNU</li>
|
|
<li><code>c++</code> for Clang</li>
|
|
</ul>
|
|
<h1 id="example-10" class="section-header"><a href="#example-10">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">shared_flag</span>(<span class="bool-val">true</span>)
|
|
.<span class="ident">cpp_link_stdlib</span>(<span class="string">"stdc++"</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"libfoo.so"</span>);</pre></div>
|
|
</div><h4 id='method.cpp_set_stdlib' class="method"><code id='cpp_set_stdlib.v'>pub fn <a href='#method.cpp_set_stdlib' class='fnname'>cpp_set_stdlib</a><'a, V: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>>>(<br> &mut self, <br> cpp_set_stdlib: V<br>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#721-729' title='goto source code'>[src]</a></h4><div class='docblock'><p>Force the C++ compiler to use the specified standard library.</p>
|
|
<p>Setting this option will automatically set <code>cpp_link_stdlib</code> to the same
|
|
value.</p>
|
|
<p>The default value of this option is always <code>None</code>.</p>
|
|
<p>This option has no effect when compiling for a Visual Studio based
|
|
target.</p>
|
|
<p>This option sets the <code>-stdlib</code> flag, which is only supported by some
|
|
compilers (clang, icc) but not by others (gcc). The library will not
|
|
detect which compiler is used, as such it is the responsibility of the
|
|
caller to ensure that this option is only used in conjuction with a
|
|
compiler which supports the <code>-stdlib</code> flag.</p>
|
|
<p>A value of <code>None</code> indicates that no specific C++ standard library should
|
|
be used, otherwise <code>-stdlib</code> is added to the compile invocation.</p>
|
|
<p>The given library name must not contain the <code>lib</code> prefix.</p>
|
|
<p>Common values:</p>
|
|
<ul>
|
|
<li><code>stdc++</code> for GNU</li>
|
|
<li><code>c++</code> for Clang</li>
|
|
</ul>
|
|
<h1 id="example-11" class="section-header"><a href="#example-11">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">cpp_set_stdlib</span>(<span class="string">"c++"</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"libfoo.a"</span>);</pre></div>
|
|
</div><h4 id='method.target' class="method"><code id='target.v'>pub fn <a href='#method.target' class='fnname'>target</a>(&mut self, target: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#744-747' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures the target this configuration will be compiling for.</p>
|
|
<p>This option is automatically scraped from the <code>TARGET</code> environment
|
|
variable by build scripts, so it's not required to call this function.</p>
|
|
<h1 id="example-12" class="section-header"><a href="#example-12">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">target</span>(<span class="string">"aarch64-linux-android"</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"foo"</span>);</pre></div>
|
|
</div><h4 id='method.host' class="method"><code id='host.v'>pub fn <a href='#method.host' class='fnname'>host</a>(&mut self, host: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#762-765' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures the host assumed by this configuration.</p>
|
|
<p>This option is automatically scraped from the <code>HOST</code> environment
|
|
variable by build scripts, so it's not required to call this function.</p>
|
|
<h1 id="example-13" class="section-header"><a href="#example-13">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>()
|
|
.<span class="ident">file</span>(<span class="string">"src/foo.c"</span>)
|
|
.<span class="ident">host</span>(<span class="string">"arm-linux-gnueabihf"</span>)
|
|
.<span class="ident">compile</span>(<span class="string">"foo"</span>);</pre></div>
|
|
</div><h4 id='method.opt_level' class="method"><code id='opt_level.v'>pub fn <a href='#method.opt_level' class='fnname'>opt_level</a>(&mut self, opt_level: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#771-774' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures the optimization level of the generated object files.</p>
|
|
<p>This option is automatically scraped from the <code>OPT_LEVEL</code> environment
|
|
variable by build scripts, so it's not required to call this function.</p>
|
|
</div><h4 id='method.opt_level_str' class="method"><code id='opt_level_str.v'>pub fn <a href='#method.opt_level_str' class='fnname'>opt_level_str</a>(&mut self, opt_level: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#780-783' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures the optimization level of the generated object files.</p>
|
|
<p>This option is automatically scraped from the <code>OPT_LEVEL</code> environment
|
|
variable by build scripts, so it's not required to call this function.</p>
|
|
</div><h4 id='method.debug' class="method"><code id='debug.v'>pub fn <a href='#method.debug' class='fnname'>debug</a>(&mut self, debug: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#790-793' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures whether the compiler will emit debug information when
|
|
generating object files.</p>
|
|
<p>This option is automatically scraped from the <code>DEBUG</code> environment
|
|
variable by build scripts, so it's not required to call this function.</p>
|
|
</div><h4 id='method.force_frame_pointer' class="method"><code id='force_frame_pointer.v'>pub fn <a href='#method.force_frame_pointer' class='fnname'>force_frame_pointer</a>(&mut self, force: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#801-804' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures whether the compiler will emit instructions to store
|
|
frame pointers during codegen.</p>
|
|
<p>This option is automatically enabled when debug information is emitted.
|
|
Otherwise the target platform compiler's default will be used.
|
|
You can use this option to force a specific setting.</p>
|
|
</div><h4 id='method.out_dir' class="method"><code id='out_dir.v'>pub fn <a href='#method.out_dir' class='fnname'>out_dir</a><P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(&mut self, out_dir: P) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#811-814' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures the output directory where all object files and static
|
|
libraries will be located.</p>
|
|
<p>This option is automatically scraped from the <code>OUT_DIR</code> environment
|
|
variable by build scripts, so it's not required to call this function.</p>
|
|
</div><h4 id='method.compiler' class="method"><code id='compiler.v'>pub fn <a href='#method.compiler' class='fnname'>compiler</a><P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(&mut self, compiler: P) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#821-824' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures the compiler to be used to produce output.</p>
|
|
<p>This option is automatically determined from the target platform or a
|
|
number of environment variables, so it's not required to call this
|
|
function.</p>
|
|
</div><h4 id='method.archiver' class="method"><code id='archiver.v'>pub fn <a href='#method.archiver' class='fnname'>archiver</a><P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(&mut self, archiver: P) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#831-834' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures the tool used to assemble archives.</p>
|
|
<p>This option is automatically determined from the target platform or a
|
|
number of environment variables, so it's not required to call this
|
|
function.</p>
|
|
</div><h4 id='method.cargo_metadata' class="method"><code id='cargo_metadata.v'>pub fn <a href='#method.cargo_metadata' class='fnname'>cargo_metadata</a>(&mut self, cargo_metadata: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#845-848' title='goto source code'>[src]</a></h4><div class='docblock'><p>Define whether metadata should be emitted for cargo allowing it to
|
|
automatically link the binary. Defaults to <code>true</code>.</p>
|
|
<p>The emitted metadata is:</p>
|
|
<ul>
|
|
<li><code>rustc-link-lib=static=</code><em>compiled lib</em></li>
|
|
<li><code>rustc-link-search=native=</code><em>target folder</em></li>
|
|
<li>When target is MSVC, the ATL-MFC libs are added via <code>rustc-link-search=native=</code></li>
|
|
<li>When C++ is enabled, the C++ stdlib is added via <code>rustc-link-lib</code></li>
|
|
</ul>
|
|
</div><h4 id='method.pic' class="method"><code id='pic.v'>pub fn <a href='#method.pic' class='fnname'>pic</a>(&mut self, pic: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#854-857' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures whether the compiler will emit position independent code.</p>
|
|
<p>This option defaults to <code>false</code> for <code>windows-gnu</code> and bare metal targets and
|
|
to <code>true</code> for all other targets.</p>
|
|
</div><h4 id='method.use_plt' class="method"><code id='use_plt.v'>pub fn <a href='#method.use_plt' class='fnname'>use_plt</a>(&mut self, use_plt: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#869-872' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures whether the Procedure Linkage Table is used for indirect
|
|
calls into shared libraries.</p>
|
|
<p>The PLT is used to provide features like lazy binding, but introduces
|
|
a small performance loss due to extra pointer indirection. Setting
|
|
<code>use_plt</code> to <code>false</code> can provide a small performance increase.</p>
|
|
<p>Note that skipping the PLT requires a recent version of GCC/Clang.</p>
|
|
<p>This only applies to ELF targets. It has no effect on other platforms.</p>
|
|
</div><h4 id='method.static_crt' class="method"><code id='static_crt.v'>pub fn <a href='#method.static_crt' class='fnname'>static_crt</a>(&mut self, static_crt: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> &mut <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#877-880' title='goto source code'>[src]</a></h4><div class='docblock'><p>Configures whether the /MT flag or the /MD flag will be passed to msvc build tools.</p>
|
|
<p>This option defaults to <code>false</code>, and affect only msvc targets.</p>
|
|
</div><h4 id='method.try_compile' class="method"><code id='try_compile.v'>pub fn <a href='#method.try_compile' class='fnname'>try_compile</a>(&self, output: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="../cc/struct.Error.html" title="struct cc::Error">Error</a>></code><a class='srclink' href='../src/cc/lib.rs.html#896-966' title='goto source code'>[src]</a></h4><div class='docblock'><p>Run the compiler, generating the file <code>output</code></p>
|
|
<p>This will return a result instead of panicing; see compile() for the complete description.</p>
|
|
</div><h4 id='method.compile' class="method"><code id='compile.v'>pub fn <a href='#method.compile' class='fnname'>compile</a>(&self, output: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>)</code><a class='srclink' href='../src/cc/lib.rs.html#980-984' title='goto source code'>[src]</a></h4><div class='docblock'><p>Run the compiler, generating the file <code>output</code></p>
|
|
<p>The name <code>output</code> should be the name of the library. For backwards compatibility,
|
|
the <code>output</code> may start with <code>lib</code> and end with <code>.a</code>. The Rust compilier will create
|
|
the assembly with the lib prefix and .a extension. MSVC will create a file without prefix,
|
|
ending with <code>.lib</code>.</p>
|
|
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
|
|
<p>Panics if <code>output</code> is not formatted correctly or if one of the underlying
|
|
compiler commands fails. It can also panic if it fails reading file names
|
|
or creating directories.</p>
|
|
</div><h4 id='method.try_expand' class="method"><code id='try_expand.v'>pub fn <a href='#method.try_expand' class='fnname'>try_expand</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>, <a class="struct" href="../cc/struct.Error.html" title="struct cc::Error">Error</a>></code><a class='srclink' href='../src/cc/lib.rs.html#1181-1206' title='goto source code'>[src]</a></h4><div class='docblock'><p>This will return a result instead of panicing; see expand() for the complete description.</p>
|
|
</div><h4 id='method.expand' class="method"><code id='expand.v'>pub fn <a href='#method.expand' class='fnname'>expand</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></code><a class='srclink' href='../src/cc/lib.rs.html#1220-1225' title='goto source code'>[src]</a></h4><div class='docblock'><p>Run the compiler, returning the macro-expanded version of the input files.</p>
|
|
<p>This is only relevant for C and C++ files.</p>
|
|
<h1 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h1>
|
|
<p>Panics if more than one file is present in the config, or if compiler
|
|
path has an invalid file name.</p>
|
|
<h1 id="example-14" class="section-header"><a href="#example-14">Example</a></h1>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
<span class="kw">let</span> <span class="ident">out</span> <span class="op">=</span> <span class="ident">cc</span>::<span class="ident">Build</span>::<span class="ident">new</span>().<span class="ident">file</span>(<span class="string">"src/foo.c"</span>).<span class="ident">expand</span>();</pre></div>
|
|
</div><h4 id='method.get_compiler' class="method"><code id='get_compiler.v'>pub fn <a href='#method.get_compiler' class='fnname'>get_compiler</a>(&self) -> <a class="struct" href="../cc/struct.Tool.html" title="struct cc::Tool">Tool</a></code><a class='srclink' href='../src/cc/lib.rs.html#1245-1250' title='goto source code'>[src]</a></h4><div class='docblock'><p>Get the compiler that's in use for this configuration.</p>
|
|
<p>This function will return a <code>Tool</code> which represents the culmination
|
|
of this configuration at a snapshot in time. The returned compiler can
|
|
be inspected (e.g. the path, arguments, environment) to forward along to
|
|
other tools, or the <code>to_command</code> method can be used to invoke the
|
|
compiler itself.</p>
|
|
<p>This method will take into account all configuration such as debug
|
|
information, optimization level, include directories, defines, etc.
|
|
Additionally, the compiler binary in use follows the standard
|
|
conventions for this path, e.g. looking at the explicitly set compiler,
|
|
environment variables (a number of which are inspected here), and then
|
|
falling back to the default configuration.</p>
|
|
<h1 id="panics-2" class="section-header"><a href="#panics-2">Panics</a></h1>
|
|
<p>Panics if an error occurred while determining the architecture.</p>
|
|
</div><h4 id='method.try_get_compiler' class="method"><code id='try_get_compiler.v'>pub fn <a href='#method.try_get_compiler' class='fnname'>try_get_compiler</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../cc/struct.Tool.html" title="struct cc::Tool">Tool</a>, <a class="struct" href="../cc/struct.Error.html" title="struct cc::Error">Error</a>></code><a class='srclink' href='../src/cc/lib.rs.html#1255-1326' title='goto source code'>[src]</a></h4><div class='docblock'><p>Get the compiler that's in use for this configuration.</p>
|
|
<p>This will return a result instead of panicing; see get_compiler() for the complete description.</p>
|
|
</div></div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Clone' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a href='#impl-Clone' class='anchor'></a><a class='srclink' href='../src/cc/lib.rs.html#89' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.clone' class="method hidden"><code id='clone.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#89' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
|
</div><h4 id='method.clone_from' class="method hidden"><code id='clone_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</code><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#131-133' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
|
</div></div><h3 id='impl-Debug' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a href='#impl-Debug' class='anchor'></a><a class='srclink' href='../src/cc/lib.rs.html#89' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../src/cc/lib.rs.html#89' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
|
</div></div><h3 id='impl-Default' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a href='#impl-Default' class='anchor'></a><a class='srclink' href='../src/cc/lib.rs.html#2378-2382' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.default' class="method hidden"><code id='default.v'>fn <a href='https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default' class='fnname'>default</a>() -> <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a class='srclink' href='../src/cc/lib.rs.html#2379-2381' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns the "default value" for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
|
|
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../cc/struct.Build.html" title="struct cc::Build">Build</a></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Any' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
|
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-217' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-216' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
|
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
|
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#564-568' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -> T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#565-567' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#553-560' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -> U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#557-559' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
</div></div><h3 id='impl-ToOwned' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href='#impl-ToOwned' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#80-92' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Owned' class="type"><code id='Owned.t'>type <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned' class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
|
</div><h4 id='method.to_owned' class="method hidden"><code id='to_owned.v'>fn <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned' class='fnname'>to_owned</a>(&self) -> T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#85-87' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
|
</div><h4 id='method.clone_into' class="method hidden"><code id='clone_into.v'>fn <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into' class='fnname'>clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#89-91' title='goto source code'>[src]</a></h4><div class='stability hidden'><div class='stab unstable'><details><summary><span class='emoji'>🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
|
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
|
|
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#601-610' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
|
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#607-609' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#587-596' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
|
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#593-595' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "cc";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|