Struct gcc::Config [-] [+] [src]

pub struct Config {
    // some fields omitted
}

Extra configuration to pass to gcc.

Methods

impl Config

fn new() -> Config

Construct a new instance of a blank set of configuration.

This builder is finished with the compile function.

fn include<P: AsRef<Path>>(&mut self, dir: P) -> &mut Config

Add a directory to the -I or include path for headers

fn define(&mut self, var: &str, val: Option<&str>) -> &mut Config

Specify a -D variable with an optional value.

fn object<P: AsRef<Path>>(&mut self, obj: P) -> &mut Config

Add an arbitrary object file to link in

fn flag(&mut self, flag: &str) -> &mut Config

Add an arbitrary flag to the invocation of the compiler

fn file<P: AsRef<Path>>(&mut self, p: P) -> &mut Config

Add a file which will be compiled

fn cpp(&mut self, cpp: bool) -> &mut Config

Set C++ support.

The other cpp_* options will only become active if this is set to true.

Set the standard library to link against when compiling with C++ support.

The default value of this property depends on the current target: On OS X Some("c++") is used, when compiling for a Visual Studio based target None is used and for other targets Some("stdc++") is used.

A value of None indicates that no automatic linking should happen, otherwise cargo will link against the specified library.

The given library name must not contain the lib prefix.

fn cpp_set_stdlib(&mut self, cpp_set_stdlib: Option<&str>) -> &mut Config

Force the C++ compiler to use the specified standard library.

Setting this option will automatically set cpp_link_stdlib to the same value.

The default value of this option is always None.

This option has no effect when compiling for a Visual Studio based target.

This option sets the -stdlib 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 -stdlib flag.

A value of None indicates that no specific C++ standard library should be used, otherwise -stdlib is added to the compile invocation.

The given library name must not contain the lib prefix.

fn compile(&self, output: &str)

Run the compiler, generating the file output

The name output must begin with lib and end with .a